How to code trade only trade hours if trading hours cross midnight ?

Forums ProRealTime English forum ProOrder support How to code trade only trade hours if trading hours cross midnight ?

Viewing 4 posts - 1 through 4 (of 4 total)
  • #179059

    How to make the strategy trade throughout trade hours if the hours cross to the next day –  when the exchanges trade hours cross over midnight ?

    For example the DAX: Opens = 1800 AEDT,  Closes =0930 AEDT (the following day).

    How as such to code FLATBEFORE 1800, and FLATAFTER 09:30 (the next day) ?  Without having issue of having to do 2 different strategies and the lose of money from the spread by having to  sell/close at 235959 and then buy/open at 000001.

    Or is there any  way that strategies could be coded to avoid different times too, eg. for the USDJPY to be closed at end of USA trade (0630) until start of Japan trade (1130) to avoid whiplashes)

    Thanks in advance 🙂

    #179091

    This will do:

    TradeON will be true whenever the candle is within the chosen time range.

    1 user thanked author for this post.
    #179106

    Roberto, what do you intend with this ? It looks like you were in a hurry somewhat. 🙂

    Or is there any  way that strategies could be coded to avoid different times too, eg. for the USDJPY to be closed at end of USA trade (0630) until start of Japan trade (1130) to avoid whiplashes)

    Assumed I understood correctly : I think I would dive into over-creativity and code something like

    IOW, welcome to my monster.

    This would work as long as I regularly revisit the code and actualise the bands to recognise the pairs. Obviously there should not be any overlap between the pairs.

    Please notice that in the end this will not be workable really, because of too many specifics for the pair. Thus, you won’t be able to capture all in the same strategy code. But this is up to you of course.

    Good luck !
    Peter

    1 user thanked author for this post.
    #179108

    My fault, lines 4-5-6 have no relation with the time question.

    I still had it in my mind from what I had written a few minutes before!

    They correct code is:

     

    1 user thanked author for this post.
Viewing 4 posts - 1 through 4 (of 4 total)

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