how to limit # trades per day

Questions about MultiCharts and user contributed studies.
tozwp
Posts: 145
Joined: 15 Apr 2011
Has thanked: 16 times
Been thanked: 8 times

how to limit # trades per day

Postby tozwp » 20 May 2011

Would like my strategy to only trade the first signal of the day and then ignore any others. Not sure how to set a flag or what keyword(s) I should look at for clues. The strategy works fine as is for the first trade of the day but then continues to trade and I'm not sure how to shut it off after it has made a trade. Thanks

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: how to limit # trades per day

Postby TJ » 20 May 2011

Would like my strategy to only trade the first signal of the day and then ignore any others. Not sure how to set a flag or what keyword(s) I should look at for clues. The strategy works fine as is for the first trade of the day but then continues to trade and I'm not sure how to shut it off after it has made a trade. Thanks
You have to set up a counter.

Code: Select all

// this line resets the counter to zero at the beginning of each day

if date > date[1] then
counter = 0;
this counter limits the operation:

Code: Select all

if counter = 0 then
begin
if trading_condition = true then
begin
{----- put your order logic here -----}
counter = 1;
end;
end;

HTH

tozwp
Posts: 145
Joined: 15 Apr 2011
Has thanked: 16 times
Been thanked: 8 times

Re: how to limit # trades per day

Postby tozwp » 20 May 2011

Thanks, sometimes the answer is so simple I can't see it!

sptrader
Posts: 742
Joined: 09 Apr 2010
Location: Texas
Has thanked: 483 times
Been thanked: 274 times
Contact:

Re: how to limit # trades per day

Postby sptrader » 20 May 2011

Even easier is the "TradesToday" function.

if TradesToday < 1 then begin

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: how to limit # trades per day

Postby TJ » 20 May 2011

Even easier is the "TradesToday" function.

if TradesToday < 1 then begin
TradesToday is not a standard function and is not included in MultiCharts.

You can get the code here:
http://www.tradersxchange.com/viewtopic.php?f=31&t=601

sptrader
Posts: 742
Joined: 09 Apr 2010
Location: Texas
Has thanked: 483 times
Been thanked: 274 times
Contact:

Re: how to limit # trades per day

Postby sptrader » 20 May 2011

Even easier is the "TradesToday" function.

if TradesToday < 1 then begin
TradesToday is not a standard function and is not included in MultiCharts.

You can get the code here:
http://www.tradersxchange.com/viewtopic.php?f=31&t=601
* I must have gotten it from TS or Tradersexchange. Sorry, I didn't know that it wasn't included in MC. It's a very handy function.


Return to “MultiCharts”