Help with code to find previous high/low

Forums ProRealTime English forum ProOrder support Help with code to find previous high/low

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

    Hi,

    Forgive me, I’m sure there must be an easy solution but I can’t seem to find it anywhere.

    I am keen to open positions or, if already open, close positions if the price closes under/over a previous high/low.

    I have bene using:

     

     But that doesn’t generate any trades.
    I would be hugely grrateful if someone could tell me where I’m going wrong.
    Thanks in advance.
    Nick
    #40319

    Try changing “SHARES” to “CONTRACTS” depending on what you are trading.

    The main problem is probably that you save the new values first, including the closing candle. That means that you don’t get any trades since the close is never lower than TLow or higher than the THigh, since they are included. I asssume this is the problem at least, but I can’t figure out how to fix it right now. Should be fairly easy though.

    Cheers

    #40332

    For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<

    If Close is superior to the highest high, Close IS THE HIGHEST HIGH! So it can’t be superior to itself obviously

    So you must compare if Close is superior to the PREVIOUS highest high instead:

     

    1 user thanked author for this post.
    #40510

    Nicholas, as ever, thank you.  kicking myself now!  And your point about pasting code is noted.

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