Replies

hao.han
06 Sep 2021, 22:58

RE: RE:

firemyst said:

hao.han said:

Hi, I was someone could help me with some suggestions on how to solve this problem:

High level issue: I have a portfolio of trading cBots running (so 2 or more). How can I halt all trading if account equity falls below X, akin to an "account/portfolio stop loss", until instructed otherwise.

Elaboration: I do not necessarily care exactly how the effect of the stop loss achieved. For example, there may be a variable in a cBot that acts like a switch to say if trades can/cannot be executed. Or something that automatically switches off all cBots (after first closing all positions). But most importantly, simply "closing all positions" is not sufficient as I want to prevent all cBots from opening further trades until instructed otherwise (which can be either manual or by code - such as "wait Y hours, then allow trades again").

I read briefly in another forum about potentially using "named pipes", but my programming skills are not amazing, and this seems like quite a difficult way to achieve the desired effect.

Any thoughts/suggestions would be greatly appreciated (an example would be amazing also).

Thank you

IN each bot, in the OnTick method, just check the equity of your account:

 

//Get your position if any
Position p = Positions.Find(someLabel, Symbol.Name);

//Checks the equity of the account
if (Account.Equity <= someValue)
{
    //If we have a position open, close it
    if (p != null)
        p.Close();

    Stop(); //Stop this bot instance
}
else
{
    //keep going and do whatever
}

 

 

Hi firemyst,

Thanks a lot for your reply. I had thought of this idea and my only concern was the synchronicity because different symbols will be experiencing ticks at different times. At extreme times, a FX symbol may have no ticks for many seconds or even minute+. During such periods, an "on tick" event would not be triggered - thus leading to some cbots closing and some not. But having thought about it a bit more, perhaps this is not such a huge problem if some cbots are shut down slightly behind others. thanks again!

 


@hao.han

hao.han
24 Jul 2021, 03:52 ( Updated at: 21 Dec 2023, 09:22 )

RE:

PanagiotisCharalampous said:

Hi hao.han,

The issues do not seem related to cTrader. They look more related to your graphics card drivers.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

Hello Panagiotis,

 

Thanks for your reply, but I don't think that it's the graphics card. This is because its not only a graphical issue. If you look at the screenshot below of "Profitability", all the numbers are wrong. I have no idea where they come from but they are entirely incorrect. So this isn't simply a graphics card issue - it is wrong in its content.

So combined with my previous post, we can see that the display is wrong both in graphics, but also in content. The latter simply cannot be down to my graphics card (which is more than enough to handle cTrader anyway and also kept updated).

 

 

Is there some way we can try to debug this?

 

Thank you

 

Hao


@hao.han

hao.han
27 Sep 2020, 15:00

Thank you, I will make sure to check out that post!


@hao.han

hao.han
27 Sep 2020, 04:49

Thank you for the reply TRMR, greatly appreciated!

The aim of all this is to construct "information-Driven Bars" as discussed by Prado in his book Advances in Financial Machine Learning, where tracking tick moves is very important.

By any chance, have you looked into this in your research give you mention you have done extensive research into tick based analysis? Any tips/help if so? (not looking for the holy grail recipe or anything!)


@hao.han

hao.han
26 Sep 2020, 21:17

Can someone please at least acknowledge they are looking at this? Not needing immediate fixes, but a response would be appreciated


@hao.han

hao.han
20 Sep 2020, 20:08 ( Updated at: 21 Dec 2023, 09:22 )

I attached a further example here, as my previous one might have been ambiguous in price alignment.

 

EURNZD (broker, IC Markets, Live account)

Single "Tick 10" bar:

 

This was reconciled to 12 "Tick 1" bars:

I believe this is because there were two instances where the price did not change - leaving 10 ticks where price changed to form the "Tick 10" bar.


@hao.han