Ignore sunday bar

Forums ProRealTime English forum ProOrder support Ignore sunday bar

Viewing 15 posts - 1 through 15 (of 23 total)
  • #42833

    Hi,

    On a daily timeframe I would like to start a trade in the direction of the previous day. So if close>open on the previous day then I want to start a long trade. If close<open on the previous day then I want to start a short trade. I think I know how to do this, but now I want to exclude the sunday bar. So, on Monday I want to check the friday bar for the direction.

    Can you guys help me out here? Thanks again!

    Gr. Pieter

    #42854

    I tried to arrange this code on EurUsd DAILY, but, while it seems running nicely on Monday (short positions) , the same is not true for Friday (long positions) because it opens a trade on Sunday morning while it should open it on Friday!

    As far as I know each strategy is executed at each new bar open, so the DayOfWeek for Friday should be 5, while referencing close (or close[0]) should return Thursday’s closing price (the bar just closed):

    I am eager to know why!

    #42866

    Thanks Roberto, maybe somebody can help us out?

    #42868

    I do hope so, Nicolas (admin) could be of help, but he’s on a temp leave now and he reads posts and threads occasionally.

    #42913

    Thanks Roberto, you are precious member, you desserve your black badge for precious helping member!

    I think the code should set as follow:

    If you want to test the Thursday bar Close, test it when it is Thursday, because the code is read at Close, you’ll get the right values at that time. So logically, the order will be opened at the beginning of the next bar, on Friday morning. Hope I have understood correctly your question.

     

    #42955

    Sorry Nicolas, but the first part (LONG trades) seems not to work properly, as from the two pics attached.

    You cn see:

    • a SHORT trade is correctly opened on Monday, but GRAPH display the value 2 as DayOfWeek instead of 1
    • a LONG trade is incorrectly opened on Thursday and GRAPH displays the value 5 as DayOfWeek, while it should be 4

    Where’s the bug?

     

    #42968

    So, what does it graph using your initial code?

    #43157

    Hi Derek, sorry for my late answer, but I was on leave.

    My initial code displayed Monday as DoW (DayOfWeek) 2, see pic 1. It also started trades on Sunday for which it displayed DoW 1.

     

     

    #43174

    Hope you had nice holidays, Roberto.

    Ok, Sunday =1, Monday = 2 etc… at least that’s what I see.

    Go long on day 6 and short on day 2.

    #43176

    No Derek, it is documented that days are 1 (monday) thru 5 (friday), as you can see:

    https://www.prorealcode.com/reply/7246/

    https://www.prorealcode.com/reply/42819/

    https://www.prorealcode.com/topic/dayofweek-trading-from-tuesday-to-friday/

    That’s why I do not understand that behaviour!

     

    #43179

    Did you try it?

    The company I work at produces quite a few manuals with errors.

    #43180

    Scratch my last comment.

    It’s the IF statement with the AND in a single line.

    All your sample links are like

    Your code includes another condition so that the if statement can only be true one bar later.

    #43181

    How would you write “BUY on Tuesday if the daily bar on Monday is bullish”?

     

    #43216

    How about

     

    #43221

    I know Derek, but as you can see from the picture, GRAPH reports DayOfWeek 2 when my cursor is on the MONDAY bar (it was on Aug. 7th, 2017)!

Viewing 15 posts - 1 through 15 (of 23 total)

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