Daily Weekly Monthly pivot points version 11

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #211118 quote
    bigiday
    Participant
    New

    Hello,

    I tried to update the code to version 11, but I couldn’t.
    Is there a new version, or something integrate in PRC ?

    Daily Weekly Monthly pivot points – Indicators – ProRealTime (prorealcode.com)
    (thx Nicolas and henry for the original code)

    🙂

    #211119 quote
    bigiday
    Participant
    New

    Yearly :

    //PRC_YearlyPivotPoints | indicator
    //26.10.2016
    //Nicolas @ www.prorealcode.com V2 : bigiday
    //Sharing ProRealTime knowledge
    //adapted from PRT original indicator
    
    //select mode of calculation of the yearly pivot points (0,1,2)
    mode = 0
    
    If Year<>Year[1] then
    yearlyHigh = Highest[max(1,BarIndex - lastYearBarIndex)](High)[1]
    yearlyLow = Lowest[max(1,BarIndex - lastYearBarIndex)](Low)[1]
    lastYearBarIndex = BarIndex
    
    If mode = 0 then
    yearlyPivot = (yearlyHigh + yearlyLow + Close[1]) / 3
    Elsif mode = 1 then
    yearlyPivot = (Open + yearlyHigh + yearlyLow + Close[1]) / 4
    Elsif mode = 2 then
    yearlyPivot = (yearlyHigh + yearlyLow + Close[1]*2) / 4
    Else
    yearlyPivot = (Open*2 + yearlyHigh + yearlyLow) / 4
    Endif
    yearlyR1 = 2*yearlyPivot - yearlyLow
    yearlyS1 = 2*yearlyPivot - yearlyHigh
    yearlyR2 = yearlyPivot + (yearlyHigh - yearlyLow)
    yearlyS2 = yearlyPivot - (yearlyHigh - yearlyLow)
    yearlyR3 = yearlyR1 + (yearlyHigh - yearlyLow)
    yearlyS3 = yearlyS1 - (yearlyHigh - yearlyLow)
    Endif
    
    return yearlyPivot as "yearly P", yearlyR1 as "yearly R1", yearlyS1 as "yearly S1", yearlyR2 as "yearly R2", yearlyS2 as "yearly S2", yearlyR3 as "yearly R3", yearlyS3 as "yearly S3"
    

    Monthly

    //PRC_MonthlytPivotPoints | indicator
    //26.10.2016
    //Nicolas @ www.prorealcode.com V2 : bigiday
    //Sharing ProRealTime knowledge
    //adapted from PRT original indicator
    
    //select mode of calculation of the yearly pivot points (0,1,2)
    mode = 0
    
    If Month<>Month[1] then
    monthlyHigh = Highest[max(1,BarIndex - lastMonthBarIndex)](High)[1]
    monthlyLow = Lowest[max(1,BarIndex - lastMonthBarIndex)](Low)[1]
    lastMonthBarIndex = BarIndex
     
    If mode = 0 then
    monthlyPivot = (monthlyHigh + monthlyLow + Close[1]) / 3
    Elsif mode = 1 then
    monthlyPivot = (Open + monthlyHigh + monthlyLow + Close[1]) / 4
    Elsif mode = 2 then
    monthlyPivot = (monthlyHigh + monthlyLow + Close[1]*2) / 4
    Else
    monthlyPivot = (Open*2 + monthlyHigh + monthlyLow) / 4
    Endif
    monthlyR1 = 2*monthlyPivot - monthlyLow
    monthlyS1 = 2*monthlyPivot - monthlyHigh
    monthlyR2 = monthlyPivot + (monthlyHigh - monthlyLow)
    monthlyS2 = monthlyPivot - (monthlyHigh - monthlyLow)
    monthlyR3 = monthlyR1 + (monthlyHigh - monthlyLow)
    monthlyS3 = monthlyS1 - (monthlyHigh - monthlyLow)
    Endif
    
    return monthlyPivot as "monthlyPivot", monthlyR1 as "monthlyR1", monthlyS1 as "monthlyS1", monthlyS1 as "monthlyS1", monthlyS1 as "monthlyS1", monthlyR3 as "monthlyR3", monthlyS3 as "monthlyS3"
    

    Weekly

    //PRC_WeeklyPivotPoints | indicator
    //26.10.2016
    //Nicolas @ www.prorealcode.com V2 : bigiday
    //Sharing ProRealTime knowledge
    //adapted from PRT original indicator
    
    //select mode of calculation of the yearly pivot points (0,1,2)
    mode = 0
    
    If DayOfWeek<DayOfWeek[1] then
    weeklyHigh = Highest[max(1,BarIndex - lastWeekBarIndex)](High)[1]
    weeklyLow = Lowest[max(1,BarIndex - lastWeekBarIndex)](Low)[1]
    lastWeekBarIndex = BarIndex
     
    If mode = 0 then
    weeklyPivot = (weeklyHigh + weeklyLow + Close[1]) / 3
    Elsif mode = 1 then
    weeklyPivot = (Open + weeklyHigh + weeklyLow + Close[1]) / 4
    Elsif mode = 2 then
    weeklyPivot = (weeklyHigh + weeklyLow + Close[1]*2) / 4
    Else
    weeklyPivot = (Open*2 + weeklyHigh + weeklyLow) / 4
    Endif
    weeklyR1 = 2*weeklyPivot - weeklyLow
    weeklyS1 = 2*weeklyPivot - weeklyHigh
    weeklyR2 = weeklyPivot + (weeklyHigh - weeklyLow)
    weeklyS2 = weeklyPivot - (weeklyHigh - weeklyLow)
    weeklyR3 = weeklyR1 + (weeklyHigh - weeklyLow)
    weeklyS3 = weeklyS1 - (weeklyHigh - weeklyLow)
    Endif
    
    return weeklyPivot as "weeklyPivot", weeklyR1 as "weeklyR1", weeklyS1 as "weeklyS1", weeklyR2 as "weeklyR2", weeklyS2 as "weeklyS2", weeklyR3 as "weeklyR3", weeklyS3 as "weeklyS3"
    

    It seems to me that there are differences with the one integrated example in attachment

    #211121 quote
    bigiday
    Participant
    New

    It’s a referencing problem (example the weekly works only in the time frame 1 days).

    Just add :

    TIMEFRAME(daily)
    #211124 quote
    bigiday
    Participant
    New

    Final version

    Yearly :

    //PRC_YearlyPivotPoints | indicator
    //08.03.2023
    //Nicolas @ www.prorealcode.com V2 : bigiday
    //Sharing ProRealTime knowledge
    //adapted from PRT original indicator
    
    //select mode of calculation of the yearly pivot points (0,1,2)
    TIMEFRAME(daily)
    mode = 0
    
    If Year<>Year[1] then
    yearlyHigh = Highest[max(1,BarIndex - lastYearBarIndex)](High)[1]
    yearlyLow = Lowest[max(1,BarIndex - lastYearBarIndex)](Low)[1]
    lastYearBarIndex = BarIndex
    
    If mode = 0 then
    yearlyPivot = (yearlyHigh + yearlyLow + Close[1]) / 3
    Elsif mode = 1 then
    yearlyPivot = (Open + yearlyHigh + yearlyLow + Close[1]) / 4
    Elsif mode = 2 then
    yearlyPivot = (yearlyHigh + yearlyLow + Close[1]*2) / 4
    Else
    yearlyPivot = (Open*2 + yearlyHigh + yearlyLow) / 4
    Endif
    yearlyR1 = 2*yearlyPivot - yearlyLow
    yearlyS1 = 2*yearlyPivot - yearlyHigh
    yearlyR2 = yearlyPivot + (yearlyHigh - yearlyLow)
    yearlyS2 = yearlyPivot - (yearlyHigh - yearlyLow)
    yearlyR3 = yearlyR1 + (yearlyHigh - yearlyLow)
    yearlyS3 = yearlyS1 - (yearlyHigh - yearlyLow)
    Endif
    
    return yearlyPivot as "yearly P", yearlyR1 as "yearly R1", yearlyS1 as "yearly S1", yearlyR2 as "yearly R2", yearlyS2 as "yearly S2", yearlyR3 as "yearly R3", yearlyS3 as "yearly S3"
    

    Monthly :

    //PRC_MonthlytPivotPoints| indicator
    //08.03.2023
    //Nicolas @ www.prorealcode.com V2 : bigiday
    //Sharing ProRealTime knowledge
    //adapted from PRT original indicator
    
    //select mode of calculation of the yearly pivot points (0,1,2)
    TIMEFRAME(daily)
    mode = 0
    
    If Month<>Month[1] then
    monthlyHigh = Highest[max(1,BarIndex - lastMonthBarIndex)](High)[1]
    monthlyLow = Lowest[max(1,BarIndex - lastMonthBarIndex)](Low)[1]
    lastMonthBarIndex = BarIndex
     
    If mode = 0 then
    monthlyPivot = (monthlyHigh + monthlyLow + Close[1]) / 3
    Elsif mode = 1 then
    monthlyPivot = (Open + monthlyHigh + monthlyLow + Close[1]) / 4
    Elsif mode = 2 then
    monthlyPivot = (monthlyHigh + monthlyLow + Close[1]*2) / 4
    Else
    monthlyPivot = (Open*2 + monthlyHigh + monthlyLow) / 4
    Endif
    monthlyR1 = 2*monthlyPivot - monthlyLow
    monthlyS1 = 2*monthlyPivot - monthlyHigh
    monthlyR2 = monthlyPivot + (monthlyHigh - monthlyLow)
    monthlyS2 = monthlyPivot - (monthlyHigh - monthlyLow)
    monthlyR3 = monthlyR1 + (monthlyHigh - monthlyLow)
    monthlyS3 = monthlyS1 - (monthlyHigh - monthlyLow)
    Endif
    
    return monthlyPivot as "Monthly P", monthlyR1 as "Monthly R1", monthlyS1 as "Monthly S1", monthlyR2 as "Monthly R2", monthlyS2 as "Monthly S2", monthlyR3 as "Monthly R3", monthlyS3 as "Monthly S3"
    

     

    Weekly:

    //PRC_WeeklyPivotPoints | indicator
    //08.03.2023
    //Nicolas @ www.prorealcode.com V2 : bigiday
    //Sharing ProRealTime knowledge
    //adapted from PRT original indicator
    
    //select mode of calculation of the yearly pivot points (0,1,2)
    TIMEFRAME(daily)
    mode = 0
    
    If DayOfWeek<DayOfWeek[1] then
    weeklyHigh = Highest[max(1,BarIndex - lastWeekBarIndex)](High)[1]
    weeklyLow = Lowest[max(1,BarIndex - lastWeekBarIndex)](Low)[1]
    lastWeekBarIndex = BarIndex
     
    If mode = 0 then
    weeklyPivot = (weeklyHigh + weeklyLow + Close[1]) / 3
    Elsif mode = 1 then
    weeklyPivot = (Open + weeklyHigh + weeklyLow + Close[1]) / 4
    Elsif mode = 2 then
    weeklyPivot = (weeklyHigh + weeklyLow + Close[1]*2) / 4
    Else
    weeklyPivot = (Open*2 + weeklyHigh + weeklyLow) / 4
    Endif
    weeklyR1 = 2*weeklyPivot - weeklyLow
    weeklyS1 = 2*weeklyPivot - weeklyHigh
    weeklyR2 = weeklyPivot + (weeklyHigh - weeklyLow)
    weeklyS2 = weeklyPivot - (weeklyHigh - weeklyLow)
    weeklyR3 = weeklyR1 + (weeklyHigh - weeklyLow)
    weeklyS3 = weeklyS1 - (weeklyHigh - weeklyLow)
    Endif
    
    return weeklyPivot as "weeklyPivot", weeklyR1 as "weeklyR1", weeklyS1 as "weeklyS1", weeklyR2 as "weeklyR2", weeklyS2 as "weeklyS2", weeklyR3 as "weeklyR3", weeklyS3 as "weeklyS3"
    

    GL

    robertogozzi and Nicolas thanked this post
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Daily Weekly Monthly pivot points version 11


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
bigiday @bigiday Participant
Summary

This topic contains 3 replies,
has 1 voice, and was last updated by bigiday
2 years, 11 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 03/08/2023
Status: Active
Attachments: 1 files
Logo Logo
Loading...