Limit Strategy to 1 trade per day
Forums › ProRealTime English forum › ProOrder support › Limit Strategy to 1 trade per day
- This topic has 2 replies, 3 voices, and was last updated 2 years ago by Philstrading.
-
-
01/20/2022 at 7:47 PM #186124Mean reversion based on @Doctrading End of Day Yen Strat1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950//-------------------------------------------------------------------------// END OF DAY - YEN// www.doctrading.frDefparam cumulateorders = false// TAILLE DES POSITIONSn = 2daysForbiddenEntry = OpenDayOfWeek = 5 or opendayofweek = 5 or OpenDayOfWeek = 4 or opendayofweek = 4 or OpenDayOfWeek = 3 or opendayofweek = 3 or OpenDayOfWeek = 2 or opendayofweek = 2 or OpenDayOfWeek = 1 or opendayofweek = 1ratio = 0.6// HORAIRESstartTime = 210000endTime = 231500exitLongTime = 03000exitShortTime = 03000// STOP LOSS & TAKE PROFIT (%)SL = 0.7TP = 1.2Period = 8// BOUGIE REFERENCE à StartTimeif time = startTime THENamplitude = highest[Period](high) - lowest[Period](low)ouverture = closeendif// LONGS & SHORTS : every day except Fridays// entre StartTime et EndTimeif time >= startTime and time <= endTime and not daysForbiddenEntry thenbuy n shares at ouverture - amplitude*ratio limitsellshort n shares at ouverture + amplitude*ratio limitendif// Stop Loss & Take Profitset stop %loss SLset target %profit TP// Exit Timeif time = exitLongTime thensell at marketendifif time = exitShortTime thenexitshort at marketendif
I have been playing around with @Doctrading ‘s end of day Yen M15 strategy (code above is for Sunday only trades), which I find works quite well when initial positions are opened and then hit take profit levels. Performance then tails off a little when new positions are opened and run through to 0030 when all positions are closed. When the strategy goes live each day, it sets limit orders higher (sell) than the opening level and lower (buy). Is there a way to effectively add an OCO rule so that once a buy order is opened (for example), the corresponding sell order is cancelled….so, if a 1.09 USD/JPY buy order is filled, the corresponding 1.10 sell order would be cancelled?
Thanks in advance.
02/15/2022 at 6:01 PM #188312This will limit your strategy to One Trade per Day (using the variable OTD):
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051//-------------------------------------------------------------------------// END OF DAY - YEN// www.doctrading.frDefparam cumulateorders = false// TAILLE DES POSITIONSn = 2daysForbiddenEntry = OpenDayOfWeek = 5 or opendayofweek = 5 or OpenDayOfWeek = 4 or opendayofweek = 4 or OpenDayOfWeek = 3 or opendayofweek = 3 or OpenDayOfWeek = 2 or opendayofweek = 2 or OpenDayOfWeek = 1 or opendayofweek = 1OTD = (Barindex - TradeIndex(1) > IntradayBarIndex)ratio = 0.6// HORAIRESstartTime = 210000endTime = 231500exitLongTime = 03000exitShortTime = 03000// STOP LOSS & TAKE PROFIT (%)SL = 0.7TP = 1.2Period = 8// BOUGIE REFERENCE à StartTimeif time = startTime THENamplitude = highest[Period](high) - lowest[Period](low)ouverture = closeendif// LONGS & SHORTS : every day except Fridays// entre StartTime et EndTimeif time >= startTime and time <= endTime and not daysForbiddenEntry and OTD thenbuy n shares at ouverture - amplitude*ratio limitsellshort n shares at ouverture + amplitude*ratio limitendif// Stop Loss & Take Profitset stop %loss SLset target %profit TP// Exit Timeif time = exitLongTime thensell at marketendifif time = exitShortTime thenexitshort at marketendif1 user thanked author for this post.
02/20/2022 at 10:07 PM #188581I like to simplify so think this would work but not tested it.. Logic seems OK though… I used similar for only trading once between certain times of day which worked very well…
This simply resets at start of the day after each day:
Using Dayofweek12345678910111213141516171819Once StartT=000000once EndT=000001td1 = 1 AND OpenDayOfWeek = 1 AND OpenTime >= startT AND OpenTime <= endT //Mondaytd2 = 1 AND OpenDayOfWeek = 2 AND OpenTime >= startT AND OpenTime <= endT //Tuesdaytd3 = 1 AND OpenDayOfWeek = 3 AND OpenTime >= startT AND OpenTime <= endT //Wednesdaytd4 = 1 AND OpenDayOfWeek = 4 AND OpenTime >= startT AND OpenTime <= endT //Thursdaytd5 = 1 AND OpenDayOfWeek = 5 AND OpenTime >= startT AND OpenTime <= EndT //Fridaytdcond= td1 or td2 or td3 or td4 or td5If tdcond thenmyday=dayofweekendifIf not onmarket and myday=dayofweek and (Your criteria)thenbuy myamount perpoint at marketmyday=dayofweek+1endifIf not onmarket and myday=dayofweek and (Your criteria) thensellshort myamount perpoint at marketmyday=dayofweek+1endifObviously putting in your own buy codes and criteria etc… I’ve not played around with the end time but hopefully it would work..
Hope it helps..
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on