DOES ANYOEN HAVE THE CODE FOR
max number of open trades??
EG YOU WANT YOUR ALGO TO ONLY have a max number of open trades to be 5 ( so it wont open any more trade in 5 are already open)
or
have a max number of open trades to be 1 ( so it wont open any more trade if 1 is are already open)
Everything’s related to ProBacktest/ProOrder coding can be found in the online documentation: https://www.prorealcode.com/documentation/category/probacktest/
You are looking for COUNTOFLONGSHARES and COUNTOFSHORTSHARES
do you know how to limit the max number of trades placed in one hour ? eg have the algo place no more than 3 trades in any one hour period?
Didn’t say what timeframe you are using, have used 5 minute chart to get 12 bars e.g. 3 minute bars would be 20 bars. Only takes a position if third last trade was over an hour ago.
NumberOfBarsInHour = 12
TradeBar = TRADEINDEX(3)
if TradeBar = 0 or (barindex – TradeBar > NumberOfBarsInHour) then
//if some condition then
//buy or sell
//endif
endif
thanks auto strategist!
I am using a 2 min chart – this is my code
NumberOfBarsInHour = 30
TradeBar = TRADEINDEX(3)
if TradeBar = 0 or (barindex – TradeBar > NumberOfBarsInHour) then
do i need to add anything else to it or will the above code limit my system to trade 3 times per hour max ?