Turn on/off strategies automatically based on its performance during the past period of time

Questions about MultiCharts and user contributed studies.
soso0206
Posts: 1
Joined: 11 Jul 2020

Turn on/off strategies automatically based on its performance during the past period of time

Postby soso0206 » 30 Jul 2020

I wonder is there a way to automatically turn on and off a strategy based on its performance in the past period of time (say 3 months)?

I think it is easy to turn OFF a strategy based on its past performance. If the strategy has been active for the past 3 months, I can just check NetProfit (or GrossProfit, etc) and determine whether to buy/sell using power language.

However, I don't know how to turn ON a strategy based on its past performance. Because when a strategy is off, NetProfit won't store the performance it "would have made if it has been on".

Is there a way to achieve that? In other words, I want to keep track of the performance of a strategy it "would have made" even if it is not active, and use that performance to determine whether to turn the disabled strategy back ON.

If there is any other way that can achieve the same goal, that would be great too.

Thank you very much!

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

Re: Turn on/off strategies automatically based on its performance during the past period of time

Postby Vlada MultiCharts » 06 Aug 2020

Hello soso0206,

We have two suggestions for you:

1) You can use CommandLine(".at_toggle") keyword that changes the AT status - in turns it on if it has been disabled and vice versa. In this case the system will require manual confirmation each time before changing the autotrading status.
2) It is also possible to calculate the value

Code: Select all

i_OpenEquity = netprofit + openpositionprofit
on the first chart in backtesting and then transfer this data using global var to the second strategy that will use them to decide whether or not it should generate orders.

Zheka
Posts: 225
Joined: 13 Jan 2016
Has thanked: 8 times
Been thanked: 53 times

Re: Turn on/off strategies automatically based on its performance during the past period of time

Postby Zheka » 09 Aug 2020

I have long ago suggested a feature that would allow 'turning off a trade' (not only not sending order to a broker but also internally) by setting the trade size to a negative value.

Right , in backtesting - set the trade size to the minimum possible/negligible in comparison to a normal trade - so that such trades do not influence the results
For real-time, if you are not trading many symbols frequently, you can probably implement Vlada's 2nd suggestion.


Return to “MultiCharts”