Convert to MTF

BannonMan85

New member
Platform
  1. Thinkorswim
Hey Guys, how can I convert this to MTF?

Code:
 declare upper;

input indicator = { T1, T2, default T3, T4, T5, T6 };

input price = close;

input period = 10;

input volumeFactor = 0.70;

input displace = 0;

input sign = { default plus, minus };

input Label = No;

input paintbars = No;

script _gd {

    input _price = close;

    input _period = 10;

    input _v = 0.70;

    input _sign = { default plus, minus };

    def _ema = ExpAverage( _price, _period );

    plot _gd = ( _ema * ( 1 + _v ) ) - ( ExpAverage( _ema, _period ) * _v );

}

def _t1 = _gd( price[-displace], period, volumeFactor, sign );

def _t2 = _gd( _t1, period, volumeFactor, sign );

def _t3 = _gd( _t2, period, volumeFactor, sign );

def _t4 = _gd( _t3, period, volumeFactor, sign );

def _t5 = _gd( _t4, period, volumeFactor, sign );

def _t6 = _gd( _t5, period, volumeFactor, sign );

plot T3;

switch ( indicator ) {

case T1:

    T3 = _t1;

case T2:

    T3 = _t2;

case T3:

    T3 = _t3;

case T4:

    T3 = _t4;

case T5:

    T3 = _t5;

case T6:

    T3 = _t6;

}

T3.AssignValueColor(if T3 > T3[1] then Color.GREEN else Color.RED);

T3.HideBubble();

AddLabel(Label, if T3 > T3[1] then " A " else " A ", if T3 > T3[1] then Color.GREEN else Color.RED);

AssignPriceColor(if paintbars and T3 < T3[1] then Color.DARK_RED else if paintbars and T3 > T3[1] then Color.DARK_GREEN else Color.CURRENT);
 

barbaros

Administrator
Staff member
Try this

Code:
declare upper;

input indicator = { T1, T2, default T3, T4, T5, T6 };

input agg = AggregationPeriod.DAY;

input period = 10;

input volumeFactor = 0.70;

input displace = 0;

input sign = { default plus, minus };

input Label = No;

input paintbars = No;

def price = close(period = agg);

script _gd {

    input _price = close;

    input _period = 10;

    input _v = 0.70;

    input _sign = { default plus, minus };

    def _ema = ExpAverage( _price, _period );

    plot _gd = ( _ema * ( 1 + _v ) ) - ( ExpAverage( _ema, _period ) * _v );

}

def _t1 = _gd( price[-displace], period, volumeFactor, sign );

def _t2 = _gd( _t1, period, volumeFactor, sign );

def _t3 = _gd( _t2, period, volumeFactor, sign );

def _t4 = _gd( _t3, period, volumeFactor, sign );

def _t5 = _gd( _t4, period, volumeFactor, sign );

def _t6 = _gd( _t5, period, volumeFactor, sign );

plot T3;

switch ( indicator ) {

case T1:

    T3 = _t1;

case T2:

    T3 = _t2;

case T3:

    T3 = _t3;

case T4:

    T3 = _t4;

case T5:

    T3 = _t5;

case T6:

    T3 = _t6;

}

T3.AssignValueColor(if T3 > T3[1] then Color.GREEN else Color.RED);

T3.HideBubble();

AddLabel(Label, if T3 > T3[1] then " A " else " A ", if T3 > T3[1] then Color.GREEN else Color.RED);

AssignPriceColor(if paintbars and T3 < T3[1] then Color.DARK_RED else if paintbars and T3 > T3[1] then Color.DARK_GREEN else Color.CURRENT);
 

BannonMan85

New member
Thanks Barbaros, this is exactly what I was looking for. I just have to remember that when I see the plot of the indicator on a lower time frame, that it will always be red. I want to know where the 3, 8 and 21 for the day chart when i am looking at a 3m chart because they are really good for overall support and resistance. so I really appreciate it
 
Top