Stampare solo per la giornata odierna

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #245204 quote
    Edisone
    Participant
    Average

    Salve chiedo aiuto per una modifica al codice. Quando la condizione ShowpastFibo = 0 dovrebbe disegnare le linee solo per la giornata odierna (es. future Stoxx , TF 30 muniti).

    ////
    //TF 30 minuti
    Time1=13000
    Time2=80000
    ShowpastFibo = 0
    ////
    IF (Time = Time1) OR ((Time > Time1) AND (Time[1] < Time1)) THEN
    Bar1 = barindex
    hh   = high
    ll   = low
    ENDIF
    hh = max(hh,high)
    ll = min(ll,low)
    IF (Time = Time2) OR ((Time > Time2) AND (Time[1] < Time2)) THEN
    Bar2 = BarIndex
    ENDIF
    IF Bar2 > Bar1 THEN
    // Punti di Fibonacci
    ORWidth = hh - ll
    FibMid = (hh + ll) / 2
    FibExtUp2 = hh + ORWidth * (0.272)
    FibExtDown2 = ll - ORWidth * (0.272)
    ///
    DrawRectangle(Bar1,hh,Bar2,ll) coloured(255,0,0,25) bordercolor(41,98,255,0) style(Line,2)
    drawsegment(Bar1,hh,Bar2,hh)coloured("red")style(line,1)
    drawsegment(Bar1,ll,Bar2,ll)coloured("green")style(line,1)
    drawsegment(Bar1,FibMid,Bar2,FibMid)coloured("blue")style(dottedline,1)
    drawsegment(Bar1,ll,Bar2,ll)coloured("green")style(line,1)
    ////
    IF ShowpastFibo = 1 THEN
    drawsegment(Bar1,FibExtDown2,barindex,FibExtDown2)coloured("green")style(dottedline,1)
    DRAWTEXT("27.2% #FibExtDown2#",Bar1-6,FibExtDown2,SansSerif,Bold,8)coloured("green")
    ////
    drawsegment(Bar1,FibExtUp2,barindex,FibExtUp2)coloured("red")style(dottedline,1)
    DRAWTEXT("27.2% #FibExtUp2#",Bar1-6,FibExtUp2,SansSerif,Bold,8)coloured("red")
    ////
     ELSE // SOLO GIORNO CORRENTE
    drawsegment(Bar1,FibExtDown2,barindex,FibExtDown2)coloured("green")style(dottedline,1)
    DRAWTEXT("27.2% #FibExtDown2#",Bar1-6,FibExtDown2,SansSerif,Bold,8)coloured("green")
    ////
    drawsegment(Bar1,FibExtUp2,barindex,FibExtUp2)coloured("red")style(dottedline,1)
    DRAWTEXT("27.2% #FibExtUp2#",Bar1-6,FibExtUp2,SansSerif,Bold,8)coloured("red")
    ENDIF
    Bar2 = 0
    ENDIF
    ///////
    return
    

    Grazie

    #245214 quote
    Iván González
    Moderator
    Master
    ////
    //TF 30 minuti
    Time1=13000
    Time2=80000
    ShowpastFibo = 0
    ////
    
    IF (openTime = Time1) OR ((openTime > Time1) AND (openTime[1] < Time1)) THEN
    Bar1 = barindex
    hh   = high
    ll   = low
    ENDIF
    
    hh = max(hh,high)
    ll = min(ll,low)
    IF (openTime = Time2) OR ((openTime > Time2) AND (openTime[1] < Time2)) THEN
    Bar2 = BarIndex
    // Punti di Fibonacci
    ORWidth = hh - ll
    FibMid = (hh + ll) / 2
    FibExtUp2 = hh + ORWidth * (0.272)
    FibExtDown2 = ll - ORWidth * (0.272)
    ENDIF
    
    IF ShowpastFibo = 1 and Bar2 > Bar1 THEN
    DrawRectangle(Bar1,hh,Bar2,ll) coloured(255,0,0,25) bordercolor(41,98,255,0) style(Line,2)
    drawsegment(Bar1,hh,Bar2,hh)coloured("red")style(line,1)
    drawsegment(Bar1,ll,Bar2,ll)coloured("green")style(line,1)
    drawsegment(Bar1,FibMid,Bar2,FibMid)coloured("blue")style(dottedline,1)
    drawsegment(Bar1,ll,Bar2,ll)coloured("green")style(line,1)
    drawsegment(Bar1,FibExtDown2,barindex,FibExtDown2)coloured("green")style(dottedline,1)
    DRAWTEXT("27.2% #FibExtDown2#",Bar1-6,FibExtDown2,SansSerif,Bold,8)coloured("green")
    ////
    drawsegment(Bar1,FibExtUp2,barindex,FibExtUp2)coloured("red")style(dottedline,1)
    DRAWTEXT("27.2% #FibExtUp2#",Bar1-6,FibExtUp2,SansSerif,Bold,8)coloured("red")
    
    Bar2 = 0
    elsif ShowpastFibo = 0 and islastbarupdate THEN
    DrawRectangle(Bar1,hh,barindex,ll) coloured(255,0,0,25) bordercolor(41,98,255,0) style(Line,2)
    drawsegment(bar1,hh,barindex,hh)coloured("red")style(line,1)
    drawsegment(Bar1,ll,barindex,ll)coloured("green")style(line,1)
    drawsegment(Bar1,FibMid,barindex,FibMid)coloured("blue")style(dottedline,1)
    drawsegment(Bar1,ll,barindex,ll)coloured("green")style(line,1)
    drawsegment(Bar1,FibExtDown2,barindex,FibExtDown2)coloured("green")style(dottedline,1)
    DRAWTEXT("27.2% #FibExtDown2#",Bar1-6,FibExtDown2,SansSerif,Bold,8)coloured("green")
    drawsegment(Bar1,FibExtUp2,barindex,FibExtUp2)coloured("red")style(dottedline,1)
    DRAWTEXT("27.2% #FibExtUp2#",Bar1-6,FibExtUp2,SansSerif,Bold,8)coloured("red")
    endif
    
    return
    Edisone thanked this post
    #245222 quote
    Edisone
    Participant
    Average

    Con ShowpastFibo = 1  hh e ll sono corretti mentre con ShowpastFibo = 0  hh e ll sono errati. Non capisco perchè.

    Mentre:

    elsif ShowpastFibo = 0 and islastbarupdate THEN
    DrawRectangle(Bar1,hh,barindex,ll) coloured(255,0,0,25) bordercolor(41,98,255,0) style(Line,2)
    drawsegment(bar1,hh,barindex,hh)coloured(“red”)style(line,1)
    barindex va sostituito con Bar2
    Grazie
    #245242 quote
    Iván González
    Moderator
    Master

    Perfetto, ora sì. Il problema era che hh e ll venivano ricalcolati sempre, mentre vogliamo che lo facciano solo tra time1 e time2.

    ////
    //TF 30 minuti
    Time1=13000
    Time2=80000
    ShowpastFibo = 0
    ////
    
    IF (openTime = Time1) OR ((openTime > Time1) AND (openTime[1] < Time1)) THEN
    Bar1 = barindex
    hh   = high
    ll   = low
    elsif opentime>time1 and opentime<=time2 then
    hh = max(hh,high)
    ll = min(ll,low)
    endif
    
    IF (openTime = Time2) OR ((openTime > Time2) AND (openTime[1] < Time2)) THEN
    Bar2 = BarIndex
    // Punti di Fibonacci
    ORWidth = hh - ll
    FibMid = (hh + ll) / 2
    FibExtUp2 = hh + ORWidth * (0.272)
    FibExtDown2 = ll - ORWidth * (0.272)
    ENDIF
    
    IF ShowpastFibo = 1 and Bar2 > Bar1 THEN
    DrawRectangle(Bar1,hh,Bar2,ll) coloured(255,0,0,25) bordercolor(41,98,255,0) style(Line,2)
    drawsegment(Bar1,hh,Bar2,hh)coloured("red")style(line,1)
    drawsegment(Bar1,ll,Bar2,ll)coloured("green")style(line,1)
    drawsegment(Bar1,FibMid,Bar2,FibMid)coloured("blue")style(dottedline,1)
    drawsegment(Bar1,ll,Bar2,ll)coloured("green")style(line,1)
    drawsegment(Bar1,FibExtDown2,barindex,FibExtDown2)coloured("green")style(dottedline,1)
    DRAWTEXT("27.2% #FibExtDown2#",Bar1-6,FibExtDown2,SansSerif,Bold,8)coloured("green")
    ////
    drawsegment(Bar1,FibExtUp2,barindex,FibExtUp2)coloured("red")style(dottedline,1)
    DRAWTEXT("27.2% #FibExtUp2#",Bar1-6,FibExtUp2,SansSerif,Bold,8)coloured("red")
    
    Bar2 = 0
    elsif ShowpastFibo = 0 and bar2>bar1 and islastbarupdate THEN
    
    DrawRectangle(Bar1,hh,bar2,ll) coloured(255,0,0,25) bordercolor(41,98,255,0) style(Line,2)
    drawsegment(bar1,hh,bar2,hh)coloured("red")style(line,1)
    drawsegment(Bar1,ll,bar2,ll)coloured("green")style(line,1)
    drawsegment(Bar1,FibMid,bar2,FibMid)coloured("blue")style(dottedline,1)
    drawsegment(Bar1,ll,bar2,ll)coloured("green")style(line,1)
    drawsegment(Bar1,FibExtDown2,bar2,FibExtDown2)coloured("green")style(dottedline,1)
    DRAWTEXT("27.2% #FibExtDown2#",Bar1-6,FibExtDown2,SansSerif,Bold,8)coloured("green")
    drawsegment(Bar1,FibExtUp2,bar2,FibExtUp2)coloured("red")style(dottedline,1)
    DRAWTEXT("27.2% #FibExtUp2#",Bar1-6,FibExtUp2,SansSerif,Bold,8)coloured("red")
    endif
    
    return
    Edisone thanked this post
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Stampare solo per la giornata odierna


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
Edisone @edisone Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by Iván González
10 months, 2 weeks ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 03/24/2025
Status: Active
Attachments: No files
Logo Logo
Loading...