calcolo pivot annuale

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #110150 quote
    fourx
    Participant
    New
    //PRC_YearlyPivotPoints | indicator
    //26.10.2016
    //Nicolas @ www.prorealcode.com
    //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[BarIndex - lastYearBarIndex](High)[1]
    yearlyLow = Lowest[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"

    buongiorno,

    da tempo uso questo codice trovato su prorealcode, ha sempre funzionato bene, ma dopo l’aggiornamento alla versione 11 mi viene fuori un errore:”un parametro di tipo intero positivo è atteso con Highest”. potresti aiutarmi?

    grazie mille

    f

    #110151 quote
    robertogozzi
    Moderator
    Master

    Prova a scrivere le righe 11 e 12 così:

    yearlyHigh = Highest[min(1,BarIndex - lastYearBarIndex)](High)[1]
    yearlyLow = Lowest[min(1,BarIndex - lastYearBarIndex)](Low)[1]

    in questo modo siamo sicuri che il valore non sia mai < 1.

    #110152 quote
    fourx
    Participant
    New

    Roberto ti ringrazio tanto per il supporto, ma purtroppo mi da ancora lo stesso errore…

    #110153 quote
    fourx
    Participant
    New

    Roberto ho risolto mettendo max al posto di min… pensi possa andar bene?? errori non ce ne sono..

    yearlyHigh = Highest[max(1,BarIndex - lastYearBarIndex)](High)[1]
    yearlyLow = Lowest[max(1,BarIndex - lastYearBarIndex)](Low)[1]
    #110154 quote
    robertogozzi
    Moderator
    Master

    Hai ragione, avevo sbagliato io la funzione. 🙂

    #110155 quote
    fourx
    Participant
    New

    grazie

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

calcolo pivot annuale


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
fourx @fourx Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by fourx
6 years, 5 months ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 10/14/2019
Status: Active
Attachments: No files
Logo Logo
Loading...