candlestick indicator

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #51257 quote
    abd78abd78
    Participant
    Veteran
    Ciao a tutti volevo fare in modo che questo indicatore qui:
    Candlestick patterns recognition
    invece che scrivere sul grafico con la direzione del pattern mi segni una barra (verde/rossa) in base alla direzione del pattern (freccia). se è esempio:  invece che:   Se si può anche che passando il cursore sopra la barra esca il nome del pattern. grazie e un saluto.
    #51258 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    Fare apparire una barra sotto il grafico dei prezzi è possibile, ma senza nome, l’unico tentativo da fare è diversificare i colori in base al pattern. Se può andarti bene ci provo. Roberto
    #51259 quote
    abd78abd78
    Participant
    Veteran
    si mi va benissimo grazie.
    #51265 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    Ho modificato l’originale, commentando le istruzioni inutilizzate per lasciare che tu possa riconoscerne il nome ed abbinarne i colori:
    DEFPARAM CalculateOnLastBars = 1000
    
    //text color
    // white = 255,255,255 ; black = 0,0,0
     
    //atr = averagetruerange[10](close)*0.5              //offset per il display di frecce e nomi sul grafico dei prezzi
    
    x = 0
    
    DojiSize = 0.05
    data=(abs(open - close) <= (high - low) * DojiSize)
    if data then
     x = 1
     r = 127
     g = 255
     b = 212
     //DRAWTEXT("Doji", barindex, high+atr, Dialog, Standard, 12) COLOURED(R,G,B)
    endif
     
    data2=(close[2] > open[2] and min(open[1], close[1]) > close[2] and open < min(open[1], close[1]) and close < open )
    if data2 then
     x = 1
     r = 255
     g = 228
     b = 196
     //DRAWTEXT("Evening Star", barindex, high[1]+atr*1.5, Dialog, Standard, 12) COLOURED(255,0,10)
     //DRAWARROWDOWN(barindex-1,high[1]) COLOURED(255,0,10)
    endif
     
    data3=(close[2] < open[2] and max(open[1], close[1]) < close[2] and open > max(open[1], close[1]) and close > open )
    if data3 then
     x = 1
     r = 165
     g = 42
     b = 42
     //DRAWTEXT("Morning Star", barindex, low[1]-atr*1.5, Dialog, Standard, 12) COLOURED(0,255,10)
     //DRAWARROWUP(barindex-1,low[1]) COLOURED(0,255,10)
    endif
     
    data4=(open[1] < close[1] and open > close[1] and high - max(open, close) >= abs(open - close) * 3 and min(close, open) - low <= abs(open - close))
    if data4 then
     x = 1
     r = 222
     g = 184
     b = 135
     //DRAWTEXT("Shooting Star", barindex, high+atr*1.5, Dialog, Standard, 12) COLOURED(255,0,10)
     //DRAWARROWDOWN(barindex,high) COLOURED(255,0,10)
    endif
     
    data5=(((high - low)>3*(open -close)) and  ((close - low)/(.001 + high - low) > 0.6) and ((open - low)/(.001 + high - low) > 0.6))
    if data5 then
     x = 1
     r = 95
     g = 158
     b = 160
     //DRAWTEXT("Hammer", barindex, high+atr, Dialog, Standard, 12) COLOURED(R,G,B)
    endif
     
    data5b=(((high - low)>3*(open -close)) and  ((high - close)/(.001 + high - low) > 0.6) and ((high - open)/(.001 + high - low) > 0.6))
    if data5b then
     x = 1
     r = 210
     g = 105
     b = 30
     //DRAWTEXT("Inverted Hammer", barindex, high+atr, Dialog, Standard, 12) COLOURED(R,G,B)
    endif
     
    data6=(close[1] > open[1] and open > close and open <= close[1] and open[1] <= close and open - close < close[1] - open[1] )
    if data6 then
     x = 1
     r = 255
     g = 127
     b = 80
     //DRAWTEXT("Bearish Harami", barindex, high+atr*1.5, Dialog, Standard, 12) COLOURED(255,0,10)
     //DRAWARROWDOWN(barindex,high) COLOURED(255,0,10)
    endif
     
    data7=(open[1] > close[1] and close > open and close <= open[1] and close[1] <= open and close - open < open[1] - close[1] )
    if data7 then
     x = 1
     r = 169
     g = 169
     b = 169
     //DRAWTEXT("Bullish Harami", barindex, low-atr*1.5, Dialog, Standard, 12) COLOURED(0,255,10)
     //DRAWARROWUP(barindex,low) COLOURED(0,255,10)
    endif
     
    data8=(close[1] > open[1] and open > close and open >= close[1] and open[1] >= close and open - close > close[1] - open[1] )
    if data8 then
     x = 1
     r = 34
     g = 139
     b = 34
     //DRAWTEXT("Bearish Engulfing", barindex, high+atr*1.5, Dialog, Standard, 12) COLOURED(255,0,10)
     //DRAWARROWDOWN(barindex,high) COLOURED(255,0,10)
    endif
     
    data9=(open[1] > close[1] and close > open and close >= open[1] and close[1] >= open and close - open > open[1] - close[1] )
    if data9 then
     x = 1
     r = 255
     g = 0
     b = 255
     //DRAWTEXT("Bullish Engulfing", barindex, low-atr*1.5, Dialog, Standard, 12) COLOURED(0,255,10)
     //DRAWARROWUP(barindex,low) COLOURED(0,255,10)
    endif
     
    data10=(close[1] < open[1] and  open < low[1] and close > close[1] + ((open[1] - close[1])/2) and close < open[1])
    if data10 then
     x = 1
     r = 255
     g = 215
     b = 0
     //DRAWT0EXT("Piercing Line", barindex, low-atr*1.5, Dialog, Standard, 12) COLOURED(0,255,10)
     //DRAWARROWUP(barindex,low) COLOURED(0,255,10)
    endif
     
    data14=(((high-low>4*(open-close))and((close-low)/(.001+high-low)>=0.75)and((open-low)/(.001+high-low)>=0.75)) and high[1] < open and high[2] < open)
    if data14 then
     x = 1
     r = 128
     g = 128
     b = 128
     //DRAWTEXT("Hanging Man", barindex, high+atr*1.5, Dialog, Standard, 12) COLOURED(255,0,10)
     //DRAWARROWDOWN(barindex,high) COLOURED(255,0,10)
    endif
     
    data15=((close[1]>open[1])and(((close[1]+open[1])/2)>close)and(open>close)and(open>close[1])and(close>open[1])and((open-close)/(.001+(high-low))>0.6))
    if data15 then
     x = 1
     r = 238
     g = 130
     b = 238
     //DRAWTEXT("Dark Cloud Cover", barindex, high+atr*1.5, Dialog, Standard, 12) COLOURED(255,0,10)
     //DRAWARROWDOWN(barindex,high) COLOURED(255,0,10)
    endif
     
    RETURN x COLOURED(r,g,b) STYLE(histogram,1)
    Non è gran che, anche perché ne vengono stampate troppe e ti confondono, inoltre devi avere la tabella dei colori sottomano o scrivertene una tu da tenere sempre vicino a te. Un suggerimento che ti do è quello di eliminare i pattern che non ti interessano ed eventualmente di variarne le caratteristiche, in modo da ridurli e renderli visivamente più distinguibili. Ma questa è una tua scelta e potrai utilizzarlo come esercizio per fare pratica. Ricordati di fare sempre copie di salvataggio prima di fare modifiche. Allego anche il file .ITF che puoi importare nella piattaforma. Roberto
    Candlestick-Patterns-bars.itf
    #51363 quote
    abd78abd78
    Participant
    Veteran
    grazie roberto, volevo chiederti per semplificare il tutto (visto che dovrei segnarmi i colori ecc..) se si poteva fare un barra verde quando il pattern indica buy e rosso quando indica sell. (così ho una barra come l’indicatore divergense rsi, anche solo su una fila come fatto con questo va bene così guadagno spazio). grazie
    #51369 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    Intanto questo è il link alla tabella dei colori (mi ero dimenticato di segnalartelo): https://www.prorealcode.com/documentation/coloured/ (dopo avere aperta la pagina clicca poi sull’immagine per vedere bene i codici, magari te li stampi). Quindi non vuoi più colori diversi per ogni tipo di pattern, ma solo VERDE se rialzista e ROSSO se ribassista, ho interpretato bene?
    #51400 quote
    abd78abd78
    Participant
    Veteran
    si esatto, per i pattern tipo l’hammer o l’inverted si potrebbe fare una barra nera, tu che dici?
    #51443 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    Cambiare i colori non è difficile, basta che sostituisci r (rosso), g (verde) e b (blue) con i colori che preferisci, presi dalla tabella di cui sopra. Anche perché devi essere tu a stabilire quali Pattern sono Rialzisti o Ribassisti, ad esempio il DOJI. Ad ogni modo, se vuoi cambiare, ad esempio, l’Inverted Hammer devi variare la parte di codice che va dalle righe 59 a 66 (io ho lasciato i vecchi nomi proprio per poterle facilmenre identificare), per il NERO basterà che le righe 62, 63 e 64 diventino:
     r = 0      //Red (rosso)
     g = 0      //Green (verde)
     b = 0      //Blue (blù)
    #53046 quote
    abd78abd78
    Participant
    Veteran
    DEFPARAM CalculateOnLastBars = 1000
    
    //text color
    // white = 255,255,255 ; black = 0,0,0
     
    //atr = averagetruerange[10](close)*0.5              //offset per il display di frecce e nomi sul grafico dei prezzi
    
    x = 0
    
    DojiSize = 0.05
    data=(abs(open - close) <= (high - low) * DojiSize)
    if data then
     x = 1
     r = 127
     g = 255
     b = 212
     //DRAWTEXT("Doji", barindex, high+atr, Dialog, Standard, 12) COLOURED(R,G,B)
    endif
     
    data2=(close[2] > open[2] and min(open[1], close[1]) > close[2] and open < min(open[1], close[1]) and close < open )
    if data2 then
     x = 1
     r = 255
     g = 228
     b = 196
     //DRAWTEXT("Evening Star", barindex, high[1]+atr*1.5, Dialog, Standard, 12) COLOURED(255,0,10)
     //DRAWARROWDOWN(barindex-1,high[1]) COLOURED(255,0,10)
    endif
     
    data3=(close[2] < open[2] and max(open[1], close[1]) < close[2] and open > max(open[1], close[1]) and close > open )
    if data3 then
     x = 1
     r = 165
     g = 42
     b = 42
     //DRAWTEXT("Morning Star", barindex, low[1]-atr*1.5, Dialog, Standard, 12) COLOURED(0,255,10)
     //DRAWARROWUP(barindex-1,low[1]) COLOURED(0,255,10)
    endif
     
    data4=(open[1] < close[1] and open > close[1] and high - max(open, close) >= abs(open - close) * 3 and min(close, open) - low <= abs(open - close))
    if data4 then
     x = 1
     r = 222
     g = 184
     b = 135
     //DRAWTEXT("Shooting Star", barindex, high+atr*1.5, Dialog, Standard, 12) COLOURED(255,0,10)
     //DRAWARROWDOWN(barindex,high) COLOURED(255,0,10)
    endif
     
    data5=(((high - low)>3*(open -close)) and  ((close - low)/(.001 + high - low) > 0.6) and ((open - low)/(.001 + high - low) > 0.6))
    if data5 then
     x = 1
     r = 95
     g = 158
     b = 160
     //DRAWTEXT("Hammer", barindex, high+atr, Dialog, Standard, 12) COLOURED(R,G,B)
    endif
     
    data5b=(((high - low)>3*(open -close)) and  ((high - close)/(.001 + high - low) > 0.6) and ((high - open)/(.001 + high - low) > 0.6))
    if data5b then
     x = 1
     r = 210
     g = 105
     b = 30
     //DRAWTEXT("Inverted Hammer", barindex, high+atr, Dialog, Standard, 12) COLOURED(R,G,B)
    endif
     
    data6=(close[1] > open[1] and open > close and open <= close[1] and open[1] <= close and open - close < close[1] - open[1] )
    if data6 then
     x = 1
     r = 255
     g = 127
     b = 80
     //DRAWTEXT("Bearish Harami", barindex, high+atr*1.5, Dialog, Standard, 12) COLOURED(255,0,10)
     //DRAWARROWDOWN(barindex,high) COLOURED(255,0,10)
    endif
     
    data7=(open[1] > close[1] and close > open and close <= open[1] and close[1] <= open and close - open < open[1] - close[1] )
    if data7 then
     x = 1
     r = 169
     g = 169
     b = 169
     //DRAWTEXT("Bullish Harami", barindex, low-atr*1.5, Dialog, Standard, 12) COLOURED(0,255,10)
     //DRAWARROWUP(barindex,low) COLOURED(0,255,10)
    endif
     
    data8=(close[1] > open[1] and open > close and open >= close[1] and open[1] >= close and open - close > close[1] - open[1] )
    if data8 then
     x = 1
     r = 34
     g = 139
     b = 34
     //DRAWTEXT("Bearish Engulfing", barindex, high+atr*1.5, Dialog, Standard, 12) COLOURED(255,0,10)
     //DRAWARROWDOWN(barindex,high) COLOURED(255,0,10)
    endif
     
    data9=(open[1] > close[1] and close > open and close >= open[1] and close[1] >= open and close - open > open[1] - close[1] )
    if data9 then
     x = 1
     r = 255
     g = 0
     b = 255
     //DRAWTEXT("Bullish Engulfing", barindex, low-atr*1.5, Dialog, Standard, 12) COLOURED(0,255,10)
     //DRAWARROWUP(barindex,low) COLOURED(0,255,10)
    endif
     
    data10=(close[1] < open[1] and  open < low[1] and close > close[1] + ((open[1] - close[1])/2) and close < open[1])
    if data10 then
     x = 1
     r = 255
     g = 215
     b = 0
     //DRAWT0EXT("Piercing Line", barindex, low-atr*1.5, Dialog, Standard, 12) COLOURED(0,255,10)
     //DRAWARROWUP(barindex,low) COLOURED(0,255,10)
    endif
     
    data14=(((high-low>4*(open-close))and((close-low)/(.001+high-low)>=0.75)and((open-low)/(.001+high-low)>=0.75)) and high[1] < open and high[2] < open)
    if data14 then
     x = 1
     r = 128
     g = 128
     b = 128
     //DRAWTEXT("Hanging Man", barindex, high+atr*1.5, Dialog, Standard, 12) COLOURED(255,0,10)
     //DRAWARROWDOWN(barindex,high) COLOURED(255,0,10)
    endif
     
    data15=((close[1]>open[1])and(((close[1]+open[1])/2)>close)and(open>close)and(open>close[1])and(close>open[1])and((open-close)/(.001+(high-low))>0.6))
    if data15 then
     x = 1
     r = 238
     g = 130
     b = 238
     //DRAWTEXT("Dark Cloud Cover", barindex, high+atr*1.5, Dialog, Standard, 12) COLOURED(255,0,10)
     //DRAWARROWDOWN(barindex,high) COLOURED(255,0,10)
    endif
     
    RETURN x COLOURED(r,g,b) STYLE(histogram,1)

    non mi funziona quando lo importo

    #53050 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Ho fatto il copia e Incolla della tua versione qui sopra e funziona perfettamente.

    L’ho esportato e lo allego.

    Prova a reimportare questo, altrimenti crealo facendo il Copia e Incolla anche tu, sai come farlo?

     

     

    My-Candlestick-Indicator.itf
    #53058 quote
    abd78abd78
    Participant
    Veteran

    perfetto, ora è andato.

    grazie mille 

Viewing 11 posts - 1 through 11 (of 11 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

candlestick indicator


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
abd78 @fede9483 Participant
Summary

This topic contains 10 replies,
has 2 voices, and was last updated by abd78abd78
8 years, 11 months ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 11/01/2017
Status: Active
Attachments: 2 files
ProRealCode ProRealCode
Loading...