Indicatore Pivot Points giornaliero

Collapse
X
 
  • Ora
  • Show
Clear All
new posts
  • CIVT
    Senior Member
    • Dec 2009
    • 813

    #1

    Indicatore Pivot Points giornaliero

    Buongiorno, qualcuno è così gentile da aiutarmi a costruire l\'indicatore in oggetto?

    Questo è il codice su cui lavorare e come potete immaginare sono molto distante dalla perfezione!

    Codice:
    SET AP = (HIGH + LOW + CLOSE) / 3
    SET S1 = (2 * AP) - HIGH
    SET R1 = (2 * AP) - LOW
    SET S2 = AP - (R1 - S1)
    SET R2 = (AP - S1) + R1
    SET R3 = R2 + (HIGH - LOW)
    SET S3 = S2 - (HIGH - LOW)
    
    SET PLOT1 = AP
    SET PLOT2 = S1
    SET PLOT3 = R1
    SET PLOT4 = S2
    SET PLOT5 = R2
    SET PLOT6 = R3
    SET PLOT7 = S3
    Questo è il mio risultato

    Click image for larger version

Name:	pivot.jpg
Views:	1
Size:	144.8 KB
ID:	164653

    Questo invece è il risultato che vorrei ottenere

    Click image for larger version

Name:	pivot_point_graphic1.jpg
Views:	1
Size:	111.1 KB
ID:	164654
  • BMM
    Senior Member

    • Jan 2011
    • 1306

    #2
    come ti dicevo devi calcolare i pivot nel timeframe daily ed espanderli nell\'intraday

    con un altro linguaggio si fa così, devi trasferirlo in easyscript

    Codice:
    TimeFrameSet( inDaily );
    
    P = ( H + L + C ) / 3;
    R1 = ( P * 2 ) - L;
    S1 = ( P * 2 ) - H;
    R2 = P + ( R1 - S1 );
    S2 = P - ( R1 - S1 );
    R3 = R2 + (H - L);
    S3 = S2 - (H - L) ;
    
    TimeFrameRestore();
    
    P = TimeFrameExpand( P, inDaily );
    R1 = TimeFrameExpand( R1, inDaily );
    S1 = TimeFrameExpand( S1, inDaily );
    R2 = TimeFrameExpand( R2, inDaily );
    S2 = TimeFrameExpand( S2, inDaily );
    R3 = TimeFrameExpand( R3, inDaily );
    S3 = TimeFrameExpand( S3, inDaily );
    
    Plot( R2, "R2", colorGrey50, styleDashed );
    Plot( R1, "R1", colorGrey50, styleDashed );
    Plot( P, "P", colorGrey50, styleDashed );
    Plot( S1, "S1", colorGrey50, styleDashed );
    Plot( S2, "S2", colorGrey50, styleDashed );
    Plot( R3, "R3", colorGrey50, styleDashed );
    Plot( S3, "S3", colorGrey50, styleDashed );

    Comment

    • CIVT
      Senior Member
      • Dec 2009
      • 813

      #3
      Originariamente Scritto da BMM
      come ti dicevo devi calcolare i pivot nel timeframe daily ed espanderli nell\'intraday

      con un altro linguaggio si fa così, devi trasferirlo in easyscript

      Codice:
      TimeFrameSet( inDaily );
      
      P = ( H + L + C ) / 3;
      R1 = ( P * 2 ) - L;
      S1 = ( P * 2 ) - H;
      R2 = P + ( R1 - S1 );
      S2 = P - ( R1 - S1 );
      R3 = R2 + (H - L);
      S3 = S2 - (H - L) ;
      
      TimeFrameRestore();
      
      P = TimeFrameExpand( P, inDaily );
      R1 = TimeFrameExpand( R1, inDaily );
      S1 = TimeFrameExpand( S1, inDaily );
      R2 = TimeFrameExpand( R2, inDaily );
      S2 = TimeFrameExpand( S2, inDaily );
      R3 = TimeFrameExpand( R3, inDaily );
      S3 = TimeFrameExpand( S3, inDaily );
      
      Plot( R2, "R2", colorGrey50, styleDashed );
      Plot( R1, "R1", colorGrey50, styleDashed );
      Plot( P, "P", colorGrey50, styleDashed );
      Plot( S1, "S1", colorGrey50, styleDashed );
      Plot( S2, "S2", colorGrey50, styleDashed );
      Plot( R3, "R3", colorGrey50, styleDashed );
      Plot( S3, "S3", colorGrey50, styleDashed );

      Ciao BMM grazie per la dritta, quindi ipotizzando di lavorare su TF orario potrei rifere i calcoli alle 24 ore precedenti però manca ancora qualcosa

      Codice:
      INPUTS: @HOURS(24)
      
      SET LOW1 = REF(LOW, @HOURS)
      SET HIGH1 = REF(HIGH,@HOURS)
      SET CLOSE1 = REF(CLOSE,@HOURS)
      
      SET AP = ((HIGH1) + (LOW1) + (CLOSE1)) / 3
      SET S1 = (2 * AP) - (HIGH1)
      SET R1 = (2 * AP) - (LOW1)
      SET S2 = AP - (R1 - S1)
      SET R2 = (AP - S1) + R1
      SET R3 = R2 + ((HIGH1) - (LOW1))
      SET S3 = S2 - ((HIGH1) - (LOW1))
      
      SET PLOT1 = S1
      SET PLOT2 = R1
      SET PLOT3 = S2
      SET PLOT4 = R2
      SET PLOT5 = R3
      SET PLOT6 = S3
      Altri suggerimenti?
      Click image for larger version

