Very Latest John Ehler's Correlation Trend Indicator

Forums ProRealTime English forum ProBuilder support Very Latest John Ehler's Correlation Trend Indicator

Viewing 15 posts - 1 through 15 (of 32 total)
  • #128654

    I thought this might be worth converting and make a good addition to the indicator library if someone would like to covert the code?  It’s John Ehler’s Correlation Trend Indicator from the Stocks & Commodities 05/2020 edition.

    “The basic idea of the Correlation Trend Indicator (CTI) is quite simple. The ideal trend curve is a straight upwards line. So the CTI just measures the correlation of the price curve with this ideal trend line. Ehlers provided TradeStation code. This is the indicator:

    X represents the price curve, Y the trend line, and correlation is measured with the Spearman algorithm. The trend line is supposed to linearly rise with count, but I’m using the negative count here because the Data series is stored backwards, with the most recent values at the beginning.

    This is how the Correlation Trend Indicator (CTI) looks when applied to SPY (red = 10 days period, blue = 40 days): Pls see image.

    We can see that the lines reproduce rather well the price curve trend. And we can also see that the blue line, the 40-days trend, is not just a smoothed version of the red 10-days trend – it looks entirely different. This is an interesting feature of a trend indicator – it separates long-term and short-term trend perfectly.”

    The article goes on to say that it might be difficult profitably trading on CTI zero crossovers but I would regard, judging form the indicator screenshot, that the -0.8 and +0.8 crossings are more useful for determining future price direction.

    https://financial-hacker.com/petra-on-programming-a-unique-trend-indicator/#more-3424

     

    #128674

    Seems very similar to: R-Squared correlation coefficient – R²

     

    #128851

    At first I was so close @Nicolas!

    I tried first with my left hand indicator (pls see image) but couldn’t get it to scale -1 to 1 in the top indicator.

    So I built another (right hand side indicator and bottom chart using Ehler’s version of R2) and eventually got my Long R2 to stop flatlining along the zero axis by having to make a distinction between the two groups of SumsX’s, SumXY’s etc. I relabelled all the SumX’s, SumXX’s etc by changing them to SumLX (L for Long) and SumY to SumSY etc. Phew.

    So… is Ehler’s R2 mathematics equations doing the exact same thing as PRC’s R2?

    If it’s correct, maybe it’s one for the library?

    Cheers,

     

    #128856

    I don’t think the SPeriod and LPeriod Variables are making any difference to the indicators red and blue R2 lines when they’re increased or decreased?

    Ps// Please crop off the blue top bar in the (last, 4th) final photo if it’s used for the library and please delete this comment. Thanks @Nicolas.

    #128877

    Bard – If you think that you have created an indicator worthy of going in the library then you need to click on the ‘+’ on the top bar and submit it yourself. Add images, ITF file a description and include the code in the post. This saves Nicolas a lot of work – and he is a very busy person! Please check how other library posts are formatted and this will give you an idea of what is required.

    1 user thanked author for this post.
    #128893

    Thanks Vonasi, I hoped someone would give the indicator a look before adding to make sure the code is correct (it looks correct from the chart but I am not a coder)?
    Here I’ve patched together the PRC R2 indicator with some of the code from John Ehler’s Correlation Trend indicator. Both codes are available, Ehler’s at the very top of this thread and PRC R2 via a url link. Does mine look correct and can you fix the period variable not having any impact on the red or blue line (you can only change the period via the code in the indicator)? Cheers.

    #128895

    Does mine look correct?

    You’ll have to wait for Nicolas the TradeStation to PRT guru to confirm that you have replicated the code correctly and then submit it to the library.

    #128934

    Thanks for the work done Bard. Without diggin too much into your code, I think that there might be some differences, but I can’t spot them.

    Here is the 1:1 conversion from the Tradestation code you shared:

     

    1 user thanked author for this post.
    #129372

    That’s great Nicolas, not sure it’s the right way up!? I thought maybe mine (short name, bottom indicator) was the inverse when on the £/$, when the R2 reading was high there was no trend but now on Brent Crude I think mine looks right (bottom) and yours is inverse. What do you think? Pls see second screenshot and ignore first screenshot.

    What change to the equation would flip them to the “correct” way as in your code, because I thought I altered the PRC R2 code accurately?

    I’ve added a long = 40 and short period  =10 in variables for easy control.

    Nearly there! Cheers,

    #129384

    And S&P 500: Now it clearly looks like yours is the right way round (how could it not be), judging from the blue 40 day trend correlation from Nov 2019 onwards on the S&P 500 But then note how mine seems to correctly represent the crash on the far right and yours doesn’t, both you 10 and 40 period CTI’s are low and “non trending.”

    This is slightly confusing to me why this is happening when the trends are so clearly seen in the candlesticks? (Your code top, mine bottom).

     

    1 user thanked author for this post.
    #129427

    This indicator is not giving you the trend direction, but the fact that the price is similar or not to a straight line (a linear regression), calculated over a given period.

     

    1 user thanked author for this post.
    #129545

    I appreciate that Nicolas, but the cases where the market is clearly trending in one direction or another with little noise don’t always seem to be  reflected in the CTI?

    For example in the S&P 500 above, your top CTI 40 day blue indicator picks up those two stable long uptrends (beginning and end of the chart) because the straight line correlation is strong yet completely misses the albeit only slightly less straight lined Covid19 market plunge, whereas my incorrect inverse (bottom) blue CTI picks it up. What is wrong with my equation, it was copied from PRT’s R2?

    Then at the start of that market rout, my 10 day red CTI picks up the 7 day straight line plunge perfectly but yours doesn’t?
    It’s the behaviour of your red line that first confused me. It completely misses the start of one of the biggest market plunges in history and that near perfect 7 day “linear” plunge!? How come?

    Cheers,

    #129552

    I put a 5 day CTI in there (along with the 10 and 40 period) to see if it would forecast the market rout, it  didn’t but guess what? I spotted something that does suggest a strong link with trend direction and an exploitable relation: The cross of the 5 and 10 day CTI when it was below the -0.5 level or for shorts above the 0.5 level. Quite consistent! Pls see pics.

    Please try this on the major currencies like the €/$, $/CHF, $/Yen, £/$ and AUD/$ for the last 5 years with a 3.8 spread:
    Be interesting to see what Machine Learning does with those 0.5 thresholds or CTI periods?

    “Ehler’s CTI + Dev Stop”

     

     

    #129559

    Here’s the Ehler’s CTI + Dev Stop System itf, easier than posting this as I hope it will include the Kase Dev Stop SAR version I used.

    Also here is the Double Ehler’s CTI, I’ll add it to the library when I get more time today:

     

     

     

    #129577

    Hola Nico  and Bard,

    Can we have the same index with scale from 0 to 100 for apairing with others index ?

    I use 5 and 30

    attached graph of Cac40

     

Viewing 15 posts - 1 through 15 (of 32 total)

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