Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------- Lezione 28 Personale Plottare PiΓΉ Condizioni Buleane Iniseme ------------------------//
- // Il buleano ritorna il valore di 1
- // Con buleano true and buleano true avremo 1 true and 1 true
- // Con bgcolor plottiamo se entrambe le condizioni contemporeneamente sono vere
- // upBar = close > open
- // threeUpBars = upBar and upBar[1] and upBar[2]
- // bgcolor(threeUpBars ? color.new(color.green, 80) : na, title="upBar", offset=0)
- //------------ Altro modo per fare la stessa cosa --------------------//
- // Con la seguente formula: math.sum(upBar ? 1 : 0, 3) == 3
- // Sommiano tutti i true e inserendo poi :0,"numero di condizioni per i true" esempio: 0, 3
- // con == "numero di condizioni per i true che vogliamo in output", esempio: 3
- // otteniamo la stessa verifica
- //which produces a value of 1 every time the upBar boolean variable is true,
- //and adds the number of those values for the last 3 bars. When that rolling sum equals 3, threeUpBars is true.
- upBar = close > open
- threeUpBars = upBar and upBar[1] and upBar[2]
- threeUpBars = math.sum(upBar ? 1 : 0, 3) == 3
- bgcolor(threeUpBars ? color.new(color.green, 80) : na, title="threeUpBars", offset=0)
- //------------ Altro Esempio --------------------//
- // Possiamo anche usare gli operatori logici come output
- upBar = close > open
- only_seven_Up_bar_of_ten = math.sum(upBar ? 1 : 0,10) >=7
- bgcolor(only_seven_Up_bar_of_ten ? color.new(color.green, 80) : na, title="only_seven_Up_bar_of_ten", offset=0)
Add Comment
Please, Sign In to add comment