how to limit # trades per day

Questions about MultiCharts and user contributed studies.
tozwp
Posts: 133
Joined: 15 Apr 2011
Has thanked: 14 times
Been thanked: 6 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: 6523
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Re: how to limit # trades per day

Postby TJ » 20 May 2011

tozwp wrote: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
These users thanked the author TJ for the post:
Stan Bokov

tozwp
Posts: 133
Joined: 15 Apr 2011
Has thanked: 14 times
Been thanked: 6 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: 622
Joined: 09 Apr 2010
Location: Colorado
Has thanked: 388 times
Been thanked: 229 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
These users thanked the author sptrader for the post:
TJ

User avatar
TJ
Posts: 6523
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Re: how to limit # trades per day

Postby TJ » 20 May 2011

sptrader wrote: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: 622
Joined: 09 Apr 2010
Location: Colorado
Has thanked: 388 times
Been thanked: 229 times
Contact:

Re: how to limit # trades per day

Postby sptrader » 20 May 2011

TJ wrote:
sptrader wrote: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”