Pendenza/Angolo Medie Mobili

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #73981 quote
    HendrixHendrix
    Participant
    Senior

    Buongiorno,

    è possibile che una media mobile o TEMA cambi colore quando raggiunge una pendenza o angolo di  +/-40° ad esempio.

    Grazie

    #73998 quote
    NicolasNicolas
    Keymaster
    Legend

    Poiché è quasi impossibile ottenere il grado reale di una media mobile (dipende dalla risoluzione dello schermo e dallo zoom), ho creato questo codice con una normalizzazione del TEMA da parte di un ATR. In questo modo possiamo calcolare i livelli per innescare o meno il cambiamento del colore a seconda della pendenza. Spero che soddisfi le tue esigenze.

    defparam drawonlastbaronly=true
    
    // --- settings
    eintPeriod = 50
    edblHigh1 = 0.04
    edblLow1 = -0.04
    atrPeriod = 100
    // --- end of settings
    
    atr = AverageTrueRange[atrPeriod](close)
    
    dblTma = tema[eintPeriod](close)
    
    if barindex>eintPeriod then
    dblPrev = dblTma[1]
    gadblSlope = ( dblTma - dblPrev ) / atr
    
    if ( gadblSlope[0] > edblHigh1 ) then
    if(gadblSlope[0] < gadblSlope[1]) then
    r=0
    g=128
    b=0
    else
    r=0
    g=255
    b=0
    endif
    elsif ( gadblSlope[0] < edblLow1 ) then
    if(gadblSlope[0] < gadblSlope[1]) then
    r=255
    g=0
    b=0
    else
    r=178
    g=34
    b=34
    endif
    else
    if(gadblSlope[0] < gadblSlope[1]) then
    r=0
    g=128
    b=128
    else
    r=255
    g=105
    b=180
    endif
    endif
    endif
    
    
     
    return dbltma coloured(r,g,b) style(line,3)
    MA-slope-coloured.png MA-slope-coloured.png
    #74001 quote
    HendrixHendrix
    Participant
    Senior

    Buongiorno Nicolas,

    e grazie come sempre, sembra funzionare ma come posso variare il colore,

    ad esempio verde rialzo, rosso ribasso e viola quando la pendenza raggiunge +/- 40°?

     

    Grazie

    #74020 quote
    NicolasNicolas
    Keymaster
    Legend

    Come ho affermato nel mio precedente messaggio, la ricerca di un diploma non è possibile su un grafico e non precisa … Puoi cambiare il trigger per cambiare colore con il
    edblHigh1 = 0,04
    edblLow1 = -0.04

    Puoi cambiare il colore della linea con le variabili R, G e B nel codice.

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Pendenza/Angolo Medie Mobili


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
Hendrix @hendrix Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by NicolasNicolas
8 years, 3 months ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 06/22/2018
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...