Event handling OnTick and OnChartEvent - page 2

 
Alain Verleyen:
I bet for an issue in your code.

You sound like you're the master "know it all".. five years later, same problem is experienced with the OnTrade() vs OnTick() events; by another allegedly "inexperienced" programmer right?..

Obviously the documentation mentions: "there is no queueingof new global events while another of " same type" is being processed" for example OnTick(): (newtick1..processing..); (newtick2..not enqueued..newtick1 still processing); (newtick1..done processing); (newtick3..enqueued..processing)...etc..

But it does not mention anything about global events processing hierarchy based on type, to the best of my knowledge. Example I met with this issue today: while debugging my umpteenth EA, the following events occurred in the same sequence as I hereby present:

1st: A stoploss was triggered.. an exit deal triggers OnTrade()

2nd: Debugger breakpoint toggled at void OnTrade()

3rd: {new tick received}

#missing: OnTrade() not processed.. cancelled because of new tick event

3rd: Debugger breakpoint toggled at void OnTick()

4th: OnTick() processed.. New order sent and accepted..

5th: OnTrade() triggered again

last: OnTrade() processed.

In summary, the compiler instructs the OnTrade() function to be cancelled at reception of new OnTick() event.

I expected the processing hierarchy to be first come first served.. or rather first processed.

Or maybe it happens just on the tester?, or not? .. clarification will be appreciated.


So, Mister @Alain Verleyen or anybody that can, please be so kind to help settle this matter for us and those of the future.. thanks.  

 
  1. Ozoigboanugo Valentine: You sound like you're the master "know it all"..

    How To Ask Questions The Smart Way. (2004
              Don't rush to claim that you have found a bug.
    Questions Not To Ask
              My program doesn't work. I think system facility X is broken.

    It is almost always your code.


  2. It takes time to process orders. You have no idea whether the trade results or a new tick was first sent by the broker. You are assuming that everything is synchronous; it is not.

 
Ozoigboanugo Valentine:

You sound like you're the master "know it all".. five years later, same problem is experienced with the OnTrade() vs OnTick() events; by another allegedly "inexperienced" programmer right?..

Obviously the documentation mentions: "there is no queueingof new global events while another of " same type" is being processed" for example OnTick(): (newtick1..processing..); (newtick2..not enqueued..newtick1 still processing); (newtick1..done processing); (newtick3..enqueued..processing)...etc..

But it does not mention anything about global events processing hierarchy based on type, to the best of my knowledge. Example I met with this issue today: while debugging my umpteenth EA, the following events occurred in the same sequence as I hereby present:

1st: A stoploss was triggered.. an exit deal triggers OnTrade()

2nd: Debugger breakpoint toggled at void OnTrade()

3rd: {new tick received}

#missing: OnTrade() not processed.. cancelled because of new tick event

3rd: Debugger breakpoint toggled at void OnTick()

4th: OnTick() processed.. New order sent and accepted..

5th: OnTrade() triggered again

last: OnTrade() processed.

In summary, the compiler instructs the OnTrade() function to be cancelled at reception of new OnTick() event.

I expected the processing hierarchy to be first come first served.. or rather first processed.

Or maybe it happens just on the tester?, or not? .. clarification will be appreciated.


So, Mister @Alain Verleyen or anybody that can, please be so kind to help settle this matter for us and those of the future.. thanks.  

If the reliability of your EA depends of the sequence of events then fix your code.

You are doing assumptions,as noted by William. I strongly doubt an OnTrade() event is ever cancelled by an OnTick().

Change your sarcastic tone if you want further answers.

Reason: