Bug or what?

Created at 15 Jan 2019, 17:47
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!
CK

ckgmail

Joined 24.03.2016

Bug or what?
15 Jan 2019, 17:47


I want to clear all position and pending when I have some profit. My code is...

        protected override void OnTick()
        {
           

                if (Account.Equity > (initialBalance + ProfitToClear))
                {
                    Task.Factory.StartNew(() => ProcessClearing()).Wait();

                }

        }

I start trade at balance 1043 and equity that I want to clear everrything is 1093+.

 At that time my balance is 1098.58   but...internet is lost!  so cTrader automatic to connect again while it is connecting it see equtity = balance!!!  and do function onTick and check equtiy>balance+profit -->so it call function ProcessClearing()!!!

 

the result of this...I'm loss. The real equity is 1038.1!!

Bug or I have a way to solve this problem?

Now I try to check profit and clear in onTimer. the result is same!

I think cTrader should stop every event when internet is lost!!! and do all events again after internet is come success.

 


@ckgmail
Replies

firemyst
02 May 2019, 05:56

Have you tried writing a routine yourself that checks for internet connectivity every few seconds and stopping the events (or your bot) yourself if connectivity is lost?


@firemyst

PanagiotisCharalampous
06 May 2019, 11:59

Hi ckgmail,

We do not have enough information to advise you on this issue. Can you please post the full source code?

Best Regards,

Panagiotis


@PanagiotisCharalampous