Stop loss doesn't trigger

Created at 25 Aug 2022, 03:06
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!
TA

TaoCTID

Joined 22.03.2022

Stop loss doesn't trigger
25 Aug 2022, 03:06


Hi,

The suspected bug occurs on EURUSD, M1 between 5pm and 6pm. Here is a screenshot that summarizes the problem. Does anyone have a hypothesis on the cause?


@TaoCTID
Replies

PanagiotisCharalampous
25 Aug 2022, 09:06

Hi TaoCTID,

Can you share your cBot code so that we can explain what happens?

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous

TaoCTID
25 Aug 2022, 15:03 ( Updated at: 25 Aug 2022, 15:07 )

RE:

Of course, excuse this obvious oversight. I have reduced the code as much as possible in order to reduce the number of factors. Strangely the bug does not seem to occur if the SL is equal to 2 pips or less (I just tested more precisely and the maximum value without bug is 2.2).
 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.None)]
    public class BBBug : Robot
    {
        
        [Parameter("SL", DefaultValue = 2.0, Step = 0.1, MaxValue = 22.0, MinValue = 0.2)]
        public double SL { get; set; }
        
        readonly DateTime TargetTime = new DateTime(2022, 8, 17, 17, 48, 0);
        
        protected override void OnBar()
        {
            if (Bars.LastBar.OpenTime == TargetTime)
            {
                ExecuteMarketOrder(TradeType.Sell, "EURUSD", 1000, "Test", SL, null);
            }

        }
        
    }
}

The version of cTrader used is 4.3.9


@TaoCTID