Problems with OpenDayOfWeek

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #66205 quote
    Alberto Lucchese
    Participant
    Average

    Hello,

    I’m not sure, but sometimes i have problems when trying to the day of the Week. I use OpenDayOfWeek but the output is always “7”. The demo code I’m using is below. Any ideas on why is this function failing to provide the day of the week as expecte?

    PercentageChange=1
    Performance=0
    //Condition1=range>(High[1]-low[1])
    BuyCondition=close>(open+(High[1]-low[1])*PercentageChange)
    //DayCondition=OPENDAYOFWEEK
    //Stoploss=(high[1]-low[1])*0.5
    GRAPH DayCondition
    IF NOT LongOnMarket and BuyCondition then //and DayCondition THEN
    BUY AT market
    SET STOP $loss 1500
    ENDIF
    
    // Conditions to exit long positions
    SellCondition=positionperf>Performance
    If LongOnMarket AND SellCondition THEN
    SELL AT MARKET
    ENDIF
    
    #66207 quote
    robertogozzi
    Moderator
    Master

    I changed line 7 like that

    GRAPH OpenDayOfWeek //DayCondition

    and it works finely for TFs up to h1, then Daily (EurUsd, default trading times, no display of weekend data).

    It shows problems with h2, because the last candle opening at 23:00 CET on thursday OpenDayOfWeek returns 4 correctly, while on friday it returns 0! The same problem occurs with h4 TF, on friday at 21:00 CET it returns 4, while on friday it returns 0!

    You should try different settings, and possibly address PRT for a thorough description of the data OpenDayOfWeek should return.

    Alberto Lucchese and Nicolas thanked this post
    #66397 quote
    Alberto Lucchese
    Participant
    Average

    Thanks a lot,

    The problem was simpler than i thought. After reading your comments I checked the time frame and it was set to “Weekly”. Sorry, my (fool) mistake.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Problems with OpenDayOfWeek


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Alberto Lucchese
7 years, 11 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/23/2018
Status: Active
Attachments: No files
Logo Logo
Loading...