how to close at the end of day on a daily candle

Forums ProRealTime English forum ProOrder support how to close at the end of day on a daily candle

Viewing 7 posts - 1 through 7 (of 7 total)
  • #12513

    I would like to figure out how to code entering a trade at the open and exiting at the close on a daily candle.

    here is my attempt at the code which opens and closes simultaneously, rather than the end of day (:

    any suggestions greatly appreciated

     

     

     

    #12519

    Hi Chris,

    What instrument are you referring to, and what time zone are is your platform set to ?

    Your code refers to “currenttime” – should this be just “time” ?

    In any case – This sample code should point you in the right direction, using XJO as it appears your a fellow Aussie 😉

    Use c2 for entries and c3 for exits

     

     

    #12522

    many thanks Grizzly

    I have set the time zone as Sydney GMT+10 (screenshot attached)

    I am looking to test on Australia 200 & AUD/USD on daily candles timeframes, which would include after hours trading to pick up any moves during the europe & US sessions.  I’ll adjust the times to 000100 to enter and 115900 to exit – I’ll do some testing & see how it goes.

    cheers

    Chris

    #12535

    When I applied the code to Sydney GMT+10 there were no entries & when I changed that to GMT+1 the entry conditions seemed to work, though not the exit based on time – see attached screenshot.  Could it be something around when the time condition is met, it is applied to the next bar and leaves the position open??

    Any suggestions?

     

     

    #12540

    When you are changing timezome in the configuration window, you need to save the platform and restart it, otherwise it will not has any effect on the current session.

    About the exit at end of day, maybe you can try to add this line at the beginning of the code and see what happens:

     

    #12544

    Thanks Nicolas – no luck I’m afraid.  I’ll experiment with an intraday timeframe and see how that goes.  cheers Chris

     

    #12548

    You’ll get more chance with an intraday timeframe for sure. Since each condition are only tested once per bar, your condition to close trades are not executed, because this time condition will never be met.

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

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