I am still learning to code and I tried to plot a label for displaced EXPO MA.
There is something wrong with my code.
On the screenshot below
Thanks a lot
There is something wrong with my code.
Code:
input length1 = 25;
input length2 = 15;
def EMA25 = ExpAverage((high + low) /2, 25);
def EMA15 = ExpAverage((open + high + low + close)/4, 15);;
plot shiftedEMA25 = ema25[2];
plot shiftedEMA15 = ema15[3];
AddLabel(1, "Moving Average " + shiftedEMA25 + "/" + shiftedEMA15 + " Cross Direction = " + if shiftedEMA15 > shiftedEMA25 then "UP" else "DOWN", if shiftedEMA15 > shiftedEMA25 then Color.GREEN else Color.RED);
On the screenshot below
- the dashed lines are how the shifted MAs should look like
- the solid lines are the plots from my code above
Thanks a lot