Can return be replaced by continue ?

 
void OnTick()
  {
//--- check for history and trading
   if(Bars<100 || IsTradeAllowed()==false)
      return;     // Can this return be replaced by continue ? After this return, it back to the start of Ontick function ? 
//--- calculate open orders by current symbol
   if(CalculateCurrentOrders(Symbol())==0) CheckForOpen();
   else                                    CheckForClose();
//---
  } 
//The blue part is my question, thank you very much.
 
a2495432675:
No, it can't.
 

As soon as the next tick comes in, it will return to the beginning of OnInit() anyway.

If you wish to process something between ticks, you're best to use OnTimer(). 

 
zirkoner:
No, it can't.
Thank you.
 
honest_knave:

As soon as the next tick comes in, it will return to the beginning of OnInit() anyway.

If you wish to process something between ticks, you're best to use OnTimer(). 

Thank you.

Still have question. I'm a beginner. 

Ontick() and OnInit() are same thing ? 

OnTimer()? OnTicks() ? OnInit ? zzzzzzzz…

I'll check in MetaEditor…but maybe I can not fully understand those things haha.

Thank you a lot! 

 

This should hopefully help explain https://docs.mql4.com/basis/function/events

But the basics:

OnInit runs once when the EA/indicator starts.

OnTick (EAs) and OnCalculate (indicators) run whenever a new tick comes in 

OnTimer runs on a time delay

OnDeinit runs once when the EA/indicator stops

 
honest_knave:

This should hopefully help explain https://docs.mql4.com/basis/function/events

But the basics:

OnInit runs once when the EA/indicator starts.

OnTick (EAs) and OnCalculate (indicators) run whenever a new tick comes in  

// What if when sometimes, the ticks just keep coming in and non-stop ? Everytime, when there is a new tick, EA go back to the start of Ontick() ? Thank you a lot !

// Or the EA go through from the beginning to the end, and then check another new tick?  Thanks again!

OnTimer runs on a time delay

OnDeinit runs once when the EA/indicator stops 

 

OnTick will run whenever a new tick comes in.

New tick... OnTick runs

Another new tick... OnTick runs

Another new tick... OnTick runs 

If your EA hasn't finished processing OnTick before the next tick comes in, it will queue OnTick to run again immediately after it finishes.

But it will only queue 1 tick. So if 5 ticks come through before OnTick finishes, it will run OnTick once more (not 5 times more).

 

The other events OnInit or OnDeinit are designed to run once... at the start and at the end. This also happens if you change chart timeframes. Don't put code here that you want to run every tick. 

 
honest_knave:

OnTick will run whenever a new tick comes in.

New tick... OnTick runs

Another new tick... OnTick runs

Another new tick... OnTick runs 

If your EA hasn't finished processing OnTick before the next tick comes in, it will queue OnTick to run again immediately after it finishes.

But it will only queue 1 tick. So if 5 ticks come through before OnTick finishes, it will run OnTick once more (not 5 times more). // If there is 5 ticks like you said, so it run according the lastest tick after OnTick finishes right ?

 

The other events OnInit or OnDeinit are designed to run once... at the start and at the end. This also happens if you change chart timeframes. Don't put code here that you want to run every tick. 

 Thank you very much for all you info. Really helpful to me. Thank you!

 

maaf master tolong saya buatkan code sebagai filter supaya ea saya setelah  terkena  TP jangan open lagi   contoh open posisi  SELL ketika RSI> 70 .. TP =10 ;  jika RSI masih di area 70 jangan open lagi ketika sudah TP tetapi menunggu sinyal berikutnya

 

terima kasih  

Reason: