Turn ON/Off autotrading by code

Questions about MultiCharts and user contributed studies.
Mik72
Posts: 20
Joined: 13 May 2022
Has thanked: 5 times

Turn ON/Off autotrading by code

Postby Mik72 » 30 Jan 2024

Hi everyone,
is it possible turn on/off the auto trading (AA) by the code ?
thanks

User avatar
Vlada MultiCharts
Posts: 293
Joined: 22 Apr 2020
Has thanked: 8 times
Been thanked: 76 times

Re: Turn ON/Off autotrading by code

Postby Vlada MultiCharts » 31 Jan 2024

Hello Mik72,

Yes, it is possible to do it by using the keyword CommandLine(".at_toggle");
Please note that if it is used to turn auto trading on, the popped up confirmation window cannot be skipped and a manual click on "OK" is required.

More info can be found here: https://www.multicharts.com/trading-sof ... ommandLine

Mik72
Posts: 20
Joined: 13 May 2022
Has thanked: 5 times

Re: Turn ON/Off autotrading by code

Postby Mik72 » 31 Jan 2024

Thanks!!!

Tibouss
Posts: 31
Joined: 26 May 2022
Has thanked: 7 times
Been thanked: 1 time

Re: Turn ON/Off autotrading by code

Postby Tibouss » 01 Feb 2024

Hello,

I tried this piece of code to turn off a strategy after a certain time (it is a bit confusing because the command takes more than 20 seconds to execute).

Code: Select all

if currenttime_s >=142040 then begin once begin CommandLine(".at_toggle"); end; end;
I was wondering something, while turing off the strategy the popped up confirmation window with active orders and positions appears.

Can this pop up be skipped by code when turning OFF a strategy?

Many thanks in adavance.

User avatar
Vlada MultiCharts
Posts: 293
Joined: 22 Apr 2020
Has thanked: 8 times
Been thanked: 76 times

Re: Turn ON/Off autotrading by code

Postby Vlada MultiCharts » 01 Feb 2024

Hello,

I tried this piece of code to turn off a strategy after a certain time (it is a bit confusing because the command takes more than 20 seconds to execute).

Code: Select all

if currenttime_s >=142040 then begin once begin CommandLine(".at_toggle"); end; end;
I was wondering something, while turing off the strategy the popped up confirmation window with active orders and positions appears.

Can this pop up be skipped by code when turning OFF a strategy?

Many thanks in adavance.
Hello Tibouss,

I'm afraid, this confirmation window cannot be skipped from code. You can only set it in main MultiCharts window - File - Preferences - Trading - Auto trading options.

An alternative solution for enabling/disabling auto trading from script can be found here:
viewtopic.php?t=52722


Return to “MultiCharts”