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
Number of Trades per day
- furytrader
- Posts: 354
- Joined: 30 Jul 2010
- Location: Chicago, IL
- Has thanked: 155 times
- Been thanked: 217 times
Re: Number of Trades per day
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.
There is also the "EntriesToday" keyword, but that may not capture trades that have been completed.
- Roman MultiCharts
- Posts: 50
- Joined: 28 Nov 2011
- Has thanked: 21 times
- Been thanked: 67 times
Re: Number of Trades per day
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.
Re: Number of Trades per day
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
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;
- Roman MultiCharts
- Posts: 50
- Joined: 28 Nov 2011
- Has thanked: 21 times
- Been thanked: 67 times
Re: Number of Trades per day
Hello Steve,
You may use the following script.
In this script, Initial Capital info will be taken from the Strategy Properties.
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;
Re: Number of Trades per day
Thanks Roman,
It didnt change !!! its still reading the capital from the script
Best
Steve
It didnt change !!! its still reading the capital from the script
Best
Steve