Page 1 of 1

Number of Trades per day

Posted: 12 Apr 2012
by WHO
Does anyone have a script that limits the number of trades per trading day .Meaning ,being able to set it to one trade per day , then at a later date ,two etc.

Steve

Re: Number of Trades per day

Posted: 13 Apr 2012
by furytrader
I don't have a pre-built script but, assuming you're using intraday day data, you would retrieve the total # of trades (PowerLanguage keyword 'TotalTrades') that have been completed up to the start of that day (so, for example, in the e-Mini S&P 500, you'd check at 8:30 am CST) and then, with each bar, compare that # with the current number of total trades (again, by calling the TotalTrades keyword). If the difference is greater than your limit, you don't allow additional trades for that day.

There is also the "EntriesToday" keyword, but that may not capture trades that have been completed.

Re: Number of Trades per day

Posted: 13 Apr 2012
by Roman MultiCharts
Does anyone have a script that limits the number of trades per trading day .Meaning ,being able to set it to one trade per day , then at a later date ,two etc.

Steve
Steve, you may try to use this script in order to limit the number of trades per day:

Code: Select all

inputs:
Trades_Per_Day(5);

variables:
EntryCount(0),
Trading_On(true);

If EntriesToday(date)>= Trades_Per_Day then Trading_On = False;

If Trading_On = true then begin

//script of your signal

end;
Trading_On = true;
I don't have a pre-built script but, assuming you're using intraday day data, you would retrieve the total # of trades (PowerLanguage keyword 'TotalTrades') that have been completed up to the start of that day (so, for example, in the e-Mini S&P 500, you'd check at 8:30 am CST) and then, with each bar, compare that # with the current number of total trades (again, by calling the TotalTrades keyword). If the difference is greater than your limit, you don't allow additional trades for that day.

There is also the "EntriesToday" keyword, but that may not capture trades that have been completed.
furytrader, "EntriesToday" keyword captures all the complete trades of the day. Moreover, it is the fastest solution. Thank you for your suggestion.

Re: Number of Trades per day

Posted: 14 Apr 2012
by WHO
Thank you Roman and Fury

Roman, your script worked exactly as to how i posed the question.What may be easier is if you could look over this script and delete the inital capital ie taking the dollar amount out of the script and then using MC properties for Init capital and dollars per trade for calculations ? You will have to excuse my total ignorance on this subject as i have no idea of how to program.

Steve

Code: Select all

inputs:Price(C),
FastLength(12),
SlowLength(26),
InitCapital(5000) ,
CapitalDivisor_HCL(c);

variables: var0( 0 ), var1( 0 ), var2( 0 ) ;

Value1 = (InitCapital + netprofit)/CapitalDivisor_HCL;

var0 = XAverage( Price , FastLength );
var1 = XAverage( Price ,SlowLength );

condition1 = CurrentBar > 2 and var0 crosses above var1 ;

if condition1 then
Begin
Buy ("MA")value1 shares this Bar ;
End;

If var0 crosses under var1 then
Sell ("MAX") this Bar at Close;

Re: Number of Trades per day

Posted: 16 Apr 2012
by Roman MultiCharts
Hello Steve,

You may use the following script.

Code: Select all

inputs:Price(C),
FastLength(12),
SlowLength(26),
CapitalDivisor_HCL(c);

variables: var0( 0 ), var1( 0 ), var2( 0 ) ;

Value1 = (InitialCapital + netprofit)/CapitalDivisor_HCL;

var0 = XAverage( Price , FastLength );
var1 = XAverage( Price ,SlowLength );

condition1 = CurrentBar > 2 and var0 crosses above var1 ;

if condition1 then
Begin
Buy ("MA")value1 shares this Bar ;
End;

If var0 crosses under var1 then
Sell ("MAX") this Bar at Close;
In this script, Initial Capital info will be taken from the Strategy Properties.

Re: Number of Trades per day

Posted: 17 Apr 2012
by WHO
Thanks Roman,

It didnt change !!! its still reading the capital from the script

Best

Steve

Re: Number of Trades per day

Posted: 20 Apr 2012
by WHO
Disregard my last post Roman.

It works just fine

Thank you much

Steve