I tested the following code in the strategy tester, and it did fine.
Running on a simulation account in real market, the SetStopLoss is not triggered and is being rejected.
SetProfitTarget("buyOrder", CalculationMode.Pips, BoxSize * ProfitFactor);
SetStopLoss("buyOrder", CalculationMode.Pips, BoxSize, false);
EnterLong(DefaultQuantity,"buyOrder");
The log results in the following error.
| 10.02.2025 11:55:30 | Default | Strategy 'BoxTradingStrategyDS/340536570': An Set() method to submit an exit order at '02/10/2025 00:01:00' has been ignored. Please search on the term 'Internal Order Handling Rules that Reduce Unwanted Positions' in the Help Guide for detailed explanation. |
This is the documentation I found, but it doesn't describe any problem I would have.
The following rules are true per unique signal name:
Methods that generate orders to enter a position will be ignored if:
•A position is open and an order submitted by a non market order exit method (ExitLongLimit() for example) is active and the order is used to open a position in the opposite direction
•A position is open and an order submitted by a set method (SetStopLoss() for example) is active and the order is used to open a position in the opposite direction
•A position is open and two or more Entry methods to reverse the position are entered together. In this case the second Entry order will be ignored.
•The strategy position is flat and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction
•The entry signal name is not unique
Methods that generate orders to exit a position will be ignored if:
•A position is open and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction
•A position is open and an order submitted by a set method (SetStopLoss() for example) is active
Set() methods that generate orders to exit a position will be ignored if:
•A position is open and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction
•A position is open and an order submitted by a non market order exit method (ExitLongLimit() for example) is active
Where could the bug be?
Thanks and best
Szymon

Comment