Name:	pivotorario.jpg
Views:	1
Size:	83.5 KB
ID:	148958

      Comment

      • Smash
        Senior Member

        • Feb 2012
        • 351

        #4
        Originariamente Scritto da CIVT
        Buongiorno, qualcuno è così gentile da aiutarmi a costruire l\'indicatore in oggetto?

        Questo è il codice su cui lavorare e come potete immaginare sono molto distante dalla perfezione!

        Codice:
        SET AP = (HIGH + LOW + CLOSE) / 3
        SET S1 = (2 * AP) - HIGH
        SET R1 = (2 * AP) - LOW
        SET S2 = AP - (R1 - S1)
        SET R2 = (AP - S1) + R1
        SET R3 = R2 + (HIGH - LOW)
        SET S3 = S2 - (HIGH - LOW)
        
        SET PLOT1 = AP
        SET PLOT2 = S1
        SET PLOT3 = R1
        SET PLOT4 = S2
        SET PLOT5 = R2
        SET PLOT6 = R3
        SET PLOT7 = S3
        Questo è il mio risultato

        [ATTACH=CONFIG]12353[/ATTACH]

        Questo invece è il risultato che vorrei ottenere

        [ATTACH=CONFIG]12354[/ATTACH]


        Ciao CIVT,

        per disegnare i Pivot ti servono la chiusura del giorno prima, e poi il massimo ed il minimo del giorno prima.

        Per la chiusura del giorno prima puoi usare questo indicatore:

        Codice:
        SET ConditionDateChange = DATE > REF(DATE, 1)
        SET myDateChange = IF(ConditionDateChange, 1, 0)
        SET myPivotClose = CHANGEIF(myDateChange = 1, REF(CLOSE, 1))
        
        SET PLOT1 = myPivotClose

        Invece per il massimo e il minimo del giorno prima, a quanto ho capito, bisogna attendere la prossima release 0.8.10.15 di beeTrader, quando sarà possibile passare ad alcune funzioni di EasyScript qualsiasi espressione anzichè un semplice valore numerico come adesso.

        (sempre che non sia già possibile ora trovare una soluzione alternativa: ma per adesso io non ci sto riuscendo).
        Last edited by Smash; 18-10-13, 13:08.

        Comment

        • maxmax68
          Senior Member

          • Sep 2013
          • 186

          #5
          Salve ragazzi provate con questo codice:
          Codice:
          #
          # PIVOT Pidi
          #
          SET A=DATE
          SET B=REF(DATE,1)
          SET COND1 = (A != B)
          SET COND2 = (A = B) AND (HIGH > REF(HIGH, 1))
          SET COND3 = (A = B) AND (LOW < REF(LOW, 1))
          # Close del giorno precedente
          SET PrevDayClose = CHANGEIF(COND1, REF(CLOSE,1))
          # Massimo del giorno
          SET H1= CHANGEIF(COND2, HIGH)
          # Minimo del giorno
          SET L1= CHANGEIF(COND3, LOW)
          # High del giorno precedente
          SET PrevDayHigh = CHANGEIF(COND1, H1)
          # Low del giorno precedente
          SET PrevDayLow = CHANGEIF(COND1, L1)
          # Pivot points
          SET AP = (PrevDayHigh + PrevDayLow + PrevDayClose) / 3
          SET SS1 = (2 * AP) - PrevDayHigh
          SET RR1 = (2 * AP) - PrevDayLow
          SET SS2 = AP - (RR1 - SS1)
          SET RR2 = (AP - SS1) + RR1
          SET RR3 = RR2 + (PrevDayHigh - PrevDayLow)
          SET SS3 = SS2 - (PrevDayHigh - PrevDayLow)
           
          SET PLOT1 = AP
          SET PLOT2 = SS1
          SET PLOT3 = RR1
          SET PLOT4 = SS2
          SET PLOT5 = RR2
          SET PLOT6 = SS3
          SET PLOT7 = RR3
          #
          Fatemi sapere.
          Saluti
          Massimo

          Comment

          • maxmax68
            Senior Member

            • Sep 2013
            • 186

            #6
            Scusate dimenticavo:
            R2 non va bene perché è una parola riservata !!!
            Le condizioni iniziali le ho messe separate e non direttamente
            nel CHANGEIF perché l\'editor mi va spesso in errore
            nel riconoscimento delle condizioni e del REF !!!
            Saluti
            Massimo

            Comment

            • CIVT
              Senior Member
              • Dec 2009
              • 813

              #7
              Originariamente Scritto da Smash
              Ciao CIVT,

              per disegnare i Pivot ti servono la chiusura del giorno prima, e poi il massimo ed il minimo del giorno prima.

              Per la chiusura del giorno prima puoi usare questo indicatore:

              Codice:
              SET ConditionDateChange = DATE > REF(DATE, 1)
              SET myDateChange = IF(ConditionDateChange, 1, 0)
              SET myPivotClose = CHANGEIF(myDateChange = 1, REF(CLOSE, 1))
              
              SET PLOT1 = myPivotClose

              Invece per il massimo e il minimo del giorno prima, a quanto ho capito, bisogna attendere la prossima release 0.8.10.15 di beeTrader, quando sarà possibile passare ad alcune funzioni di EasyScript qualsiasi espressione anzichè un semplice valore numerico come adesso.

              (sempre che non sia già possibile ora trovare una soluzione alternativa: ma per adesso io non ci sto riuscendo).
              Grazie del prezioso contributo Smash, se ho inteso correttamente il codice credo che dovrebbe essere sufficiente aggiungere le due variabili HIGH e LOW del giorno precedente per ottenere il risultato aspettato eppure come giustamente fai notare non vengono calcolate....a questo punto aspettiamo Andrea o Max che sono sicuro avranno l\'asso nella manica!

              Posto il codice aggiornato..

              Codice:
              SET ConditionDateChange = DATE > REF(DATE, 1)
              SET myDateChange = IF(ConditionDateChange, 1, 0)
              SET CLOSE1 = CHANGEIF(myDateChange = 1, REF(CLOSE, 1))
              SET HIGH1 = CHANGEIF(myDateChange = 1, REF(HIGH, 1))
              SET LOW1 = CHANGEIF(myDateChange = 1, REF(LOW, 1))
              
              
              SET AP = ((HIGH1) + (LOW1) + (CLOSE1)) / 3
              SET S1 = (2 * AP) - (HIGH1)
              SET R1 = (2 * AP) - (LOW1)
              SET S2 = AP - (R1 - S1)
              SET R2 = (AP - S1) + R1
              SET R3 = R2 + (HIGH1) - (LOW1)
              SET S3 = S2 - (HIGH1) - (LOW1)
              
              SET PLOT1 = S1
              SET PLOT2 = R1
              SET PLOT3 = S2
              SET PLOT4 = R2
              SET PLOT5 = R3
              SET PLOT6 = S3

              Ed il risultato purtroppo ancora "parziale"...

              Click image for larger version

