Custom Alert is One Bar Late?
There is no delay if you program as follows. However, since an alert will be issued when the candlestick is not finalized, we usually program it to alert when the candlestick is finalized.
double CurrentMA1 = iMA(NULL,0,MA1Period,MA1Shift,MA1Method,MA1AppliedPrice,0); double PreviousMA1 = iMA(NULL,0,MA1Period,MA1Shift,MA1Method,MA1AppliedPrice,1); double CurrentMA2 = iMA(NULL,0,MA2Period,MA2Shift,MA2Method,MA2AppliedPrice,0); double PreviousMA2 = iMA(NULL,0,MA2Period,MA2Shift,MA2Method,MA2AppliedPrice,1);
Naguisa Unada:
Thank you very much!
There is no delay if you program as follows. However, since an alert will be issued when the candlestick is not finalized, we usually program it to alert when the candlestick is finalized.
I made a custom moving average alert system that is suppose to alert me each time my two moving averages cross each other. I am using MA's and alerts right now for simplicity but I plan on implementing the final strategy to a more advanced EA. I am quite new to coding so for whatever reason I get an alert but it is exactly one candle late. Any help would be greatly appreciated.
Here is the code for my Custom Indicator: