cant get the maxdailystop to work please help
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
maxdailyprofit=20000
maxdailyloss=2
once tradeallowed=1
if intradaybarindex=0 then
myprofit=strategyprofit
tradeallowed=1
endif
if strategyprofit>=myprofit+maxdailyprofit or strategyprofit<=myprofit-maxdailyloss then
TradeAllowed=0
endif
// Prevents the system from creating new orders to enter the market or increase position size before the specified time
noEntryBeforeTime = 153000
timeEnterBefore = time >= noEntryBeforeTime
// Prevents the system from placing new orders to enter the market or increase position size after the specified time
noEntryAfterTime = 220000
timeEnterAfter = time < noEntryAfterTime
// Conditions to enter long positions
indicator1 = RSI[2](close)
indicator2 = RSI[2](close)+15
c1 = (indicator1 >= indicator2[1])
c2 = (indicator1 > 60)
IF tradeallowed=1 and c1 and c2 and timeenterbefore and timeenterafter THEN
BUY 0.2 CONTRACT AT MARKET
ENDIF
// Conditions to enter short positions
indicator3 = RSI[2](close)
indicator4 = RSI[2](close)-15
c3 = (indicator3 <= indicator4[1])
c4 = (indicator3 < 40)
IF tradeallowed=1 and c3 and c4 and timeenterbefore and timeenterafter THEN
SELLSHORT 0.2 CONTRACT AT MARKET
ENDIF
SET STOP TRAILING 6
Makkman – Welcome to the forums. I have moved your post as it was posted in the ProBuilder forum which is for indicator topics. The ProOrder forum is the place for strategy topics. Please try to post in the correct forum with future topics.
Thank you for using the ‘Insert PRT Code’ button when posting code but please try not to include your comments within the code. I have edited your post to separate them from the code.
In what way does it not work?
20000 is quite a large profit to expect in a day before not allowing any more trades to open – what instrument are you testing on?