Daysforbiddenentry support
Forums › ProRealTime English forum › ProOrder support › Daysforbiddenentry support
- This topic has 7 replies, 4 voices, and was last updated 3 years ago by Philstrading.
-
-
06/14/2020 at 9:29 PM #135930
Hi Guys n Gals
Just a quick check on logic here as the code below is opening trades on weekends Sunday evening, which I would rather avoid due to spreads. Should I remove the “and not”? I did send a query on it to PRT via help with no reply yet.
Daysforbidden entries123456DEFPARAM CumulateOrders = falsedaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0//dont trade Saturday and SundayIF not onmarket and c1 AND not daysForbiddenEntry and result1 <1 And indicator7>=25 THENBUY myamount PERPOINT AT MARKETENDIF06/14/2020 at 11:03 PM #135934You don’t say what time frame you are running the strategy on. The code will allow trades to open from midnight at the end of Sunday. If you are on a daily chart then as all decisions are made at the close of a candle then this is what will happen. If you are on a faster time frame and want trades to open only after a specific hour on Monday then you have to tell your strategy that this is what you want.
06/14/2020 at 11:37 PM #135935This will let you select days and different times each day, overnight or not https://www.prorealcode.com/topic/time-and-day-conditions/.
06/15/2020 at 7:59 AM #135945You don’t say what time frame you are running the strategy on. The code will allow trades to open from midnight at the end of Sunday. If you are on a daily chart then as all decisions are made at the close of a candle then this is what will happen. If you are on a faster time frame and want trades to open only after a specific hour on Monday then you have to tell your strategy that this is what you want.
OK thanks. All my strategies run on 7hrs or 4hrs currently, also 9hrs previously. I assumed as it was from the inbuilt program coding that it wouldnt trade on Sat / Sunday. I can see a need ot code it in though, so will take alook at the code Robert refers to and try out…
06/15/2020 at 8:06 AM #135946This will let you select days and different times each day, overnight or not https://www.prorealcode.com/topic/time-and-day-conditions/.
Cheers. Yes I now recall I’ve seen that somewhere in code here on the forum. I can see a need to code it in, but assumed it should work if from the simple programming code. I’ll take a look at that and see how it does. Thanks… It will be a stock paste into all code for weekend.. 🙂
06/15/2020 at 8:10 AM #135948but assumed it should work if from the simple programming code.
Maybe it would if you used CurrentDayOfWeek (not opendayofweek)?
06/15/2020 at 9:06 AM #135971I did think it might be related to timezone, I think it may have been the Dax, but that’s the same timezone as me which is London. I’ll see how the code fairs..
06/15/2020 at 9:17 AM #135973but assumed it should work if from the simple programming code.
Maybe it would if you used CurrentDayOfWeek (not opendayofweek)?
Thanks GraHal
Yes that actually makes sense, though bearing in mind timezone for the instrument. May be worth a try if I just want to blanket Sat/Sunday easily
days of week12345678910donttrademe = currentdayofweek=0 or currentdayofweek=6If not onmarket and myconditions and not donttrademe then..Endifor if it still doesnt do maybe trytrademe = currentdayofweek=1 or currentdayofweek=2 or currentdayofweek=3 or currentdayofweek=4 or currentdayofweek=5If not onmarket and myconditions and trademe then..Endif -
AuthorPosts