Flat over weekend code

Forums ProRealTime English forum ProOrder support Flat over weekend code

Viewing 5 posts - 1 through 5 (of 5 total)
  • #141758

    Hi guy’s,

    Recently I added some code which notifys my system to close all trades prior to 22:00 on a Friday.. which in turn means I do not hold over the weekend, ramp up overnight fees x 3 and also put my strategy at risk to any weekend gaps.

    I tested the strategy before.. and after to see if there is any difference and the results are exactly the same, which to me means that it hasn’t functioned as intended, as I find it hard to believe that my strategy over 4 years (100,000 units) did not have one single open trade over the weekend.

    No error was generated when initiating the backtest.. so unsure what the issue is here. Could one of you kindly see if what I have written / copied from other post is correct?

    Kind regards.

     

    #141761

    You need to use  a TF that is <= 5 minutes.

    If you use, say, a 10-minute TF, OpenMinute will never be >= 55 because it will be 50 then 00, both of them are < 55.

     

    #141784

    Don’t forget that you will also need a code that prevents your strategy to take position after 21:55 on fridays.

    #141882

    You need to use a TF that is <= 5 minutes.

    If you use, say, a 10-minute TF, OpenMinute will never be >= 55 because it will be 50 then 00, both of them are < 55.

    Okay makes sense.. thanks.

    I run the 1 hour time frame so the reason I did this rather was because I presumed that this wouldn’t signal the strategy to trigger close until a second or two after 22:00 therefore would be a executed just after after market close. This inevitably would be too late and would void the idea of implementing the strategy. If the strategy signal performs as I expected then I may need to close it at 21:00 which would be the preceding hour.

    Don’t forget that you will also need a code that prevents your strategy to take position after 21:55 on fridays.

     

    Thanks for this.. I normally limit my automated strategy from opening trades after 21:30ish, is that what you were implying? Or is there a further piece of code required?

    Kind regards

    #141883

    Exactly, a part from the code in your first post that only manages the closing you also need a piece of code that determines during which time the strategy may or may not open a new position.

    I also used to have the idea that I didn’t want any trades to open during the late high-spread-hours on DJI but realised it’s worth it to let the strategies run as free as possible and only close before the weekends (don’t forget the bank holidays).

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

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