I have a Trailing Stop built into my trading system and I trade via IG Markets. In the IG system there is an additional component when you enter a Trailing Stop which is the Step Level. This is in effect the amount that the price has to change before the Trailing Stop is triggered. In ProRealTime their is no Step Level so when an order is triggered automatically the Step Level used in the IG system is their minimum level for that market. Some of these Step Levels are much higher then I require, an example being EUR/SGD Mini Contract which is 50 when I want to use 10. Can anyone think of a method in ProRealTime to get around this?
It can be done programmatically, but you’ll have to create yourself a step variables that’ll test at each bar if the price met the conditions to make a new step or not. Then if the price goes below this step, you close the order (for a long trade) and vice-versa. Is this something that could handle what you want to do?
Nicolas,
Thanks for your response to my post. I think I understand the concept of what you suggest as a solution and I’m going to study how to program this. I will publish my results when I have something to show.
Another solution would be to move your stoploss automatically with the SET STOP pLOSS instruction. I think it should have the same effect.
Hi Nicolas,
I also have the same problem with Trailing Steps. You mention this can be done programmatically, i’d be very grateful if you could provide some pointers how to do this. I work with hourly bars, I can’t figure out how to get the current real-time price (tick by tick). This would allow one to compare current price against entryPrice and then move stop up/down accordingly.
Thanks
Hi, you can’t get real time tick per tick on hourly timeframe since conditions are only test once per bar.
As for Trailing stop with customize step, you can do this (example with only a one step move, but it could be adapted to a dynamic trailing easily)
defparam cumulateorders = false
c1 = close>close[1]
if c1 then
BUY 1 LOT AT MARKET
SET STOP PLOSS 50
endif
IF NOT ONMARKET THEN
newSL=0
ENDIF
IF LONGONMARKET AND close-tradeprice(1)>=30*pipsize THEN
newSL = tradeprice(1)+5*pipsize
ENDIF
IF newSL>0 THEN
SELL AT newSL STOP
ENDIF
In this example, the stop loss is moved automatically at trade price open +5 points, for a long position, when the price has moved favourably 30 points above the open price.
Thanks Nicolas! Usefull for me, was making me crazy with a lot of code lines… and when I see your answer just… :O Happy!
Thanks Nicolas, this is very useful code. Only problem for me is that I need to trail the price within an hourly bar as my strategy only uses a 1 hour bar.
I really hope ProBuilder supports real time pricing for all timeframes soon, currently it is a major blocker to getting strategies working correctly.
@Adolfo : you’re welcome! 🙂
@KeepGoingTrader: if you are placing a stop order to exit a position like in my previous code, this order will take place in the broker’s order book. So it will exit at exact price.
This is great, I also trade with IG Markets and have been working on this same problem, thanks Nicolas will try this out.