Stop loss retry

Created at 27 Dec 2024, 21:31
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
AL

algobeginner

Joined 15.12.2024

Stop loss retry
27 Dec 2024, 21:31


when operate basic operations like 

ExecuteMarketOrder(TradeType.Sell, NewsSymbol, MarketSeries.LastValue, StopLossPips, TakeProfitPips);

why there is in backtest occurrences of not set SL or TP , tick data or bar data same result . 

 

Is possible to prevent to execute order if SL and TP cant be set ?


@algobeginner
Replies

firemyst
28 Dec 2024, 03:16

How do you know it's not an issue with your code that the SL and TP aren't being set?

Why don't you post a sample of the code that reproduces the issue so people can have a look?


@firemyst

algobeginner
28 Dec 2024, 10:23

RE: Stop loss retry

firemyst said: 

How do you know it's not an issue with your code that the SL and TP aren't being set?

Why don't you post a sample of the code that reproduces the issue so people can have a look?

Thanks for advice , but I doubt the code is issue as it occurs only on certain dates across different trading brokers .

came cross this on bar logics , basic three white soldiers , sma .

if it’s necessary I post codes but it’s stock version with optimised parameters . 
 

the purpose of the question is if there is method to verify if during market order the stop loss can’t be set to prevent from open .


@algobeginner

algobeginner
28 Dec 2024, 10:48

RE: Stop loss retry

firemyst said: 

How do you know it's not an issue with your code that the SL and TP aren't being set?

Why don't you post a sample of the code that reproduces the issue so people can have a look?

 { protected override void OnStart()

 { Positions.Opened += Positions_Opened; } private void Positions_Opened(PositionOpenedEventArgs obj) { 

if(obj.Position.StopLoss == null) 

}
 

 this seem to be answer a little bit obsolete, if this could be directly checked upon execution but that probably down the async 😌


@algobeginner