Hello!
I have been trying to limit my system to only 1 order each day but I haven’t figured out how to do it.
Can someone please help me or point me in the right direction?
Best regards,
Dvid
Clarify this:
Is it , 1 order & 1 execution ? or, 1 trade (buy and sell order executed) ? or even,
1 order & 1 non-execution ?
Sorry.
I mean 1 entry/day, not necessarily exit the same day, that depends on the market.
But, if exit the same day, then the system should not try to enter the market again.
I guess what I am looking for is some sort of counter.
If no entry today, then buy. If 1 entry today already, then no buy. I just don’t know how to put it into code.
What time frame are you coding it for ? Ill reply with the code
Presently I am looking at 15 minutes.
Thank you! That would be great!
Try this as an example :
DEFPARAM CumulateOrders = False
starttime = 090000
closetime = 170000
Rule1 = time > starttime and time < closetime and not onmarket[0]
Rule1b = (barindex-tradeindex>=(4*15)) //4 x 15mins = 24hours
Rule2 = close>ExponentialAverage[200](close)
Rule3 = close<ExponentialAverage[200](close)
if Rule1 and Rule1b and Rule2 then
buy 2 contract at market
endif
if Rule1 and Rule1b and Rule3 then
sellshort 2 contract at market
endif
set stop ptrailing 100
Thank you very much! That works like a charm! 🙂
Well, it worked in backtests, but PRT won’t let me start the system in automatic trading: strategy.request.program.parsing.error.
I don’t know where the fault may be.
Exchanging TIME for CURRENTTIME worked instead:
Rule1 = currenttime > 090000 and currenttime < 170000 and not onmarket[0]
Rule1b = (barindex-tradeindex>=(4*15)) //4 x 15mins = 24hours
if rule1 and rule1b and … then
buy 1 contract at market
endif
hi
could you explain what rule 1b does or how it works? Is it the number of bars since the last trade >= 60?
thanks
Chris
Correction it should be 4lots x 15mins x 24hours :
Rule1b = (barindex-tradeindex>=(4*24)) //4 x 15mins = 1 hour x 24hours = 1 day