Need help with dual MA Crossover Indicator

 

Hi all,

I am trying to use a dual MA crossover indicator  ( IINWMARROWS.mq4  found in internet) which just displays arrows when a crossing of the two selectedMA's takes place in RENKO charts.

It works ok most of the times but all of a suidden sometimes I get some extra arrows in the last candles which are not valid. If I reapply the template or the indicator,  the invalid arrows disappear.

I have noticed this happens sometimes when there is a very short disconnection between the terminal and the server of my broker.  

Any ideas?  Is there any problem with renko? Isthisdue to disconnection? If yes what canI do ifI use it in a robot?

 

Thanks for your help. 

 

George 

 
  1. Because the indicator updates buffer[0] on a cross but doesn't erase the value if they become uncrossed.
  2. Can occur during a reconnection because the indicator assumes (like the documentation says) that buffer contains all EMPTY_VALUE when it recalculates all values, but buffer isn't reset except initially.
 
WHRoeder:
  1. Because the indicator updates buffer[0] on a cross but doesn't erase the value if they become uncrossed.
  2. Can occur during a reconnection because the indicator assumes (like the documentation says) that buffer contains all EMPTY_VALUE when it recalculates all values, but buffer isn't reset except initially.


WHRoeder thank you very much for your prompt answer.

For cross I use candles 1 & 2 not 0 & 1.  So if I am correct, the reason should be the disconnection.   Since I am newbie in the area,  what can I do?  Is there a solution in this matter? Because I would like to have an EA making automatically all the transactions for me.  How could this be solved? Is there any coding example?

Thanks again.   

 
teamlabs: what can I do?  Is there a solution in this matter?
WHRoeder: because the indicator assumes that buffer contains all EMPTY_VALUE
  1. So stop assuming.
    int counted = IndicatorCounted();
    if(counted < LOOKBACK) counted = LOOKBACK;
    for(int iBar = Bars - 1 - counted; iBar >= 0; --iBar){
       Buffer[iBar] = EMPTY_VALUE;
       :
  2. Don't double post
 
WHRoeder:
teamlabs: what can I do?  Is there a solution in this matter?
WHRoeder: because the indicator assumes that buffer contains all EMPTY_VALUE
  1. So stop assuming.
  2. Don't double post


Thank you WHRoeder for your valuable help.  An accident kept me away from my pc and sent me to a hospital. 

I apologize for the double post. It was not done intentionally but by mistake.   Thank you all once more 

Reason: