Calculating Diagonal Trend Lines Using Fractals and Trigonometry

Forums ProRealTime English forum ProOrder support Calculating Diagonal Trend Lines Using Fractals and Trigonometry

Viewing 14 posts - 16 through 29 (of 29 total)
  • #50434

    Hello Nicolas

    did you realize this indicators who draw oblique trend lines and oscillator??

    1 user thanked author for this post.
    #50934

    I tried at that moment but I did not manage to obtain something satisfactory in the time that I had been imparted to this task … Too many good topics and good ideas to explore and only so little time 😐

    1 user thanked author for this post.
    #50987

    I do not doubt that with a little time you’ll get there, we’ll wait for you.

    congratulations

    Madrosat

    #59212

    @Nicolas, I would like us to revisit this strategy. I have noticed that it has performed well since I posted my last version on 11 September, adding 33 new trades with a win rate of 63.64% and a Gain/Loss Ratio of 2.71 and a Gain to Drawdown ratio of 3.39.

    I still need some help graphing the trend lines.

    #59218

    If you could identify at least 2 points of the trendline in your code, we could plot it easily. If you can separate all the trading stuff from the trendline calculation in your code, I could help for sure.

    #59349

    Hi Nicolas

    Okay so here is the part of the code that calculates the trend.

    The first point of the trend line is obviously the last swing high/low (FractalH or FractalL) and the bar position being FractalP

    The second point would be the last high/low that results in the MaxAngle to be greater than the last value it held.

     

    1 user thanked author for this post.
    #59358

    Something like this? (made only the support lines)

    If “MaxAngle” is superior to the last one and it’s a bull trend, draw a new segment (not a complete line to have a clear chart).

    #59372

    Dear Juan,

    will you please post your latest version. This is very interesting. I noticed the part of the code that you have reposted is slightly different form the one posted last year. I know slight difference in a code could be the difference between  losing and winning!

    Many thanks.

    #59568

    @Nicolas, thank you for the indicator.

    It is difficult to say whether or not it looks correct as I can imagine there to be many new lines being drawn constantly.

    However the rules is basically as follows:

    Once a swing high/low is identified with 2 lower highs/higher lows on either side;

    1. Draw an initial line from the high/low of the swing point to the high/low of the 2nd shoulder which should technically be the lowest/highest of the 2 shoulders. This gives the initial value for MaxAngle.
    2. Now after every new bar the angle between the high/low of the swing point and the latest high/low will be calculated and compared to the current value being held by MaxAngle. If the new angle is greater it means a high/low outside the diagonal line is present. To determine whether this constitutes a break, we recalculate the angle using the close. If the close also falls outside the trend line a potential break is present and we will wait for the next candle stick to confirm. If the close does not fall outside the trend line, then the trend remains intact and the high/low will be used to update the new MaxAngle value.
    3. If a new swing high/low is present, this will be used as the new point from which the trend line is calculated.
    1 user thanked author for this post.
    #59570

    Would basically look something like this:

     

     

    #59683

    Juan, you can use the line equation. like this:

    If the line equation is  y=mx+b and the coordinates of a point is (x0,y0) then compare y0 and mxo+b, for example if y0>mxo+b then the point is above the line, etc.

    x0 is bar index and y0 is price.

    in case needed, equation of a line passing two points

    y − y1 = m(x − x1)

    m= y2-y1/x2-x1      y is price,m is bar index

     

    thus forget the angle business all together

     

     

    #59778

    I ran this puppy on USDJPY and were quite surprised by the results (see attached), especially considering that I used the EURUSD during optimization and testing:


    @Golha
    Here is the latest version of the code:

     

    2 users thanked author for this post.
    #163381

    @JuanJ I find this strategy really interesting! However, I am struggling to make Money Management work with this. None of the MM code I can find here seems to work. I have made sure to change positionsize to possize but it still doesn’t work, there seem to be something in your code that overrides it but I cannot figure out what. Any help would be massively appreciated.

    #163382

    Do you run this still live?

    I seem to get interesting backtest results with this also:

    period = period2 * AverageTrueRange[periodv]

    (period2 and periodv to be optimised)

Viewing 14 posts - 16 through 29 (of 29 total)

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