Trailing stop on IB – Stop repositioning on DAX

Forums ProRealTime English forum ProOrder support Trailing stop on IB – Stop repositioning on DAX

Viewing 15 posts - 1 through 15 (of 24 total)
  • #218584

    Hi,

    I want to implement trailing stops in  my strategies on DAX Futures (DXS and DXM) on IB. There is a limitation in terms of stop repositioning to 10 times, sometimes more but I would rather stick to 10.

    I have found trailing stops codes but I am wondering how to set the numbers of iterations.

    Therefore I would like to use a loop like For i=1 to 10… to take profit when stop is touched after the 10th repositioning.

    Has anyone already coded this? Or maybe such topic already exists.

    Thanks for your help.

     

    #218597

    Can you make an example?

     

    #218602

    Sure, it would look like this but I am not sure about the syntax/use:

     

    #218614
    JS

    Hi

     

    I think it’s better to use a “counter” (Step=Step+1) than a loop…

    You can then just let the trailing stop do its job and stop after 10 steps…

    1 user thanked author for this post.
    #218651

    The lines from 30 through the end are logically incorrect. You can’t use iterations that way. I can’t understand the goal you want to achieve.

    Can you write an exemple using just text?

     

    #218652

    Yes @Roberto, I just want to code a trailing stop that moves the stop 10 times at most.

    #218692

    There you go (not tested):

     

    #218703

    Thanks. I will test it tomorrow.

    #231846

    Hi Kumo, I see you’re using Coded trailing stop on IB. I’m using in papermode some systems on IB. does this coded trailing stop works for you? does it happen to you some errors when it goes to execute the stop loss ?

    thank you in advance

    ALessio

    #231849
    JS

    I think Roberto made a typo at the end of his trailing stop…

    If newSL>0 then

    Sell at newSL STOP

    ExitShort at newSL STOP

    EndIf

    When it happens “at Market” then after the first step the newSL>0 and everything is sold “at Market”… (after the first step)

    1 user thanked author for this post.
    #231856

    Well spotted JS 🙂

    #231859
    JS

    Hi Roberto,

    Maybe you can help me too… 🙂

    As can be read regularly on the forum, the use of “pending orders” is a bad combination between PRT and IG/IB. Often things go wrong (on the broker’s side?) with the execution of these orders, for example that the broker cannot confirm the status of the order…

    This is incredibly frustrating, and you also miss a lot of transactions…

    Is there nothing that can be done about this now… Are there no alternatives?

    I also tried it with the new trading instructions (Set Stop Price) but unfortunately with the same outcome…

    #231860

    you mean I have to replace:

    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT Market
    EXITSHORT AT MARKET
    ENDIF
    with this:

    If newSL>0 then

    Sell at newSL STOP

    ExitShort at newSL STOP

    EndIf

    correct?

    sorry I don’t understand what you mean with:

    When it happens “at Market” then after the first step the newSL>0 and everything is sold “at Market”… (after the first step)

    #231861
    JS

    That’s right Aragorna, you have to replace that part…

    What I meant is when the newSL>0 then in Roberto’s code everything is sold “at Market”…

    If newSL>0 then

    Sell at Market

    Of course, that’s not the intention because we want to trail with a STOP order… (Trailing Stop)

    #231865

    Hi Roberto,

    Maybe you can help me too… 🙂

    As can be read regularly on the forum, the use of “pending orders” is a bad combination between PRT and IG/IB. Often things go wrong (on the broker’s side?) with the execution of these orders, for example that the broker cannot confirm the status of the order…

    This is incredibly frustrating, and you also miss a lot of transactions…

    Is there nothing that can be done about this now… Are there no alternatives?

    I also tried it with the new trading instructions (Set Stop Price) but unfortunately with the same outcome…

    You are right, there’s not much you (as well as anyone else) can do to change this, but to stick to the broker’s minimum distance requirements and adding some extra points to accomodate volatility changes. I trade mainly DAX, for which IG usually require 6 pips; since it’s not possible to know when that distance will rise, I use a minimun distance of  10 pips. Now I rarely experience such nuisances on my demo account and I never experienced any on my real account.

    If IG would enable users to know such kind of requirements, as well as spread etc…, it would be  highly welcome by all of us!

     

     

    1 user thanked author for this post.
    avatar JS
Viewing 15 posts - 1 through 15 (of 24 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login