Forums › ProRealTime forum Italiano › Supporto ProBuilder › Punti di swing statici › Reply To: Punti di swing statici
01/08/2017 at 8:11 PM
#20224
Ho modificato il codice un po ‘(da tradurre in inglese i parametri per la mia comprensione) e il testo aggiunto di sapere quando e dove i livelli di supporto e resistenza di prezzo dove trovano e tirato. Non esitate a correggere il codice se sbaglio! 🙂
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
DEFPARAM CalculateOnLastBars = 350 // To calculate the lines swing we take into consideration only the latest X candles n = 20 // highest and lowest period for support/resistance fetch tolerance = 5 // should be expressed in points) if there are two (or more) lines that are close to me, then you have to draw a center line lookback = 10 // period lookback to confirm support and resistance areas showSupport = 1//(0=false , 1=true) showResistance = 1 //(0=false , 1=true) once linear = 0 once lineas = 0 once newlinear = 0 once newlineas = 0 once newlinearr = 0 once newlineass = 0 if showResistance then resistance = highest[n](high) // resistance ( massimi precedenti dove i prezzi sono stati respinti) if resistance[n-lookback] = resistance[1] then linear = (resistance[1] + linear) / 2 else linear = linear endif if linear[2] = linear[1] and linear[1] = linear then newlinear = linear endif i = 0 valsup = newlinear + tolerance*pointsize valinf = newlinear - tolerance*pointsize while i <> 350 do if newlinear[i] = 0 then//aiuta ad accorciare il ciclo break endif cond = (newlinear[i] <= valsup and newlinear[i] >= valinf) or (newlineas[i] <= valsup and newlineas[i] >= valinf) if cond then newlinearr = (newlinear[i] + newlinear)/2 savedbar = barindex//[i] endif i = i+1 wend drawhline(newlinearr) coloured(0,125,255) if newlinearr<>oldtextr then drawtext("▼ #newlinearr#",savedbar,newlinearr) oldtextr=newlinearr endif endif if showSupport then support = lowest[n](low) // support ( minimi precedenti dove i prezzi sono stati rimbalzati) if support[n-lookback] = support[1] then lineas = (support[1] + lineas) / 2 else lineas = lineas endif if lineas[2] = lineas[1] and lineas[1] = lineas then newlineas = lineas endif i = 0 valsup = newlineas + tolerance*pointsize valinf = newlineas - tolerance*pointsize while i <> 350 do if newlineas[i] = 0 then//aiuta ad accorciare il ciclo break endif cond = (newlineas[i] <= valsup and newlineas[i] >= valinf) or (newlinear[i] <= valsup and newlinear[i] >= valinf) if cond then newlineass = (newlineas[i] + newlineas)/2 savedbar = barindex[i] endif i = i+1 wend drawhline(newlineass) coloured(0,125,255) if newlinearr<>oldtexts then drawtext("▲ #newlineass#",savedbar,newlineass) oldtexts=newlineass endif endif RETURN |