How do you simulate trade execution only when market price passes thru your limit order rather than touching it?

 

Hi guys,

This problem exists for the central exchange with futures.

I notice for a long time, on demo account, when the market price touches the limit order, it will immediately be triggered.

But on live account, the market price needs to pass through the limit order in order for it to be triggered seemingly all the time, ie. at least one tick below buy limit order. 

Similarly for sell limit orders with one tick above it in order to be triggered.

Is there a way for me to work around this problem on demo account, and simulate trade execution only when the market price passes through the limit order only?


P.S. I actually hope the demo account can be customised for this mode of trade execution for the expert adviser from the programmer side.


Any advice is appreciated. 

Thanks

 
Zee Zhou Ma:

Is there a way for me to work around this problem on demo account, and simulate trade execution only when the market price passes through the limit order only?

My first thought is that you could use virtual pending orders in your EA.

The EA programmatically tracks price vs. pending levels (that you set), and when the levels are reached, the EA places market orders.

 
Anthony Garot:

My first thought is that you could use virtual pending orders in your EA.

The EA programmatically tracks price vs. pending levels (that you set), and when the levels are reached, the EA places market orders.

Yes I guess that is probably the only way to do it for now. 

If MQL5 has a library for test tools to simulate limit orders virtually, it will be fantastic since this is a common problem. 

Imagine everyone working on this problem has to develop the same source code repeatedly and reinventing the wheel. 

I am searching the internet now for the source code, otherwise I have to code it myself.

Thanks.

 
Zee Zhou Ma:

If MQL5 has a library for test tools to simulate limit orders virtually, it will be fantastic since this is a common problem. 

https://www.mql5.com/en/code/22577

Virtual
Virtual
  • www.mql5.com
This cross-platform allows working with a virtual trading environment in one of the easiest ways. Scenarios for using a virtual trading environment This means, you can observe what would be if the EA traded on the most recent prices in the tester in real time. This allows you to identify the causes of discrepancies between the real market and...
 

What does TS stand for? --> I have posted in the discussion thread linking to the article. All questions will be sent there. Need your help if I have any questions. 

Thanks I shall try it out tomorrow. This will be a great help if it works. I have burnt money just to run my limit orders in live environment...

Reason: