Colore candele in base al trend
Forums › ProRealTime forum Italiano › Supporto ProBuilder › Colore candele in base al trend
- This topic has 6 replies, 2 voices, and was last updated 2 days ago by
JS.
-
-
09/10/2025 at 6:07 PM #250652
Buonasera, è possibile colorare le candele del grafico in base ad un trend come potrebbe essere un semplice incrocio di due medie mobili? Candele per es. sempre verdi fintanto che la mm a 20 periodi sta sopra la mm a 50 e rosse viceversa? Che comandi devo usare? Grazie.
09/10/2025 at 6:27 PM #250653Ciao,
Prova questi…
Candles Coloured12345678910FastAvg=Average[20,0](Close)SlowAvg=Average[50,0](Close)If FastAvg>=SlowAvg thenDrawCandle(Open,High,Low,Close) Coloured("Green")ElseDrawCandle(Open,High,Low,Close) Coloured("Red")EndIfReturn FastAvg as "FastAvg" Coloured("Red"), SlowAvg as "SlowAvg" Coloured("Green")1 user thanked author for this post.
09/10/2025 at 6:34 PM #25065509/10/2025 at 7:05 PM #250658Scusami un’ultima cosa, volessi farlo con due coppie di mm (quindi 4) anzichè due soltanto, come verrebbe implementato il codice? Esempio: colorare le candele del grafico verdi fintanto che (per es.) la mm a 5 e la mm a 10 periodi sono tutte e due sopra le mm a 30 e 35 e rosse viceversa? Grazie infinite.
09/10/2025 at 7:23 PM #250659No problema… 🙂
Candles Coloured V212345678910111213SuperFastAvg=Average[5,0](Close)FastAvg=Average[10,0](Close)SlowAvg=Average[30,0](Close)SuperSlowAvg=Average[35,0](Close)If SuperFastAvg>=SuperSlowAvg and SuperFastAvg>=SlowAvg and FastAvg>=SuperSlowAvg and FastAvg>=SlowAvg thenDrawCandle(Open,High,Low,Close) Coloured("Green")ElseDrawCandle(Open,High,Low,Close) Coloured("Red")EndIfReturn SuperFastAvg as "SuperFastAvg" Coloured("Red"),FastAvg as "FastAvg" Coloured("Red"),SuperSlowAvg as "SuperSlowAvg" Coloured("Green"), SlowAvg as "SlowAvg" Coloured("Green")2 users thanked author for this post.
09/10/2025 at 8:35 PM #250663Ottimo, ma esiste anche la possibilità poi non disturbo veramente più, che si possa avere un codice dove le candele restano in trend (cioè per es. sempre colorate di verde) anche quando solo 1 condizione su x condizioni resta in piedi. Mi spiego meglio: trend che resta al rialzo (quindi candele verdi) quando la candela chiude sopra anche solo una delle per es. 4 mm prese in considerazione. Esplicito ulteriormente: Il trend deve rimanere rialzista fintanto che la chiusura della candela resta sopra anche ad una sola delle mm (a 5 o a 10 o a 30 o a 35 periodi), basta che resti anche sopra una mm soltanto delle 4 che la candela deve restare verde, per diventare rossa serve che la chiusura sia inferiore a tutte e 4 le mm.
09/10/2025 at 9:07 PM #250664Esatto, puoi programmare tutte le combinazioni usando le “istruzioni condizionali”…
Candles Coloured V312345678910111213SuperFastAvg=Average[5,0](Close)FastAvg=Average[10,0](Close)SlowAvg=Average[30,0](Close)SuperSlowAvg=Average[35,0](Close)If Close>=SuperFastAvg or Close>=FastAvg or Close>=SlowAvg or Close>=SuperSlowAvg thenDrawCandle(Open,High,Low,Close) Coloured("Green")ElsIf Close<SuperFastAvg and Close<FastAvg and Close<SlowAvg and Close<SuperSlowAvg thenDrawCandle(Open,High,Low,Close) Coloured("Red")EndIfReturn SuperFastAvg as "SuperFastAvg" Coloured("Red"),FastAvg as "FastAvg" Coloured("Red"),SuperSlowAvg as "SuperSlowAvg" Coloured("Green"), SlowAvg as "SlowAvg" Coloured("Green")1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on