TREND LINE through Peaks and Troughs

Forums ProRealTime English forum ProBuilder support TREND LINE through Peaks and Troughs

Viewing 15 posts - 1 through 15 (of 24 total)
  • #143055

    Hello,

    I have identified the Peaks and Troughs as per the enclosed code.

    Now , if I want to join the 2 higher high troughs and 2 lower low peaks within a timeframe (e.g. from 15:00 to 23:00) how to do it?

    Example is enclosed where manual trend lines are drawn between the said period.

    Any help would be highly appreciated.

    Regards,

     

    #143294

    Any help would be highly appreciated, please.

    #143319

    You need to give high TT’s and the low TT’s different names and store the previous value when a new value is recorded. You also need to store the barindex.

    Something like this perhaps. Not tested.

     

     

     

    #143335

    VERY HELPFUL Vonasi.

    Much appreciated.

    Many thanks for your time and effort.

    Regards,

     

    #143336

    Hello Vonasi,

    Is it possible not to extend the line to its left? if yes then how please? and if I want the line to be drawn for today’s peaks and troughs only then should I check “if date=today”?

    Regards,

     

    #143348

    That’s possible but only with PRT v11 and the DRAWRAY instruction.

     

    1 user thanked author for this post.
    #143356

    Try this for just drawing the latest lines:

    As Nicolas says you need DRAWRAY and v11 to get rid of the bit of line to the left.

     

    #143375

    Many thanks Vonasi and Nicolas. Much appreciated.

    I have modified the code, but could not set alarm as it is not identifying the lines’ value correctly,

    Is it possible to fix it?

     

    #143388

    You cannot set an alarm to detect lines drawn in a custom indicator. You will need to calculate the projected forward line value for each bar moving forward by subtracting the lower point value from the higher point value and dividing by the number of bars between them, then add this on to the most recent value for each bar moving forward.

    Once you know this value you can test to see if close is above or below it etc.

    One downside of this calculation is if you use a time frame with missing bars as these can cause steps in the forward calculation.

    An example of this sort of calculation can be found here:

    https://www.prorealcode.com/prorealtime-indicators/last-two-pivots-support-and-resistance-lines/

    In fact it might be easier for you just to adapt that indicator to do what you want.

    #143390
    #143426

    Many thanks Vonasi. 2nd example is a brilliant one.

     

    #143807

    Dear Vonasi, in your last example (https://www.prorealcode.com/prorealtime-indicators/last-two-highest-high-and-lowest-low-lines-yearly-quarterly-monthly-weekly-daily-4-hour-and-1-hour/) you have drawn lines without extending to the left and without “DRAWRAY”. So if that is possible in your example, why can’t we do the same to my indicator (with your help) please?

    #143814

    The lines are segments, not extending on the left or the right.

    Replace DRAWLINE with DRAWSEGMENT.

    1 user thanked author for this post.
    #143870

    You are right Nicolas. When can we have “Style” with DRAWLINE and DRAWSEGMENT to increase line thickness? Is Style available with DRAWRAY?

    #143881

    Graphical objects can be styled, but only with PRT v11.

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

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