Climax Indicator

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

    Hello all

    I am new to programming with pro-real code, so I need your help with the below.

    I try to create an indicator of the buy/sell climax. In theory a buy climax occurs if a stock has a new 52 week high but then closes below previous week’s close. In my first approach to the code I tried to compile only the first part – meaning to check if a stock has a new 52 week high (then I will think the rest). I put the following code.

    My result is that bclimax is always 0, although I would expect to have 1 also in many days that had high. What am I missing here?

     

     

    #39710

    Because you are trying to check a condition that can’t exist. The current High cannot be superior to the Highest high, it is the Highest high 🙂 So you’ll have to check is the current High is above the highest one, 1 bar ago, like in this code:

    EDIT: there is no 365 trading days in year. You should adapt this lookback period to get something near the real value.

     

    #39758

    Thank you!!! Also for noticing the 365 – I am so used from calculating interest rates and didn’t even think of it :/

    It worked (i think it works at least for now) amending the code as follows – from some sample data looks like it works as expected

    Again appreciated

     

    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