Limit number of trade executions.  [SOLVED]

Questions about MultiCharts and user contributed studies.
Stormy
Posts: 58
Joined: 08 Nov 2012
Has thanked: 4 times
Been thanked: 3 times

Limit number of trade executions.

Postby Stormy » 02 Sep 2020

Hello,

I am trying to limit a program to a certain number of executions per session.

I can limit the trade number successfully. So if it opens a trade and closes a trade and goes flat it counts as 1 trade and stops trading at a specified number.

However if a trade opens then reverses and continues to buy and sell without going flat, Multicharts still sees this as 1 trade. and will allow the program to run a huge number of executions. So the trade count works when the system goes flat between trades.

Thank You for your help.

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Limit number of trade executions.

Postby JoshM » 03 Sep 2020

The value that the `TotalTrades` variable returns should increase even if the strategy switches from a long to a short position (or vice versa). Perhaps you can try monitoring that variable?

There's also the `MaxPositionsAgo` variable if you want to know how many positions the strategy traded, if that's useful to you.

Stormy
Posts: 58
Joined: 08 Nov 2012
Has thanked: 4 times
Been thanked: 3 times

Re: Limit number of trade executions.  [SOLVED]

Postby Stormy » 03 Sep 2020

Yes you are right, the TotalTrades value is increasing and I can utilize it now. Thank You for your help.


Return to “MultiCharts”