Trailing Stpos

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #5362 quote
    deletedaccount14122020
    Participant
    New

    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?

    Screen-Shot-2016-04-14-at-10.17.36.png Screen-Shot-2016-04-14-at-10.17.36.png
    #5369 quote
    Nicolas
    Keymaster
    Master

    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?

    #5387 quote
    deletedaccount14122020
    Participant
    New

    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.

    #5408 quote
    Nicolas
    Keymaster
    Master

    Another solution would be to move your stoploss automatically with the SET STOP pLOSS instruction. I think it should have the same effect.

    #6346 quote
    KeepGoingTrader
    Participant
    New

    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

    #6354 quote
    Nicolas
    Keymaster
    Master

    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.

    #6360 quote
    Adolfo
    Participant
    Senior

    Thanks Nicolas! Usefull for me, was making me crazy with a lot of code lines… and when I see your answer just… :O Happy!

    #6361 quote
    KeepGoingTrader
    Participant
    New

    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.

    #6376 quote
    Nicolas
    Keymaster
    Master

    @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.

    #6392 quote
    Daznic
    Participant
    Junior

    This is great, I also trade with IG Markets and have been working on this same problem, thanks Nicolas will try this out.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.

Trailing Stpos


ProOrder: Automated Strategies & Backtesting

New Reply
Summary

This topic contains 9 replies,
has 5 voices, and was last updated by Daznic
9 years, 9 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/14/2016
Status: Active
Attachments: No files
Logo Logo
Loading...