Name:	pivot_parziale.jpg
Views:	1
Size:	72.8 KB
ID:	148963

              Comment

              • CIVT
                Senior Member
                • Dec 2009
                • 813

                #8
                Originariamente Scritto da maxmax68
                Salve ragazzi provate con questo codice:
                Codice:
                #
                # PIVOT Pidi
                #
                SET A=DATE
                SET B=REF(DATE,1)
                SET COND1 = (A != B)
                SET COND2 = (A = B) AND (HIGH > REF(HIGH, 1))
                SET COND3 = (A = B) AND (LOW < REF(LOW, 1))
                # Close del giorno precedente
                SET PrevDayClose = CHANGEIF(COND1, REF(CLOSE,1))
                # Massimo del giorno
                SET H1= CHANGEIF(COND2, HIGH)
                # Minimo del giorno
                SET L1= CHANGEIF(COND3, LOW)
                # High del giorno precedente
                SET PrevDayHigh = CHANGEIF(COND1, H1)
                # Low del giorno precedente
                SET PrevDayLow = CHANGEIF(COND1, L1)
                # Pivot points
                SET AP = (PrevDayHigh + PrevDayLow + PrevDayClose) / 3
                SET SS1 = (2 * AP) - PrevDayHigh
                SET RR1 = (2 * AP) - PrevDayLow
                SET SS2 = AP - (RR1 - SS1)
                SET RR2 = (AP - SS1) + RR1
                SET RR3 = RR2 + (PrevDayHigh - PrevDayLow)
                SET SS3 = SS2 - (PrevDayHigh - PrevDayLow)
                 
                SET PLOT1 = AP
                SET PLOT2 = SS1
                SET PLOT3 = RR1
                SET PLOT4 = SS2
                SET PLOT5 = RR2
                SET PLOT6 = SS3
                SET PLOT7 = RR3
                #
                Fatemi sapere.
                Saluti
                Massimo
                Direi che ci siamo!!! SEI UN MITO!!! E grazie anche a tutti gli altri amici che hanno partecipato alla discussione SIETE FORTI RAGAZZI

                Click image for larger version

