Daysforbiddenentry support

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #135930 quote
    Philstrading
    Participant
    Senior

    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.

    DEFPARAM CumulateOrders = false
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0//dont trade Saturday and Sunday
    
    IF not onmarket and c1 AND not daysForbiddenEntry and result1 <1 And indicator7>=25 THEN
    BUY myamount PERPOINT AT MARKET
    ENDIF
    #135934 quote
    Vonasi
    Moderator
    Master

    You 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.

    #135935 quote
    robertogozzi
    Moderator
    Master

    This will let you select days and different times each day, overnight or not https://www.prorealcode.com/topic/time-and-day-conditions/.

    #135945 quote
    Philstrading
    Participant
    Senior

    You 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…

    #135946 quote
    Philstrading
    Participant
    Senior

    This 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.. 🙂

    #135948 quote
    GraHal
    Participant
    Master

    but assumed it should work if from the simple programming code.

    Maybe it would if you used CurrentDayOfWeek (not opendayofweek)?

    #135971 quote
    Philstrading
    Participant
    Senior

    I 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..

    #135973 quote
    Philstrading
    Participant
    Senior

    but 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

    donttrademe = currentdayofweek=0 or currentdayofweek=6
    If not onmarket and myconditions and not donttrademe then
    ..
    Endif
    
    or if it still doesnt do maybe try
    trademe = currentdayofweek=1 or currentdayofweek=2 or currentdayofweek=3 or currentdayofweek=4 or currentdayofweek=5
    If not onmarket and myconditions and trademe then
    ..
    Endif
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

Daysforbiddenentry support


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 7 replies,
has 4 voices, and was last updated by Philstrading
5 years, 8 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 06/14/2020
Status: Active
Attachments: No files
Logo Logo
Loading...