Not Entering a new short

Forums ProRealTime English forum ProOrder support Not Entering a new short

Viewing 3 posts - 1 through 3 (of 3 total)
  • #186610

    Good evening,

    I have set up my code to enter a long trade every time a 4hour candle closes green. At the end of the next 4h candle the trade should close and a new trade should be entered based on the same rules.

    If the 4h candle closes red it should enter a short.

    Currently all works fine except if a short trade is open, once the candle ends, the trade closes BUT a new trade is not entered. It does perfectly work with a long, just not a short.

    Could anyone please have a look at my code and let me know why this is happening? I would greatly appreciate it!

    Kind regards,

    Anton

     

     

     

    #188318

    Actually you are not trying to detect GREEN (close > open) and RED (close < open) candlesticks, rather those closing higher than the previous one (it could be a RED candle that opened in a gap, then closed still higher than the previous one, or the other way round).

    Anyway, the code seems to work as expected. Keep in mind that it takes a whole bar for the strategy to be aware of a new status (from OnMarket to Not OnMarket and viceversa, just like LongOnMarket and ShortOnMarket with their NOT counterpart).

    This version simply does a Stop & Reverse, thus not waiting for a NOT OnMarket condition. Try if that is what you are looking for:

    1 user thanked author for this post.
    #188329

    Thank you Roberto, you have just answered two big questions for me.  Using (close[1] > open[1]) just solved another issue I had with a different code I’m working on.

    Thanks again, I really appreciate it!

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

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