Name:	pivot_point_completo.jpg
Views:	1
Size:	95.7 KB
ID:	148964

                Comment

                • Smash
                  Senior Member

                  • Feb 2012
                  • 351

                  #9
                  Originariamente Scritto da maxmax68
                  Salve ragazzi provate con questo codice:
                  Codice:
                  #
                  # PIVOT Pidi
                  #
                  SET A=DATE
                  SET B=REF(DATE,1)
                  SET COND1 = (A != B)
                  SET COND2 = (A = B) AND (HIGH > REF(HIGH, 1))
                  SET COND3 = (A = B) AND (LOW < REF(LOW, 1))
                  # Close del giorno precedente
                  SET PrevDayClose = CHANGEIF(COND1, REF(CLOSE,1))
                  # Massimo del giorno
                  SET H1= CHANGEIF(COND2, HIGH)
                  # Minimo del giorno
                  SET L1= CHANGEIF(COND3, LOW)
                  # High del giorno precedente
                  SET PrevDayHigh = CHANGEIF(COND1, H1)
                  # Low del giorno precedente
                  SET PrevDayLow = CHANGEIF(COND1, L1)
                  # Pivot points
                  SET AP = (PrevDayHigh + PrevDayLow + PrevDayClose) / 3
                  SET SS1 = (2 * AP) - PrevDayHigh
                  SET RR1 = (2 * AP) - PrevDayLow
                  SET SS2 = AP - (RR1 - SS1)
                  SET RR2 = (AP - SS1) + RR1
                  SET RR3 = RR2 + (PrevDayHigh - PrevDayLow)
                  SET SS3 = SS2 - (PrevDayHigh - PrevDayLow)
                   
                  SET PLOT1 = AP
                  SET PLOT2 = SS1
                  SET PLOT3 = RR1
                  SET PLOT4 = SS2
                  SET PLOT5 = RR2
                  SET PLOT6 = SS3
                  SET PLOT7 = RR3
                  #
                  Fatemi sapere.
                  Saluti
                  Massimo

                  Ciao Massimo,

                  il codice che hai postato purtroppo non calcola il Max ed il Min assoluto del giorno prima, mentre calcola l\'ultimo Max relativo e l\'ultimo Min relativo del giorno prima.

                  Provare per credere:
                  fagli plottare i Max ed i Min dei giorni precedenti prima ancora di usarli per calcolare i livelli dei Pivot:

                  Codice:
                  #
                  # PIVOT Pidi
                  #
                  SET A=DATE
                  SET B=REF(DATE,1)
                  SET COND1 = (A != B)
                  SET COND2 = (A = B) AND (HIGH > REF(HIGH, 1))
                  SET COND3 = (A = B) AND (LOW < REF(LOW, 1))
                  # Close del giorno precedente
                  SET PrevDayClose = CHANGEIF(COND1, REF(CLOSE,1))
                  # Massimo del giorno
                  SET H1= CHANGEIF(COND2, HIGH)
                  # Minimo del giorno
                  SET L1= CHANGEIF(COND3, LOW)
                  # High del giorno precedente
                  SET PrevDayHigh = CHANGEIF(COND1, H1)
                  # Low del giorno precedente
                  SET PrevDayLow = CHANGEIF(COND1, L1)
                  
                  
                  SET PLOT1 = PrevDayHigh
                  SET PLOT2 = PrevDayLow
                  
                  #
                  Click image for larger version

