Code for "close trade after 20 candles"

Forums ProRealTime English forum ProOrder support Code for "close trade after 20 candles"

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

    Good Evening All,

    I’m currently working on a coding strategy and I want the automation to close the trade on the 21st candle (after 20 candles).

    Can someone please assist me with codes for closing both long and or short trades after 20 candles. (whichever trade is open at the time long or short, not simultaneous)

    Any assistance would be greatly appreciated.

    Cheers,

    Nick

    #90968

    Welcome to the forums. I have moved your topic to the ProOrder forum as that is the correct place for strategy questions. You posted in the ProBuilder forum which is for indicator questions. Please try to post in the correct forum with any future topics to ensure you are posting in the best place to find your answers. 🙂

    #90969

    The index of the candle that you last entered a trade on is stored as TRADEINDEX and the current candle is BARINDEX. So if BARINDEX minus TRADEINDEX = 20 then 20 candles have passed.

    In ProOrder it is not possible to have a short and a long position open in a strategy simultaneously.

    Try something like this:

     

    2 users thanked author for this post.
    #91566

    Legend… Thank you so much!

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