I think I found a solution, I changed the last line with:
return(rates_total);
And seems like it is working
Now I am struggling with another problem. I think the problem lies with the code below, because the line wont calculate correctly. About 10 bars before the newest bar the line just shoots straight up or down
int to_copy; if(prev_calculated>rates_total || prev_calculated<0) to_copy=rates_total; else { to_copy=rates_total-prev_calculated; if(prev_calculated>0) to_copy++; } //Copy MA values into array CopyBuffer(SMA_PH_Handle,0,0,to_copy ,SMA_PH_Buf); CopyBuffer(SMA_PL_Handle,0,0,to_copy,SMA_PL_Buf);
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hey there everyone,
I am busy writing my first MQL5 indicator. I'm not sure what I am doing wrong, but it does not work. It is a very simple indicator, it one line that should be drawn, but nothing is happening.
I would appreciate it if someone could help me spot the problem. Like I said NOTHING is working, it wont draw any line on the chart. Here is the code: