Download MetaTrader 5

Need help with dual MA Crossover Indicator

To add comments, please log in or register
Find out how to use widgets at MQL5.community
team
36
team 2014.07.06 16:32 

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 

whroeder1
14519
whroeder1 2014.07.06 16:59  
  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.
team
36
team 2014.07.06 21:28  
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.   

qjol
3243
qjol 2014.07.07 01:03  
whroeder1
14519
whroeder1 2014.07.07 11:19  
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
team
36
team 2014.07.21 04:08  
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 

To add comments, please log in or register