How I Can make Sleep My cBot for 5 minutes

Created at 27 Jun 2018, 19:50
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!
mparama's avatar

mparama

Joined 11.10.2016

How I Can make Sleep My cBot for 5 minutes
27 Jun 2018, 19:50


Hi,

I need my CBot to SLEEP for 5 minutes after the Trailed StopLoss is hitten !!!

How can I do it ?

Any help would be really appreciated..

thanks !


@mparama
Replies

PanagiotisCharalampous
28 Jun 2018, 09:41

Hi mparama,

You can use Thread.Sleep() method.

Best Regards,

Panagiotis 


@PanagiotisCharalampous

mparama
28 Jun 2018, 17:26

Dear Panagiotis,

thank you very much...it works !!!

Before it goes SLEEP I wrote the code to insert a text on the chart but it doesnt appear when it goes SLEEP.

//================================================

private void FreezeTime()
        {
            ChartObjects.RemoveAllObjects();
            ChartObjects.DrawText("DelayS", "\n\n\n\n\n\n\n\n\n\nFreeze" + " Delay:  " + timeFrameSell, StaticPosition.TopCenter, Colors.Red);
               if (freeze == 1)
                {
                    //------ 1000 = 1 secondo -----------------60.000  1 minuto----------------
                    System.Threading.Thread.Sleep(delayMinB * 60000);
                    ChartObjects.RemoveObject("DelayS");
                    freeze = 0;
                    CountS = 0;
                    OnStart();
                }
         }

//================================================

Any idea on how to solve it...?

Thank again !


@mparama