Sunday bars

Viewing 9 posts - 1 through 9 (of 9 total)
  • #30183

    Hi all,

    Just finding my feet with this system so have a simple question. Is there anyway to ignore the sunday bar when backtesting? I know I can remove it from the charts however it appears that when i write a rule and backtest it still takes it into account. Thanks for your help.

    #30218

    Do you want the Sunday bar to be ignored by indicators calculation? or just avoid Sunday to not launch any order?

    #30266

    Hi Nicolas,

    My strategy entry is on the previous bars high so i ideally want to be able to backtest without the sunday bar being factored in. Is this possible?? I have worked out how not to trade on the sunday bar. Thanks for the reply.

    #30471

    If you are using the previous day High to decide your entry condition, just add a comparison with the day of the week to know you are not using the Sunday bar:

    Then use myHigh value in your conditional statement instead of High. Hope it is clear.

     

    1 user thanked author for this post.
    #33615

    Hi Nicolas,

    I have a similar requirement to ignore Sunday bars.. Ideally My strategy is affected by the Sunday bars as (1) I count the number of preceding bars for re-entry   (2) I use daily closes.

    Is there a way to backtest without Sunday Bars?

    I used DayOfWeek to overcome the situation, but there’s an error.  Please look at my screenshot.  I “graph DayofWeek”.  Thursdays, Fridays and Sundays all return the value of 5.. Is there a bug?

     

    Thanks!

    CY

     

    #33665

    Are you in a Weekly timeframe?

    Also, a quick tip to get the day of the week when the bar has opened, is to use OpenDayOfWeek instead.

    #33937

    Hi Nicolas,

    Thanks for the info!

    I’m using Daily bars.

    I’ve swapped OpenDayofWeek for DayofWeek.  It works better now, with Monday = 1, Tues = 2.. But both Fridays and Sundays have the value of 5..    My code is:

    IF not LongOnMarket AND Count = 3 and OpenDayofWeek <> 5 THEN
    StopLoss = close – 2 * AverageTrueRange[40](close)
    BUY PositionSize shares at market

    Endif

    That basically also rules out entering the market on Fridays too..

    Any suggestions?

    Thanks!

    CY

    #47865

    same problem for me on the 1H time frame. I have tried opendayofweek, currentdayofweek, dayofweek, all three returned 5 for a Sunday bar. So impossible currently to identify a sunday bar???

    #52658

    Hi,

    I have the same problem. Dayofweek is not 7 for sundays in daily graphs. It must be a bug.

    However I did find a trick to identify if a bar is a sunday. The costant “Hour” is 23 when the script is run on a sunday and 1 (i think) on normal weekdays.

    //Jonas

Viewing 9 posts - 1 through 9 (of 9 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login