0

Is there any event to use in an Expert Advice that triggers when a new bar is created?

I think OnChartEvent, OnTick, OnTimer doesn't do that.

08Dc91wk
  • 4,254
  • 8
  • 34
  • 67
JLLMNCHR
  • 1,551
  • 5
  • 24
  • 50

1 Answers1

4

Yes, the named handlers do something else

As per MQL4 documentation, built-in OnTick(), OnTimer() et al functions, are pre-defined handlers.

If needed, may try to create one's own, using built-in szstem variable Bars ( iBars() is rather a heavyweight alternative ):

bool aNewBarEVENT(){
     static  int anAlreadyObservedBarCOUNT = EMPTY;    // .INIT
     if ( Bars > anAlreadyObservedBarCOUNT ){          // .TEST
                 anAlreadyObservedBarCOUNT = Bars;     // .UPD
                 return( True );                       // .ACK
     }
     return( False );                                  // .NACK
}

Usage:

enter image description here

user3666197
  • 1
  • 6
  • 50
  • 92