Script Error Resolution
Forums › ProRealTime English forum › ProRealTime platform support › Script Error Resolution
- This topic has 5 replies, 3 voices, and was last updated 2 months ago by cozcozy.
-
-
08/27/2024 at 2:13 PM #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
endifif (sellCondition) then
sellshort 0.1 share at market
set stop loss (close + 1 * atrValue)
set target profit 40
endifThe 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.08/28/2024 at 4:00 AM #236769Hi,
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”…
08/28/2024 at 4:37 AM #236771I 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.
08/28/2024 at 8:08 AM #23677408/30/2024 at 2:49 PM #23690108/30/2024 at 2:59 PM #236902 -
AuthorPosts
Find exclusive trading pro-tools on