Buy/sell code isn’t working

Forums ProRealTime English forum ProOrder support Buy/sell code isn’t working

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

    Hey everyone,

    I have this code:

    Basically what I want to do is if the open is above the BuyLine (signal=1) to buy a hit of that line with stop at the SellLine and vice versa, if the open is below the SellLine (signal=-1) to sell a hit of the SellLine with stop at the BuyLine.

    The problem is that the backtest gives trades at wrong places. Can you help me spot the problem in the code please?

     

    John

     

     

    #222522

    Try below … does it give you what you want?

     

    1 user thanked author for this post.
    #222534

    In line 1 you only check the LOW price, not the OPEN, which could also be below BuyLine.

    Add

    to that line.

    You may want to add a check for OPEN also in line 8.

    1 user thanked author for this post.
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