Hi everyone.
I was trading US oil on IG with PRT with a fixed spread of 2.8.
And my code incorporates a trailing stop mechanism using “tradeprice(1)” to indicate my entry price. During the probacktest, a 2.8 pt spread was set and the orders were executed at open price of a bar + 2.8/2, and everything was fine. However, in live trading, sometimes the orders were executed at open price of a bar + 2.8/2+x, where x is varying from 0.1 to 0.4. The presence of x does alter my “tradeprice(1)” sometimes, leading to trailing stop order not triggered, which further result in a winning trade in probacktest yet losing trade in real trade.
My questions are:
- Is the presence of x due to network latency / IG issue?
- is there anyway on coding that could help me tackle this issue? Not using function “tradeprice”?
Thanks.
Is the presence of x due to network latency / IG issue?
Isn’t x the variation in IG spread in the Live environment?
the spread for US oil is fixed at 2.8 points as shown on ig’s website.
Please provide the link to where it says that the spread on oil is fixed. As far as I am aware no spread is fixed. Brokers will adjust spread based on volatility and also how their own book is balanced at any moment in time.
If your issue is due to difference between the closing price you use to calculate a stop and the actual TRADEPRICE that you get at the next candle open +/- spread when the trade is opened then the best thing is to use MTF and use a very fast time frame to check if you are now on the market and recalculate all stops and take profits using the TRADEPRICE a second after the trade has opened.
I just discovered that the order executed were seconds after the instant that it should be – network latency.(from the email notification of order)
Since MTF isn’t available on PRTv10.3, Is there any functions that i can store the value of open price of the entry candle for my calculation of trailing stop ?
TRADEPRICE is exact price where the order is opened. Since it is the broker that give you that price, you can’t know it in advance! The best way to do is indeed to use MTF to catch quickly the tradeprice that the broker returned.
MTF should theoretically be usable by all IG customers during the month of June.
Thanks Nicolas.
I understand the benefit of MTF. But it would not be necessary if my trailing stop is calculated each time after completion of bar?
With the help of the MTF, you can have your strategy conditions tested on a 5 minute bars but your orders management made on a 1-second timeframe. So you could update theoretically 300 times your stoploss levels in a 5-minute bar (it will be less of course, because of technical limitations such as slippage).
That sounds interesting, but I just tested the function “timeframe” and error message popped up saying that it is only available in ProScreener only.
Yes because it is still not officially released, you can ask your broker to activate it (beta version). A lot of people did the same here and are using it now.
Does anyone using IG know how to activate? Just make a request by sending an email??
Just make a request by sending an em
Yes I believe that is the method.
You would need to quote your IG account number.