Script Error Resolution

Viewing 6 posts - 1 through 6 (of 6 total)
  • #236745

    I get an error when I run a script that contains the following command.

    atrValue = AverageTrueRange[atrPeriod]

    if (buyCondition) then
    buy 0.1 share at market
    set stop loss (close – 1 * atrValue)
    set target profit 40
    endif

    if (sellCondition) then
    sellshort 0.1 share at market
    set stop loss (close + 1 * atrValue)
    set target profit 40
    endif

    The error is “Your trading system was stopped because it tried to place a stop order below the minium distance required by your broker”.
    I would like to know how to resolve this error.

    #236769
    JS

    Hi,

    IG may, during the running time of your system, change the height of the minimum stop distance. If you do not meet this (new) minimum stop distance, your system can be stopped by rejecting the stop order.

    Solution: During the activation of your system, you have to accept the automatic adjustment of your stops by checking the checkbox “Adjust stops”…

    2 users thanked author for this post.
    #236771

    I read the error as: ‘Your Broker’ has a ‘Minimum Stop Distance’ and your +/-  1*ATR was too small, and below the level.

    First thing, find out the Minimum Stop Distance for that instrument used.

    If I try the set a manual trade with too small a stop, I get a warning box appear, and usually it states what the minimum distance is.

     

    Also you will have to take into account any spread and the direction the price is moving at entry, because even the minimum may be too tight if its going against trade direction, and the spread may change through the day.

    Its possible that the instrument, at certain times, 1*atr may be big enough, but not at others.

     

    The solution is to increase the size of the stop.

    For alternatives:

    • Only take trades when the 1*ATR is bigger than the Minimum Stop Distance.
    • Have the stop at 1*ATR, or at the approx minimum distance, which ever is bigger.
    • Use a different multiplier value on the ATR, example 1.5 * ATR etc… if thats big enough.
    • other…

    This will increase the risk on the trade, and therefore you may want to reduce the entry size to compensate.

    Changing the Stop size will alter the win rate and hence the risk/reward may not be adequate, so will have to backtest with new parameters.

    These are a few general thoughts, It depends on how and what your trading, and what you trying to achieve with system/strategy.

    Hopefully this may be helpful

     

     

    1 user thanked author for this post.
    #236774
    JS

    Unfortunately, no one knows in advance what values IG will adjust the minimum stop distance to, especially in volatile times…

    As you can see on the screenshot for the US Tech 100 the Stop distance (min-max): 4 points – 75% !!!

     

    #236901

    @JS

    Thanks for the reply.
    By checking the checkbox as you advised, the program worked.
    However, the trade results were not very good. I will work on improving it…

    #236902

    @druby

    Thank you for the useful advice you gave me.

Viewing 6 posts - 1 through 6 (of 6 total)

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