I am a beginner in coding Indicators.
I am trying to add a Daily Moving average line onto a 1 hour chart.
so the code I am using is:
int limit = rates_total - prev_calculated;
if(prev_calculated < 1)
for(int i = limit-1; i >= 0; i--)
DailyMA[i] = iMA(Symbol(),1440,7,0,MODE_EMA,PRICE_CLOSE,0);
If I change the 1440 to Period(), it works, but with 1440, it just makes one straight line and never changes.
Can anyone please help my by telling me what I am doing wrong?
for (int i = limit-1; i >= 0; i--)
int y = iBarShift(NULL, 1440, time[i]);
DailyMA[i] = iMA(Symbol(),1440,7,0,MODE_EMA,PRICE_CLOSE,y);
How about this?
Please use SRC button to write programs.
Thank you very much! I really Appreciate it!