Name:	Max-Min.jpg
Views:	1
Size:	120.0 KB
ID:	148967

                  Comment

                  • CIVT
                    Senior Member
                    • Dec 2009
                    • 813

                    #10
                    Originariamente Scritto da Smash
                    Ciao Massimo,

                    il codice che hai postato purtroppo non calcola il Max ed il Min assoluto del giorno prima, mentre calcola l\'ultimo Max relativo e l\'ultimo Min relativo del giorno prima.

                    Provare per credere:
                    fagli plottare i Max ed i Min dei giorni precedenti prima ancora di usarli per calcolare i livelli dei Pivot:
                    Purtroppo Smash ha ragione....se li confrontiamo con i PivotLevel corretti i livelli sono molto diversi

                    Click image for larger version

Name:	pivot_point_CHECK.jpg
Views:	1
Size:	101.0 KB
ID:	148972

                    Comment

                    • maxmax68
                      Senior Member

                      • Sep 2013
                      • 186

                      #11
                      Si, purtroppo non è corretto !!!
                      Ci riprovo stasera.
                      Alla faccia della semplicità di EasyScript.
                      Saluti
                      Massimo

                      Comment

                      • CIVT
                        Senior Member
                        • Dec 2009
                        • 813

                        #12
                        Originariamente Scritto da maxmax68
                        Si, purtroppo non è corretto !!!
                        Ci riprovo stasera.
                        Alla faccia della semplicità di EasyScript.
                        Saluti
                        Massimo
                        Ciao maxmax a quanto pare dobbiamo solo aspettare lunedì perchè Tiziano ha comunicato che l\'indicatore lo hanno già incluso nella prossima versione http://www.playoptions.it/vbforum/sh...ll=1#post65695 peccato però perchè mancava veramente poco!!!

                        Comment

                        • Smash
                          Senior Member

                          • Feb 2012
                          • 351

                          #13
                          Salve a tutti,

                          con la nuova Release 0.8.10.15 di beeTrader l\'indicatore Pivot Points è stato inserito bello e pronto tra gli indicatori disponibili, per cui il problema non si pone più!


                          Tuttavia, dato che sono finalmente riuscito a calcolare il massimo ed il minimo del giorno precedente, sperando di fare cosa gradita per chi come me si sta cimentando nella programmazione in EasyScript, desidero postare a puro titolo di esempio il codice di questo indicatore che plotta rispettivamente la chiusura, il massimo ed il minimo del giorno precedente, ovvero i 3 vettori che servivano per poter calcolare i Pivot Points.


                          Codice:
                          # Individuazione del cambiamento di data
                          SET ConditionDateChange = DATE > REF(DATE, 1)
                          SET DateChange = IF(ConditionDateChange, 1, 0)
                          
                          # Individuazione numerica delle barre intraday giornaliere
                          SET BarsOfDay = LASTIF(ConditionDateChange)
                          SET Bars = BarsOfDay + 1
                          
                          # Calcolo della CHIUSURA del giorno precedente
                          SET PreviousDayClose = CHANGEIF(DateChange, REF(CLOSE, 1))
                          
                          # Calcolo del MASSIMO del giorno precedente
                          SET IntradayHigh = HighestHighValue(Bars)
                          SET PreviousDayHigh = CHANGEIF(DateChange, REF(IntradayHigh, 1))
                          
                          # Calcolo del MINIMO del giorno precedente
                          SET IntradayLow = LowestLowValue(Bars)
                          SET PreviousDayLow = CHANGEIF(DateChange, REF(IntradayLow, 1))
                          
                          
                          SET PLOT1 = PreviousDayClose
                          SET PLOT2 = PreviousDayHigh
                          SET PLOT3 = PreviousDayLow
                          
                          SET PLOTCOLOR1 = COLOR_LIGHT_YELLOW
                          SET PLOTCOLOR2 = COLOR_LIGHT_GREEN
                          SET PLOTCOLOR3 = COLOR_LIGHT_RED

                          Click image for larger version

