Indicatore senza dati del fine settimana

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #99500 quote
    Hendrix
    Participant
    Senior

    Buongiorno,

    ho un indicatore che determina degli obbiettivi in base alla max e min del giorno precedente,

    funziona correttamente tutti i giorni tranne il lunedì in quanto reperisce il min e max della domenica (è utilizzato su IG con i cfd).

    Sarebbe possibile farlo funzionare solo dal lunedì al venerdì?

    In questo modo avrei gli obbiettivi corretti calcolati sul venerdì il lunedì mattina?

     

    Grazie

    defparam calculateonlastbars=3000
    ONCE Prec1730 = close
    ONCE Prec2200 = close
    IF opentime = 080000 THEN
    Apertura = open
    ENDIF
    IF opentime = 173000 THEN
    Oggi1730 = close
    ENDIF
    IF opentime = 220000 THEN
    Oggi2200 = close
    ENDIF
    IF IntraDayBarIndex = 0 THEN
    Prec1730 = Oggi1730
    Prec2200 = Oggi2200
    ENDIF
    NumeroBarra = 2
    IF OpenDayOfWeek > 1 THEN
    NumeroBarra = 1
    ENDIF
    MaxGiornoPrec = Dhigh(NumeroBarra)
    MinGiornoPrec = Dlow(NumeroBarra)
    
    Pivot    = (DHigh(1) + DLow(1) + DClose(1))/3  //Pivot
    Res1    = (2*Pivot) - DLow(1)                  //Res1
    Sup1    = (2*Pivot) - DHigh(1)                 //Sup1
    Ob1  = Apertura + ((Res1 - Sup1) *0.3)
    Ob2 = Apertura - ((Res1 - Sup1) *0.3)
    Ob3  = Apertura + ((Res1 - Sup1) *0.5)
    Ob4 = Apertura - ((Res1 - Sup1) *0.5)
    
    RETURN MaxGiornoPrec COLOURED(0,255,0) AS "MaxGGprec",MinGiornoPrec COLOURED(255,0,0) AS "MinGGprec",Prec1730 COLOURED(0,255,255) AS "17:30 prec",Prec2200 COLOURED(0,255,255) STYLE(dottedline,3) AS "22:00 prec",Apertura COLOURED(255,0,255) STYLE(dottedline,3) AS "Apertura",Ob1 COLOURED(255,0,255) AS "Obbiettivo1",Ob2 COLOURED(255,0,255) AS "Obbiettivo2", Ob3 COLOURED(255,0,255) AS "Obbiettivo3",Ob4 COLOURED(255,0,255) AS "Obbiettivo4"
    #99501 quote
    Nicolas
    Keymaster
    Master

    “aiuto su indicatore” , che bella idea per un titolo!

    #99506 quote
    Hendrix
    Participant
    Senior

    😉

    #99508 quote
    robertogozzi
    Moderator
    Master

    Si, in effetti il titolo è opportuno che suggerisca meglio ciò di cui si tratta, anche perché è più facile che qualcuno sia interessato a rispondere, oltre a facilitare le ricerche. L’ho cambiato io.

    Il codice aggiornato per funzionare dal lunedì al venerdì è:

    defparam calculateonlastbars=3000
    ONCE Prec1730 = close
    ONCE Prec2200 = close
    IF OpenDayOfWeek >= 1 AND OpenDayOfWeek <= 5 THEN      //Lunedì - Venerdì
       IF opentime = 080000 THEN
          Apertura = open
       ENDIF
       IF opentime = 173000 THEN
          Oggi1730 = close
       ENDIF
       IF opentime = 220000 THEN
          Oggi2200 = close
       ENDIF
       IF IntraDayBarIndex = 0 THEN
          Prec1730 = Oggi1730
          Prec2200 = Oggi2200
       ENDIF
       NumeroBarra = 2
          IF OpenDayOfWeek > 1 THEN
          NumeroBarra = 1
       ENDIF
       MaxGiornoPrec = Dhigh(NumeroBarra)
       MinGiornoPrec = Dlow(NumeroBarra)
    ENDIF
    
    Pivot    = (DHigh(1) + DLow(1) + DClose(1))/3  //Pivot
    Res1    = (2*Pivot) - DLow(1)                  //Res1
    Sup1    = (2*Pivot) - DHigh(1)                 //Sup1
    Ob1  = Apertura + ((Res1 - Sup1) *0.3)
    Ob2 = Apertura - ((Res1 - Sup1) *0.3)
    Ob3  = Apertura + ((Res1 - Sup1) *0.5)
    Ob4 = Apertura - ((Res1 - Sup1) *0.5)
    
    RETURN MaxGiornoPrec COLOURED(0,255,0) AS "MaxGGprec",MinGiornoPrec COLOURED(255,0,0) AS "MinGGprec",Prec1730 COLOURED(0,255,255) AS "17:30 prec",Prec2200 COLOURED(0,255,255) STYLE(dottedline,3) AS "22:00 prec",Apertura COLOURED(255,0,255) STYLE(dottedline,3) AS "Apertura",Ob1 COLOURED(255,0,255) AS "Obbiettivo1",Ob2 COLOURED(255,0,255) AS "Obbiettivo2", Ob3 COLOURED(255,0,255) AS "Obbiettivo3",Ob4 COLOURED(255,0,255) AS "Obbiettivo4"
    #99509 quote
    robertogozzi
    Moderator
    Master

    Non l’ho provato, semmai sposta la riga 24 (ENDIF) alla 33, magari aggiungendo tre spazi iniziali alle righe 26-32 ma questo non è necessario.

    #99510 quote
    Hendrix
    Participant
    Senior

    Non funziona è uguale a prima.

     

    Saluti

    #99513 quote
    robertogozzi
    Moderator
    Master

    Allega una foto del grafico, indicando:

    • strumento
    • TF
    • date di riferimento
    • valori corretti che avrebbero dovuto essere visualizzati
    #99514 quote
    Hendrix
    Participant
    Senior

    Buongiorno,

    come vedi viene correttamente rappresentato l’apertura delle 7 e il min e max riferito al 24/05/2019 (venerdì), ma le linee obb.1/2/3/4 sono errate.

    DAX-5-Minuti.png DAX-5-Minuti.png
    #99516 quote
    robertogozzi
    Moderator
    Master

    Questo perché il lunedì gli hai indicato (1) con DCLOSE….., quindi il giorno precedenbte che è domenica, mentre deve essere indicato (2) per fargli prendere i dati del venerdì. Le righe 26-28 scrivile così, aggiungendo prima le altre 4:

    x = 1
    IF OpenDayOfWeek = 1 THEN
       x = 2
    ENDIF
    Pivot   = (DHigh(x) + DLow(x) + DClose(x))/3  //Pivot
    Res1    = (2*Pivot) - DLow(x)                  //Res1
    Sup1    = (2*Pivot) - DHigh(x)                 //Sup1
    #99517 quote
    Hendrix
    Participant
    Senior

    Perfetto Grazie !!!!!!!!!!

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

Indicatore senza dati del fine settimana


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
Hendrix @hendrix Participant
Summary

This topic contains 9 replies,
has 3 voices, and was last updated by Hendrix
6 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 05/27/2019
Status: Active
Attachments: 1 files
Logo Logo
Loading...