CLI questions

Created at 13 Jul 2023, 18:22
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!
EY

eynt

Joined 08.05.2020

CLI questions
13 Jul 2023, 18:22


Running cBot via CLI is a great feature, I have several questions:

 

1. Is there a way to stop the cBot via CLI or via external code code. Just like I use CLI instead of pressing the Play button I want a way to simulate the Stop button without have to close the CLI window manually.

2.Can I run a cBot in backtesting mode via CLI?

 

Thanks


@eynt
Replies

PanagiotisChar
14 Jul 2023, 09:37

Hi eynt,

1. You can kill the process

2. No such feature is documented at the moment.

Aieden Technologies

Need help? Join us on Telegram

 


@PanagiotisChar

eynt
14 Jul 2023, 15:14

RE:

Thank you

 

Upon closing the CLI window manually or killing the process via code, the OnStop method is not called. How can I call it when I run a cBot via CLI?


@eynt

PanagiotisChar
14 Jul 2023, 16:47

Hi eynt,

OnStop() is only called when the cBot closes itself. If you need to invoke this from an external source then you would need to implement some kind of communication with the cBot e.g. using files or named pipes.

Aieden Technologies

Need help? Join us on Telegram


@PanagiotisChar

eynt
14 Jul 2023, 16:59

RE:

Can you please give a short example of how to communicate with the cBot via named pipes?

 

Thank you

 


@eynt

PanagiotisChar
14 Jul 2023, 17:02

Hi eynt,

I don't have one but if you google it you will find a lot of info.

Aieden Technologies

Need help? Join us on Telegram


@PanagiotisChar

eynt
14 Jul 2023, 17:17

RE:

Suppose I'm using a file to communicate with the cBot. I'm guessing you meant the order to stop the cBot will be read at the OnTick method and the cBot will stop itself.

This means the order to stop the cBot has to be sent before tradinig session hours are over otherwise the OnTick method will not be called on time.

Any idea on how to send the order AFTER tradinig session hours?

 

Thank you for your help

 

 


@eynt

ncel01
03 Aug 2023, 10:39

As far as I know, the OnStop() is not only called when the cBot stops by itself but also when pressing the stop button (via cTrader).

Not having this option available via CLI seems to be a huge limitation.

This could be easly achieved through commands if these are made available and, after all, these are the main purpose of a CLI.


@ncel01