MT5 Irregular Program Flow

 

Gang,

I have posted several times on the MQL5.com forum but it's a little like Paris Texas over there!

I am getting some very wierd program flow behaviour in MT5 with a pivots indicator I ported over from MQL4.

In essence the program flow is:-

  • OnDeninit() - Clear_Levels() - return
  • OnInit()- Clear_Levels()- Draw_Pivots()- return
  • On_Calculate() - Check_Price_Action_Pivot_Proximity() - return

When I flick between timeframes, most of the time I get the correct program flow - BUT sometimes I am getting the Clear_Levels() function being called again after the Draw_Pivots() function has been called.

WTF????!!!!!