Looking to turn the below script into an MTF
Ruby:
def H = highestAll( high );
def ll=LowestAll(data = LOW);
def avgC12 = expAverage(close,8);
def avgC26 = expAverage(close, 12);
def avgC10 = expAverage(close, 10);
def avgC20 = expAverage(close, 20);
def avgC50 = expAverage(close,30);
def avgDiff12_26_1 = expAverage(avgC12[1] - avgC26[1], 120);
def avgDiff12_26 = expAverage(avgC12 - avgC26, 120);
def condition1 = (avgC12 - avgC26 > 0) or (avgDiff12_26_1 < avgDiff12_26);
def condition2 = avgC12 - avgC26 > avgDiff12_26;
def condition3 = (avgC10 > avgC20) or (avgC10 > avgC50);
def condition4 = avgC20 > avgC50;
#def condition5 = close>vwap;
def finalCondition =if (condition1 and condition2) and (condition3 and condition4) then 1 else 0;
#def finalCondition =if (condition1 and condition2) and (condition3 and condition4) and (condition5) then 1 else 0;
addCloud( if( finalCondition ,h ,double.nan),ll , color.cyan , color.white);
addCloud( if( finalCondition==0 ,h ,double.nan),ll , Color.white , color.cyan);
Last edited by a moderator: