Do not take a trade for x bars after trade closed

Forums ProRealTime English forum ProOrder support Do not take a trade for x bars after trade closed

Viewing 6 posts - 1 through 6 (of 6 total)
  • #97518

    Hi.

    I am unfamiliar with coding and am still trying to learn PRT, and I have a problem with an algo that I am working on. My problem as follows:

    When taking buy/sell orders, the algo will e.g take the buy order, and at a point sell at market when the sell criteria have been met. (and vice versa for sell orders)

    The problem that arises is when the candles go into a small range, the algo continues to buy/sell contracts.

    Is there a way of coding to prevent this from happening? e.g. Do not take a long for x bars after the long contract has been sold and the opposite for short orders?

    Any help is appreciated

     

    Regards

    #97525

    You need to count bars elapsed after a trade ended:

     

     

    #97531

    Thank you for the displayed code Robert, I have incorporated it into my algo. However it has a problem with the “TradeOn” instruction which in the error message states SYNTAX ERROR: THIS VARIABLE IS NOT USED IN THE CODE:TRADEON

     

    Regards

    #97536

    Use it like I did in line 15.

    #97551

    Thanks Robert, It works great

     

    Regards

    #97556

     

    richarjo – Please use topic titles that actually mean something to help others know what your topic is about. I have changed your topic title from ‘Code’ to something more meaningful. 🙂

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

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