Number of Trades per day
Posted: 12 Apr 2012
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
MultiCharts
https://www.multicharts.com/discussion/
https://www.multicharts.com/discussion/viewtopic.php?f=5&t=12064
Steve, you may try to use this script in order to limit the number of trades per day: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
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;
furytrader, "EntriesToday" keyword captures all the complete trades of the day. Moreover, it is the fastest solution. Thank you for your suggestion.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.
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;
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;