EXIT ON WEEKEND

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

    I am trying to add the code necessary to exit all my trades at the end of Friday. I thought it would be easy but I can´t make it work. This is what I tried…

    I´ve been trying to find it in the forum but no way

    Some help please.
    Thanks in advance

    #27992

    You almost had it right.

    The currenttimeof… constants  cause PRT to act one bar later. Using opentimeof… fixes this.

    3 users thanked author for this post.
    #48195

    How do I implement this into my code?

    Where do I put sig=1 and sig=0?

     

    Thanks

    #48196

    You can implement it like this:

     

    1 user thanked author for this post.
    #174415

    Thanks this is very helpful. Being in Australia the IG markets are closed on our weekends eg from say Sat at 6am our time. I can certainly use the above to exit before close and ill make sure im set in my own time zone.

     

    What about a way of not entering trades unless a market is open?

     

    I could set something like the above to only enter IF market meets time positions – is that the best way? Or is it even necessary? I wonder what my algos do when the market is closed here? Are they still watching the data and not being able to trade? any ideas?

    #174419

    It’s impossible to trade when the market is closed, so there’s no way to do what is already being done.

     

    #174426

    Yes except if like the algo to not be “trying” when the market is closed. Maybe start 5 mins after the market here opens. If that makes sense. In case there are rapid changes.

    #174427

    Can you post an example?

     

    #174437

    I’ll find one. But I guess I’m asking can I simply find a way to not trade between certain hours?

    #174439

    That makes sense, there you go:

    1 user thanked author for this post.
    #174481

    thank you for this topic. can you bring the piece of code that says “if the trade is positive” (we only come out if the trade is winning) + resuming the strategy on Monday according to open defined by everyone of course.

    #174485

    Well, I remember having read a similar question months ago, but I can’t find it.

    It can easily be done, but you will have to pay spread as any new trade.

    To recap, you want to close a profitable trade on Friday night at 22:00 (or any time of your choice), then it must be reopened on Monday (on the first Monday bar or at a time?) no matter conditions as if it were the same trade that had been closed?

     

     

    #174487

    Hi Roberto, thank U

    It can easily be done, but you will have to pay spread as any new trade. yes sure

    To recap, you want to close a profitable trade on Friday night at 22:00 (or any time of your choice), yes exact. no more trading after this close of course.

    then it must be reopened on Monday (on the first Monday bar or at a time?) reopening on Monday according to the general conditions listed in the strategy

    no matter conditions as if it were the same trade that had been closed? no forget the past, only trading according to the general conditions listed in the strategy

     

    hope is clear, thanks again.

    #174489

    So, it’s just a matter of closing a profitable trade on Friday Night. There you go:

     

    1 user thanked author for this post.
    #174491

    The above snippet will close any open trade, but it won’t prevent orther trades from being opened beyond that date. You need to use another snippet, like this one:

    this will prevent your strategy from entering new trades after 21:00 on Friday night.

     

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

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