Name:	Per Pivot.jpg
Views:	2
Size:	118.6 KB
ID:	149017

                          Comment

                          • Apocalips
                            Senior Member

                            • May 2011
                            • 2630

                            #14
                            Bravissimo Smash

                            L\' ho già inserito tra gli overlap

                            Click image for larger version

Name:	HLC.jpg
Views:	1
Size:	120.7 KB
ID:	149018

                            grazie
                            Last edited by Apocalips; 22-10-13, 23:48.
                            ....non si desidera ciò che è facile ottenere (Ovidio)....

                            Comment

                            • Cagalli Tiziano
                              Senior Member
                              • Dec 2007
                              • 11252

                              #15
                              Originariamente Scritto da Smash
                              Salve a tutti,

                              con la nuova Release 0.8.10.15 di beeTrader l\'indicatore Pivot Points è stato inserito bello e pronto tra gli indicatori disponibili, per cui il problema non si pone più!


                              Tuttavia, dato che sono finalmente riuscito a calcolare il massimo ed il minimo del giorno precedente, sperando di fare cosa gradita per chi come me si sta cimentando nella programmazione in EasyScript, desidero postare a puro titolo di esempio il codice di questo indicatore che plotta rispettivamente la chiusura, il massimo ed il minimo del giorno precedente, ovvero i 3 vettori che servivano per poter calcolare i Pivot Points.


                              Codice:
                              # Individuazione del cambiamento di data
                              SET ConditionDateChange = DATE > REF(DATE, 1)
                              SET DateChange = IF(ConditionDateChange, 1, 0)
                              
                              # Individuazione numerica delle barre intraday giornaliere
                              SET BarsOfDay = LASTIF(ConditionDateChange)
                              SET Bars = BarsOfDay + 1
                              
                              # Calcolo della CHIUSURA del giorno precedente
                              SET PreviousDayClose = CHANGEIF(DateChange, REF(CLOSE, 1))
                              
                              # Calcolo del MASSIMO del giorno precedente
                              SET IntradayHigh = HighestHighValue(Bars)
                              SET PreviousDayHigh = CHANGEIF(DateChange, REF(IntradayHigh, 1))
                              
                              # Calcolo del MINIMO del giorno precedente
                              SET IntradayLow = LowestLowValue(Bars)
                              SET PreviousDayLow = CHANGEIF(DateChange, REF(IntradayLow, 1))
                              
                              
                              SET PLOT1 = PreviousDayClose
                              SET PLOT2 = PreviousDayHigh
                              SET PLOT3 = PreviousDayLow
                              
                              SET PLOTCOLOR1 = COLOR_LIGHT_YELLOW
                              SET PLOTCOLOR2 = COLOR_LIGHT_GREEN
                              SET PLOTCOLOR3 = COLOR_LIGHT_RED

                              [ATTACH=CONFIG]12429[/ATTACH]
                              Altrochè se è gradita!
                              Domani Andrea la copierà nell\'area degli script finiti, ci sono molti spunti interessanti per chi vorrà imparare ad utilizzare le funzioni.
                              ..se corri dietro a due lepri, non ne prendi nemmeno una.

                              Comment

                              Working...