Ctrader Algo sometimes missed signal!

Created at 05 Nov 2024, 04:16
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!
DK

dkt0591

Joined 20.08.2024

Ctrader Algo sometimes missed signal!
05 Nov 2024, 04:16


Hi,

I'm very confusing because what happened today. Please help

My bot logic is if RSI lower than RsiCloseLoss it will close all positions openning, but when RSI go to 14,17 (RsiCloseLoss is 22) it do nothing, double check my code and it seem right. It worked before, but sometimes it doesn't

 

bool closeLoss = rsi.Result.LastValue < RsiCloseLoss && rsi.Result.Last(1) < RsiCloseLoss; 
bool closeProfit = rsi.Result.LastValue > RsiCloseProfit && rsi.Result.Last(1) > RsiCloseProfit;

if (closeLoss || closeProfit){
   CloseAllPositions(); //Just normal Close all positions
}   

 


@dkt0591
Replies

PanagiotisCharalampous
05 Nov 2024, 12:02

Hi there,

It seems you are using the current RSI value in your checks, something that can cause false signals since the value can change by the time the candle is finalized. Try this instead

bool closeLoss = rsi.Result.Last(1)< RsiCloseLoss && rsi.Result.Last(2) < RsiCloseLoss; 
bool closeProfit = rsi.Result.Last(1) > RsiCloseProfit && rsi.Result.Last(2) > RsiCloseProfit;

if (closeLoss || closeProfit){
   CloseAllPositions(); //Just normal Close all positions
}   

@PanagiotisCharalampous

dkt0591
12 Nov 2024, 09:02 ( Updated at: 12 Nov 2024, 11:13 )

RE: Ctrader Algo sometimes missed signal!

PanagiotisCharalampous said: 

Hi there,

It seems you are using the current RSI value in your checks, something that can cause false signals since the value can change by the time the candle is finalized. Try this instead

bool closeLoss = rsi.Result.Last(1)< RsiCloseLoss && rsi.Result.Last(2) < RsiCloseLoss; bool closeProfit = rsi.Result.Last(1) > RsiCloseProfit && rsi.Result.Last(2) > RsiCloseProfit;if (closeLoss || closeProfit){   CloseAllPositions(); //Just normal Close all positions}   

Thank you


@dkt0591