MT4 Advise- checking next few candles after 2 MAs cross over

 

Hi,

Can any one please advise on my coding where I am wrong, basically I want to check 10 next candles after 2 moving averages cross but I am not able to run the counter loop.

Please find attached my coding.

Many thanks.

Aryan

 
  1. When you post code please use the CODE button (Alt-S)! (For large amounts of code, attach it.) Please edit your (original) post.
              General rules and best pratices of the Forum. - General - MQL5 programming forum
              Messages Editor

  2. Drop your IsNewCandle() it doesn't belong in indicators. Your loop should process all bars.
 
whroeder1:
  1. When you post code please use the CODE button (Alt-S)! (For large amounts of code, attach it.) Please edit your (original) post.
              General rules and best pratices of the Forum. - General - MQL5 programming forum
              Messages Editor

  2. Drop your IsNewCandle() it doesn't belong in indicators. Your loop should process all bars.

Hi Whroeder1,

Thanks for the reply. I have edit my post.

On dropping IsNewCandle() function, i am still not getting candles exactly after cross either up or down.

Main loop runs from right to left (first candle to last candle) and standard code is:

int  counted_bar=IndicatorCounted();

   if(counted_bar<0) counted_bar=1;

   limit=Bars-counted_bar;

   for(shift=0; shift<limit; shift++)


On certain condition, I want another loop to run for next new candle from right to left within main loop and code is:

for(int count=10; count<0; count--)

                 {

                   up[count]=Low[count];

                 }

I even tried to run a loop for(int count=shift; count<shift+10; count++)

                 {

                   up[shift]=Low[shift];

                 }

But no result, I am struck on this second loop for a while, please guide me what is wrong on this second loop?


Thanks.

Aryan

 

Can anyone please guide me on my coding, I am not getting immediate next 10 up or down arrows after 2 moving averages cross over?

Thanks.

Reason: