PPK Tradingview
Forums › ProRealTime forum Français › Support ProBuilder › PPK Tradingview
- This topic has 29 replies, 4 voices, and was last updated 3 years ago by Nicolas.
-
-
09/23/2017 at 4:03 PM #47076
Bonjour,
Une bonne âme pour traduire ce code relevé sur Tradingview :
PPK Tradingview123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105// PPK Tradingviewstudy(title = "Pekipek's PPO Divergence BETA", shorttitle = "PP's_PPO_DIV")source = closelong_term_div = input(true, title="Use long term Divergences?")div_lookback_period = input(55, minval=1, title="Lookback Period")fastLength = input(12, minval=1), slowLength=input(26,minval=1)signalLength=input(9,minval=1)smoother = input(2,minval=1)fastMA = ema(source, fastLength)slowMA = ema(source, slowLength)macd = fastMA - slowMAmacd2=(macd/slowMA)*100d = sma(macd2, smoother) // smoothing PPObullishPrice = lowpriceMins = bullishPrice > bullishPrice[1] and bullishPrice[1] < bullishPrice[2] orlow[1] == low[2] and low[1] < low and low[1] < low[3] orlow[1] == low[2] and low[1] == low[3] and low[1] < low and low[1] < low[4] orlow[1] == low[2] and low[1] == low[3] and low[1] and low[1] == low[4] and low[1] < low and low[1] < low[5] // this line identifies bottoms and plateaus in the priceoscMins= d > d[1] and d[1] < d[2] // this line identifies bottoms in the PPOBottomPointsInPPO = oscMinsbearishPrice = highpriceMax = bearishPrice < bearishPrice[1] and bearishPrice[1] > bearishPrice[2] orhigh[1] == high[2] and high[1] > high and high[1] > high[3] orhigh[1] == high[2] and high[1] == high[3] and high[1] > high and high[1] > high[4] orhigh[1] == high[2] and high[1] == high[3] and high[1] and high[1] == high[4] and high[1] > high and high[1] > high[5] // this line identifies tops in the priceoscMax = d < d[1] and d[1] > d[2] // this line identifies tops in the PPOTopPointsInPPO = oscMaxcurrenttrough4=valuewhen (oscMins, d[1], 0) // identifies the value of PPO at the most recent BOTTOM in the PPOlasttrough4=valuewhen (oscMins, d[1], 1) // NOT USED identifies the value of PPO at the second most recent BOTTOM in the PPOcurrenttrough5=valuewhen (oscMax, d[1], 0) // identifies the value of PPO at the most recent TOP in the PPOlasttrough5=valuewhen (oscMax, d[1], 1) // NOT USED identifies the value of PPO at the second most recent TOP in the PPOcurrenttrough6=valuewhen (priceMins, low[1], 0) // this line identifies the low (price) at the most recent bottom in the Pricelasttrough6=valuewhen (priceMins, low[1], 1) // NOT USED this line identifies the low (price) at the second most recent bottom in the Pricecurrenttrough7=valuewhen (priceMax, high[1], 0) // this line identifies the high (price) at the most recent top in the Pricelasttrough7=valuewhen (priceMax, high[1], 1) // NOT USED this line identifies the high (price) at the second most recent top in the Pricedelayedlow = priceMins and barssince(oscMins) < 3 ? low[1] : nadelayedhigh = priceMax and barssince(oscMax) < 3 ? high[1] : na// only take tops/bottoms in price when tops/bottoms are less than 5 bars awayfilter = barssince(priceMins) < 5 ? lowest(currenttrough6, 4) : nafilter2 = barssince(priceMax) < 5 ? highest(currenttrough7, 4) : na//delayedbottom/top when oscillator bottom/top is earlier than price bottom/topy11 = valuewhen(oscMins, delayedlow, 0)y12 = valuewhen(oscMax, delayedhigh, 0)// only take tops/bottoms in price when tops/bottoms are less than 5 bars away, since 2nd most recent top/bottom in oscy2=valuewhen(oscMax, filter2, 1) // identifies the highest high in the tops of price with 5 bar lookback period SINCE the SECOND most recent top in PPOy6=valuewhen(oscMins, filter, 1) // identifies the lowest low in the bottoms of price with 5 bar lookback period SINCE the SECOND most recent bottom in PPOlong_term_bull_filt = valuewhen(priceMins, lowest(div_lookback_period), 1)long_term_bear_filt = valuewhen(priceMax, highest(div_lookback_period), 1)y3=valuewhen(oscMax, currenttrough5, 0) // identifies the value of PPO in the most recent top of PPOy4=valuewhen(oscMax, currenttrough5, 1) // identifies the value of PPO in the second most recent top of PPOy7=valuewhen(oscMins, currenttrough4, 0) // identifies the value of PPO in the most recent bottom of PPOy8=valuewhen(oscMins, currenttrough4, 1) // identifies the value of PPO in the SECOND most recent bottom of PPOy9=valuewhen(oscMins, currenttrough6, 0)y10=valuewhen(oscMax, currenttrough7, 0)bulldiv= BottomPointsInPPO ? d[1] : na // plots dots at bottoms in the PPObeardiv= TopPointsInPPO ? d[1]: na // plots dots at tops in the PPOi = currenttrough5 < highest(d, div_lookback_period) // long term bearish oscilator divergencei2 = y10 > long_term_bear_filt // long term bearish top divergencei3 = delayedhigh > long_term_bear_filt // long term bearish delayedhigh divergencei4 = currenttrough4 > lowest(d, div_lookback_period) // long term bullish osc divergencei5 = y9 < long_term_bull_filt // long term bullish bottom divi6 = delayedlow < long_term_bull_filt // long term bullish delayedbottom divplot(d, color=white)plot(bulldiv, title = "Tops", color=aqua, style=circles, linewidth=4, offset= -1)plot(beardiv, title = "Bottoms", color=red, style=circles, linewidth=4, offset= -1)plot(y10>y2 and oscMax and y3 < y4 ? d :na, title = "Bearish Divergence2", color=orange, style= circles, linewidth=4)plot(y9<y6 and oscMins and y7 > y8 ? d :na, title = "Bullish Divergence2", color=purple, style=circles, linewidth=4)plot(delayedlow<y6 and y7 > y8 ? d :na, title = "Bullish Divergence2", color=purple, style=circles, linewidth=4)plot(delayedhigh>y2 and y3 < y4 ? d :na, title = "Bearish Divergence2", color=orange, style= circles, linewidth=4)plot(long_term_div and oscMax and i and i2 ? d :na, title = "Bearish Divergence2", color=orange, style= circles, linewidth=4)plot(long_term_div and oscMins and i4 and i5 ? d : na, title = "Bullish Divergence2", color=purple, style=circles, linewidth=4)plot(long_term_div and i and i3 ? d :na, title = "Bearish Divergence2", color=orange, style= circles, linewidth=4)plot(long_term_div and i4 and i6 ? d : na, title = "Bullish Divergence2", color=purple, style=circles, linewidth=4)09/26/2017 at 9:42 AM #47358Pourquoi pas, mais cet indicateur utilise beaucoup les instructions “valuewhen” et “barsince” du langage Pinescript. Dans ProBuilder on va devoir faire un tas de boucles 😐
Cet indicateur est-il vraiment aussi bien que ce que j’ai pu en lire ?
09/26/2017 at 6:11 PM #47427Bonsoir Nicolas,
Pour le suivre depuis des mois cet indicateur me semble digne d’intérêt.Pour alléger le code on peut tenir compte que des points de retournements remarquables
et laisser de côté les points intermédiaires.
Si tu pouvais nous coder cela ce serait top !
bonne soirée09/13/2018 at 1:35 PM #80392@ Nicolas
J’ai l’impression que ce code est passé sous la pile de travail , aurais tu d’autres chats à fouetter ?
d’avance merci si tu peux nous convertir ce code même simplifié , juste avec les points principaux de retournements.
Bonne journée
09/13/2018 at 1:49 PM #8039409/13/2018 at 2:40 PM #8039509/13/2018 at 3:15 PM #80397Voilà ce que j’ai pu tirer du code original, fidèle à 90% je dirai, pas mal de variables inutiles ou d’instructions mal utilisées à mon avis :
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169longtermdiv = 1 //input(true, title="Use long term Divergences?")divlookbackperiod = 55//input(55, minval=1, title="Lookback Period")fastLength = 12//input(12, minval=1),slowLength= 26 //input(26,minval=1)//signalLength= 9 //input(9,minval=1)smoother = 2 //input(2,minval=1)source = customclosefastMA = average[fastLength,1](source)slowMA = average[slowLength,1](source)mmacd = fastMA - slowMAmacd2=(mmacd/slowMA)*100d = average[smoother](macd2) // smoothing PPObullishPrice = lowpriceMins = (bullishPrice > bullishPrice[1] and bullishPrice[1] < bullishPrice[2]) or (low[1] = low[2] and low[1] < low and low[1] < low[3]) or (low[1] = low[2] and low[1] = low[3] and low[1] < low and low[1] < low[4]) or (low[1] = low[2] and low[1] = low[3] and low[1] and low[1] = low[4] and low[1] < low and low[1] < low[5]) // this line identifies bottoms and plateaus in the priceoscMins= d > d[1] and d[1] < d[2] // this line identifies bottoms in the PPOBottomPointsInPPO = oscMinsbearishPrice = highpriceMax = (bearishPrice < bearishPrice[1] and bearishPrice[1] > bearishPrice[2]) or (high[1] = high[2] and high[1] > high and high[1] > high[3]) or( high[1] = high[2] and high[1] = high[3] and high[1] > high and high[1] > high[4]) or (high[1] = high[2] and high[1] = high[3] and high[1] and high[1] = high[4] and high[1] > high and high[1] > high[5]) // this line identifies tops in the priceoscMax = d < d[1] and d[1] > d[2] // this line identifies tops in the PPOTopPointsInPPO = oscMax//avoid loops!if oscMins thencurrenttrough4=d[1] //valuewhen (oscMins, d[1], 0) // identifies the value of PPO at the most recent BOTTOM in the PPOoscMinsBar = barindexendifif oscMax thencurrenttrough5=d[1] //valuewhen (oscMax, d[1], 0) // identifies the value of PPO at the most recent TOP in the PPOoscMaxBar = barindexendifif priceMins thencurrenttrough6= low[1]//valuewhen (priceMins, low[1], 0) // this line identifies the low (price) at the most recent bottom in the PricepriceMinsBar = barindexif barindex-oscMinsBar<3 then //=line 47delayedlow=low[1]elsedelayedlow=0endifif priceMins<>priceMins[1] then //=line62longtermbullfilt=lowest[divlookbackperiod](source)[0]endifendifif priceMax thenpriceMaxBar = barindexcurrenttrough7= high[1]//valuewhen (priceMax, high[1], 0) // this line identifies the high (price) at the most recent top in the Priceif barindex-oscMaxBar<3 then //=line48delayedhigh=high[1]elsedelayedhigh=0endifif priceMax<>priceMax[1] then //=line63longtermbearfilt=highest[divlookbackperiod](source)[0]endifendif// only take tops/bottoms in price when tops/bottoms are less than 5 bars away//filter = barssince(priceMins) < 5 ? lowest(currenttrough6, 4) : naif barindex-priceMinsBar<5 thenfilter = lowest[4](currenttrough6)elsefilter=0endif//filter2 = barssince(priceMax) < 5 ? highest(currenttrough7, 4) : naif barindex-priceMaxBar<5 thenfilter2=highest[4](currenttrough7)elsefilter2=0endif//delayedbottom/top when oscillator bottom/top is earlier than price bottom/top//y11 = valuewhen(oscMins, delayedlow, 0)if oscMins then//y11=delayedlowy7=currenttrough4 //=line71y9 = currenttrough6 //=line74if oscMins<>oscMins[1] and filter2>0 theny2=filter2 //=line59y8=currenttrough4[1] //=line72endifendif//y12 = valuewhen(oscMax, delayedhigh, 0)if oscMax then//y12 = delayedhighy3=currenttrough5 //=line 65y10=currenttrough7 //=line75if oscMax<>oscMax[1] and filter>0 theny6=filter //=line60y4=currenttrough5[1] //=line66endifendif// only take tops/bottoms in price when tops/bottoms are less than 5 bars away, since 2nd most recent top/bottom in osc//y2=0//y6=0//for xyz=0 to barindex do////y2=valuewhen(oscMax, filter2, 1) // identifies the highest high in the tops of price with 5 bar lookback period SINCE the SECOND most recent top in PPO////y6=valuewhen(oscMins, filter, 1) // identifies the lowest low in the bottoms of price with 5 bar lookback period SINCE the SECOND most recent bottom in PPO//if filter2[xyz]<>filter2 and filter2>0 then//y2=filter2[xyz]//endif//if filter[xyz]<>filter and filter>0 then//y6=filter[xyz]//endif//if y2>0 and y6>0 then//break//endif//next//bulldiv= BottomPointsInPPO ? d[1] : na // plots dots at bottoms in the PPOif BottomPointsInPPo thendrawtext("●",barindex[1],d[1],dialog,bold,14) coloured(0,255,255)endif//beardiv= TopPointsInPPO ? d[1]: na // plots dots at tops in the PPOif TopPointsInPPO thendrawtext("●",barindex[1],d[1],dialog,bold,14) coloured(255,0,0)endifi = currenttrough5 < highest[divlookbackperiod](d) // long term bearish oscilator divergencei2 = y10 > longtermbearfilt // long term bearish top divergencei3 = delayedhigh > longtermbearfilt and delayedhigh>0 // long term bearish delayedhigh divergencei4 = currenttrough4 > lowest[divlookbackperiod](d) // long term bullish osc divergencei5 = y9 < longtermbullfilt // long term bullish bottom divi6 = delayedlow < longtermbullfilt and delayedlow>0// long term bullish delayedbottom div//plot(y10>y2 and oscMax and y3 < y4 ? d :na, title = "Bearish Divergence2", color=orange, style= circles, linewidth=4)if y10>y2 and oscMax and y3 < y4 thendrawtext("●",barindex,d,dialog,bold,14) coloured(255,165,0)endif//plot(y9<y6 and oscMins and y7 > y8 ? d :na, title = "Bullish Divergence2", color=purple, style=circles, linewidth=4)if y9<y6 and oscMins and y7 > y8 thendrawtext("●",barindex,d,dialog,bold,14) coloured(128,0,128)endif//plot(delayedlow<y6 and y7 > y8 ? d :na, title = "Bullish Divergence2", color=purple, style=circles, linewidth=4)if delayedlow<y6 and y7 > y8 and delayedlow>0 thendrawtext("●",barindex,d,dialog,bold,14) coloured(128,0,128)endif//plot(delayedhigh>y2 and y3 < y4 ? d :na, title = "Bearish Divergence2", color=orange, style= circles, linewidth=4)if delayedhigh>y2 and y3 < y4 and delayedhigh>0 thendrawtext("●",barindex,d,dialog,bold,14) coloured(255,165,0)endif//plot(long_term_div and oscMax and i and i2 ? d :na, title = "Bearish Divergence2", color=orange, style= circles, linewidth=4)if longtermdiv and oscMax and i and i2 thendrawtext("●",barindex,d,dialog,bold,14) coloured(255,165,0)endif//plot(long_term_div and oscMins and i4 and i5 ? d : na, title = "Bullish Divergence2", color=purple, style=circles, linewidth=4)if longtermdiv and oscMins and i4 and i5 thendrawtext("●",barindex,d,dialog,bold,14) coloured(128,0,128)endif//plot(long_term_div and i and i3 ? d :na, title = "Bearish Divergence2", color=orange, style= circles, linewidth=4)if longtermdiv and i and i3 thendrawtext("●",barindex,d,dialog,bold,14) coloured(255,165,0)endif//plot(long_term_div and i4 and i6 ? d : na, title = "Bullish Divergence2", color=purple, style=circles, linewidth=4)if longtermdiv and i4 and i6 thendrawtext("●",barindex,d,dialog,bold,14) coloured(128,0,128)endifreturn d as "ppo"1 user thanked author for this post.
09/13/2018 at 3:24 PM #8040009/15/2018 at 7:20 PM #80599Bonsoir à tous
PKP la suite …
Pour ceux que cela intéresse je vous joins le screener qui nous renvoie les principaux signaux de retournements , tri : 1 = up et 2 = down
faites en bon usage
SCREENER PKP NICO 15.09.2018123456789101112131415161718192021222324252627282930313233343536373839// SCREENER PKP NICO 15.09.2018fastLength = 12//input(12, minval=1),slowLength= 26 //input(26,minval=1)smoother = 2 //input(2,minval=1)source = customclosefastMA = average[fastLength,1](source)slowMA = average[slowLength,1](source)mmacd = fastMA - slowMAmacd2=(mmacd/slowMA)*100d = average[smoother](macd2) // smoothing PPOoscMins= d > d[1] and d[1] < d[2] // this line identifies bottoms in the PPOBottomPointsInPPO = oscMinsoscMax = d < d[1] and d[1] > d[2] // this line identifies tops in the PPOTopPointsInPPO = oscMaxif BottomPointsInPPo thenc1 = 1elsec1 = 0endifif TopPointsInPPO thenc2 = 1elsec2 = 0endifif c1 thenpattern = 1elsif c2 thenpattern = 2endifSCREENER [c1 or c2 ] (pattern as " signal ")1 user thanked author for this post.
10/24/2018 at 2:46 PM #8344310/25/2018 at 1:06 PM #83507Salut Supertiti,
Voilà le code comme tu l’as demandé.
@ + …
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170longtermdiv = 1 //input(true, title="Use long term Divergences?")divlookbackperiod = 55//input(55, minval=1, title="Lookback Period")fastLength = 12//input(12, minval=1),slowLength= 26 //input(26,minval=1)//signalLength= 9 //input(9,minval=1)smoother = 2 //input(2,minval=1)source = customcloseP = (AverageTrueRange[2](close))fastMA = average[fastLength,1](source)slowMA = average[slowLength,1](source)mmacd = fastMA - slowMAmacd2=(mmacd/slowMA)*100d = average[smoother](macd2) // smoothing PPObullishPrice = lowpriceMins = (bullishPrice > bullishPrice[1] and bullishPrice[1] < bullishPrice[2]) or (low[1] = low[2] and low[1] < low and low[1] < low[3]) or (low[1] = low[2] and low[1] = low[3] and low[1] < low and low[1] < low[4]) or (low[1] = low[2] and low[1] = low[3] and low[1] and low[1] = low[4] and low[1] < low and low[1] < low[5]) // this line identifies bottoms and plateaus in the priceoscMins= d > d[1] and d[1] < d[2] // this line identifies bottoms in the PPOBottomPointsInPPO = oscMinsbearishPrice = highpriceMax = (bearishPrice < bearishPrice[1] and bearishPrice[1] > bearishPrice[2]) or (high[1] = high[2] and high[1] > high and high[1] > high[3]) or( high[1] = high[2] and high[1] = high[3] and high[1] > high and high[1] > high[4]) or (high[1] = high[2] and high[1] = high[3] and high[1] and high[1] = high[4] and high[1] > high and high[1] > high[5]) // this line identifies tops in the priceoscMax = d < d[1] and d[1] > d[2] // this line identifies tops in the PPOTopPointsInPPO = oscMax//avoid loops!if oscMins thencurrenttrough4=d[1] //valuewhen (oscMins, d[1], 0) // identifies the value of PPO at the most recent BOTTOM in the PPOoscMinsBar = barindexendifif oscMax thencurrenttrough5=d[1] //valuewhen (oscMax, d[1], 0) // identifies the value of PPO at the most recent TOP in the PPOoscMaxBar = barindexendifif priceMins thencurrenttrough6= low[1]//valuewhen (priceMins, low[1], 0) // this line identifies the low (price) at the most recent bottom in the PricepriceMinsBar = barindexif barindex-oscMinsBar<3 then //=line 47delayedlow=low[1]elsedelayedlow=0endifif priceMins<>priceMins[1] then //=line62longtermbullfilt=lowest[divlookbackperiod](source)[0]endifendifif priceMax thenpriceMaxBar = barindexcurrenttrough7= high[1]//valuewhen (priceMax, high[1], 0) // this line identifies the high (price) at the most recent top in the Priceif barindex-oscMaxBar<3 then //=line48delayedhigh=high[1]elsedelayedhigh=0endifif priceMax<>priceMax[1] then //=line63longtermbearfilt=highest[divlookbackperiod](source)[0]endifendif// only take tops/bottoms in price when tops/bottoms are less than 5 bars away//filter = barssince(priceMins) < 5 ? lowest(currenttrough6, 4) : naif barindex-priceMinsBar<5 thenfilter = lowest[4](currenttrough6)elsefilter=0endif//filter2 = barssince(priceMax) < 5 ? highest(currenttrough7, 4) : naif barindex-priceMaxBar<5 thenfilter2=highest[4](currenttrough7)elsefilter2=0endif//delayedbottom/top when oscillator bottom/top is earlier than price bottom/top//y11 = valuewhen(oscMins, delayedlow, 0)if oscMins then//y11=delayedlowy7=currenttrough4 //=line71y9 = currenttrough6 //=line74if oscMins<>oscMins[1] and filter2>0 theny2=filter2 //=line59y8=currenttrough4[1] //=line72endifendif//y12 = valuewhen(oscMax, delayedhigh, 0)if oscMax then//y12 = delayedhighy3=currenttrough5 //=line 65y10=currenttrough7 //=line75if oscMax<>oscMax[1] and filter>0 theny6=filter //=line60y4=currenttrough5[1] //=line66endifendif// only take tops/bottoms in price when tops/bottoms are less than 5 bars away, since 2nd most recent top/bottom in osc//y2=0//y6=0//for xyz=0 to barindex do////y2=valuewhen(oscMax, filter2, 1) // identifies the highest high in the tops of price with 5 bar lookback period SINCE the SECOND most recent top in PPO////y6=valuewhen(oscMins, filter, 1) // identifies the lowest low in the bottoms of price with 5 bar lookback period SINCE the SECOND most recent bottom in PPO//if filter2[xyz]<>filter2 and filter2>0 then//y2=filter2[xyz]//endif//if filter[xyz]<>filter and filter>0 then//y6=filter[xyz]//endif//if y2>0 and y6>0 then//break//endif//next//bulldiv= BottomPointsInPPO ? d[1] : na // plots dots at bottoms in the PPOif BottomPointsInPPo thendrawtext("●",barindex[1],low-P[1],dialog,bold,14) coloured(0,255,255)endif//beardiv= TopPointsInPPO ? d[1]: na // plots dots at tops in the PPOif TopPointsInPPO thendrawtext("●",barindex[1],high+P[1],dialog,bold,14) coloured(255,0,0)endifi = currenttrough5 < highest[divlookbackperiod](d) // long term bearish oscilator divergencei2 = y10 > longtermbearfilt // long term bearish top divergencei3 = delayedhigh > longtermbearfilt and delayedhigh>0 // long term bearish delayedhigh divergencei4 = currenttrough4 > lowest[divlookbackperiod](d) // long term bullish osc divergencei5 = y9 < longtermbullfilt // long term bullish bottom divi6 = delayedlow < longtermbullfilt and delayedlow>0// long term bullish delayedbottom div//plot(y10>y2 and oscMax and y3 < y4 ? d :na, title = "Bearish Divergence2", color=orange, style= circles, linewidth=4)if y10>y2 and oscMax and y3 < y4 thendrawtext("●",barindex,low-P,dialog,bold,14) coloured(255,165,0)endif//plot(y9<y6 and oscMins and y7 > y8 ? d :na, title = "Bullish Divergence2", color=purple, style=circles, linewidth=4)if y9<y6 and oscMins and y7 > y8 thendrawtext("●",barindex,high+P,dialog,bold,14) coloured(128,0,128)endif//plot(delayedlow<y6 and y7 > y8 ? d :na, title = "Bullish Divergence2", color=purple, style=circles, linewidth=4)if delayedlow<y6 and y7 > y8 and delayedlow>0 thendrawtext("●",barindex,low-P,dialog,bold,14) coloured(128,0,128)endif//plot(delayedhigh>y2 and y3 < y4 ? d :na, title = "Bearish Divergence2", color=orange, style= circles, linewidth=4)if delayedhigh>y2 and y3 < y4 and delayedhigh>0 thendrawtext("●",barindex,high+P,dialog,bold,14) coloured(255,165,0)endif//plot(long_term_div and oscMax and i and i2 ? d :na, title = "Bearish Divergence2", color=orange, style= circles, linewidth=4)if longtermdiv and oscMax and i and i2 thendrawtext("●",barindex,low-P,dialog,bold,14) coloured(255,165,0)endif//plot(long_term_div and oscMins and i4 and i5 ? d : na, title = "Bullish Divergence2", color=purple, style=circles, linewidth=4)if longtermdiv and oscMins and i4 and i5 thendrawtext("●",barindex,high+P,dialog,bold,14) coloured(128,0,128)endif//plot(long_term_div and i and i3 ? d :na, title = "Bearish Divergence2", color=orange, style= circles, linewidth=4)if longtermdiv and i and i3 thendrawtext("●",barindex,low-P,dialog,bold,14) coloured(255,165,0)endif//plot(long_term_div and i4 and i6 ? d : na, title = "Bullish Divergence2", color=purple, style=circles, linewidth=4)if longtermdiv and i4 and i6 thendrawtext("●",barindex,high+P,dialog,bold,14) coloured(128,0,128)endifreturn1 user thanked author for this post.
10/25/2018 at 1:10 PM #83508123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170longtermdiv = 1 //input(true, title=”Use long term Divergences?”)divlookbackperiod = 55//input(55, minval=1, title=”Lookback Period”)fastLength = 12//input(12, minval=1),slowLength= 26 //input(26,minval=1)//signalLength= 9 //input(9,minval=1)smoother = 2 //input(2,minval=1)source = customcloseP = (AverageTrueRange[2](close))fastMA = average[fastLength,1](source)slowMA = average[slowLength,1](source)mmacd = fastMA – slowMAmacd2=(mmacd/slowMA)*100d = average[smoother](macd2) // smoothing PPObullishPrice = lowpriceMins = (bullishPrice > bullishPrice[1] and bullishPrice[1] < bullishPrice[2]) or (low[1] = low[2] and low[1] < low and low[1] < low[3]) or (low[1] = low[2] and low[1] = low[3] and low[1] < low and low[1] < low[4]) or (low[1] = low[2] and low[1] = low[3] and low[1] and low[1] = low[4] and low[1] < low and low[1] < low[5]) // this line identifies bottoms and plateaus in the priceoscMins= d > d[1] and d[1] < d[2] // this line identifies bottoms in the PPOBottomPointsInPPO = oscMinsbearishPrice = highpriceMax = (bearishPrice < bearishPrice[1] and bearishPrice[1] > bearishPrice[2]) or (high[1] = high[2] and high[1] > high and high[1] > high[3]) or( high[1] = high[2] and high[1] = high[3] and high[1] > high and high[1] > high[4]) or (high[1] = high[2] and high[1] = high[3] and high[1] and high[1] = high[4] and high[1] > high and high[1] > high[5]) // this line identifies tops in the priceoscMax = d < d[1] and d[1] > d[2] // this line identifies tops in the PPOTopPointsInPPO = oscMax//avoid loops!if oscMins thencurrenttrough4=d[1] //valuewhen (oscMins, d[1], 0) // identifies the value of PPO at the most recent BOTTOM in the PPOoscMinsBar = barindexendifif oscMax thencurrenttrough5=d[1] //valuewhen (oscMax, d[1], 0) // identifies the value of PPO at the most recent TOP in the PPOoscMaxBar = barindexendifif priceMins thencurrenttrough6= low[1]//valuewhen (priceMins, low[1], 0) // this line identifies the low (price) at the most recent bottom in the PricepriceMinsBar = barindexif barindex-oscMinsBar<3 then //=line 47delayedlow=low[1]elsedelayedlow=0endifif priceMins<>priceMins[1] then //=line62longtermbullfilt=lowest[divlookbackperiod](source)[0]endifendifif priceMax thenpriceMaxBar = barindexcurrenttrough7= high[1]//valuewhen (priceMax, high[1], 0) // this line identifies the high (price) at the most recent top in the Priceif barindex-oscMaxBar<3 then //=line48delayedhigh=high[1]elsedelayedhigh=0endifif priceMax<>priceMax[1] then //=line63longtermbearfilt=highest[divlookbackperiod](source)[0]endifendif// only take tops/bottoms in price when tops/bottoms are less than 5 bars away//filter = barssince(priceMins) < 5 ? lowest(currenttrough6, 4) : naif barindex-priceMinsBar<5 thenfilter = lowest[4](currenttrough6)elsefilter=0endif//filter2 = barssince(priceMax) < 5 ? highest(currenttrough7, 4) : naif barindex-priceMaxBar<5 thenfilter2=highest[4](currenttrough7)elsefilter2=0endif//delayedbottom/top when oscillator bottom/top is earlier than price bottom/top//y11 = valuewhen(oscMins, delayedlow, 0)if oscMins then//y11=delayedlowy7=currenttrough4 //=line71y9 = currenttrough6 //=line74if oscMins<>oscMins[1] and filter2>0 theny2=filter2 //=line59y8=currenttrough4[1] //=line72endifendif//y12 = valuewhen(oscMax, delayedhigh, 0)if oscMax then//y12 = delayedhighy3=currenttrough5 //=line 65y10=currenttrough7 //=line75if oscMax<>oscMax[1] and filter>0 theny6=filter //=line60y4=currenttrough5[1] //=line66endifendif// only take tops/bottoms in price when tops/bottoms are less than 5 bars away, since 2nd most recent top/bottom in osc//y2=0//y6=0//for xyz=0 to barindex do////y2=valuewhen(oscMax, filter2, 1) // identifies the highest high in the tops of price with 5 bar lookback period SINCE the SECOND most recent top in PPO////y6=valuewhen(oscMins, filter, 1) // identifies the lowest low in the bottoms of price with 5 bar lookback period SINCE the SECOND most recent bottom in PPO//if filter2[xyz]<>filter2 and filter2>0 then//y2=filter2[xyz]//endif//if filter[xyz]<>filter and filter>0 then//y6=filter[xyz]//endif//if y2>0 and y6>0 then//break//endif//next//bulldiv= BottomPointsInPPO ? d[1] : na // plots dots at bottoms in the PPOif BottomPointsInPPo thendrawtext(“●”,barindex[1],low-P[1],dialog,bold,14) coloured(0,255,255)endif//beardiv= TopPointsInPPO ? d[1]: na // plots dots at tops in the PPOif TopPointsInPPO thendrawtext(“●”,barindex[1],high+P[1],dialog,bold,14) coloured(255,0,0)endifi = currenttrough5 < highest[divlookbackperiod](d) // long term bearish oscilator divergencei2 = y10 > longtermbearfilt // long term bearish top divergencei3 = delayedhigh > longtermbearfilt and delayedhigh>0 // long term bearish delayedhigh divergencei4 = currenttrough4 > lowest[divlookbackperiod](d) // long term bullish osc divergencei5 = y9 < longtermbullfilt // long term bullish bottom divi6 = delayedlow < longtermbullfilt and delayedlow>0// long term bullish delayedbottom div//plot(y10>y2 and oscMax and y3 < y4 ? d :na, title = “Bearish Divergence2”, color=orange, style= circles, linewidth=4)if y10>y2 and oscMax and y3 < y4 thendrawtext(“●”,barindex,low-P,dialog,bold,14) coloured(255,165,0)endif//plot(y9<y6 and oscMins and y7 > y8 ? d :na, title = “Bullish Divergence2”, color=purple, style=circles, linewidth=4)if y9<y6 and oscMins and y7 > y8 thendrawtext(“●”,barindex,high+P,dialog,bold,14) coloured(128,0,128)endif//plot(delayedlow<y6 and y7 > y8 ? d :na, title = “Bullish Divergence2”, color=purple, style=circles, linewidth=4)if delayedlow<y6 and y7 > y8 and delayedlow>0 thendrawtext(“●”,barindex,low-P,dialog,bold,14) coloured(128,0,128)endif//plot(delayedhigh>y2 and y3 < y4 ? d :na, title = “Bearish Divergence2”, color=orange, style= circles, linewidth=4)if delayedhigh>y2 and y3 < y4 and delayedhigh>0 thendrawtext(“●”,barindex,high+P,dialog,bold,14) coloured(255,165,0)endif//plot(long_term_div and oscMax and i and i2 ? d :na, title = “Bearish Divergence2”, color=orange, style= circles, linewidth=4)if longtermdiv and oscMax and i and i2 thendrawtext(“●”,barindex,low-P,dialog,bold,14) coloured(255,165,0)endif//plot(long_term_div and oscMins and i4 and i5 ? d : na, title = “Bullish Divergence2”, color=purple, style=circles, linewidth=4)if longtermdiv and oscMins and i4 and i5 thendrawtext(“●”,barindex,high+P,dialog,bold,14) coloured(128,0,128)endif//plot(long_term_div and i and i3 ? d :na, title = “Bearish Divergence2”, color=orange, style= circles, linewidth=4)if longtermdiv and i and i3 thendrawtext(“●”,barindex,low-P,dialog,bold,14) coloured(255,165,0)endif//plot(long_term_div and i4 and i6 ? d : na, title = “Bullish Divergence2”, color=purple, style=circles, linewidth=4)if longtermdiv and i4 and i6 thendrawtext(“●”,barindex,high+P,dialog,bold,14) coloured(128,0,128)endifreturnThe button [Insert PRT Code] is your friend 🙂
1 user thanked author for this post.
10/25/2018 at 1:53 PM #83510Bonjour Matriciel,
Merci pour ton aide précieuse , je n’ai gardé que les points forts de retournements sur le code ci-dessous , chacun fait comme il lui plait selon son trading.
Je joins un graphe de TOTAL
merci encore et bons trades.
PEKIPEK NICO ON CHART by Matriciel123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173// PEKIPEK NICO ON CHART by Matriciel 25.10.2018// <pre class="lang:probuilder decode:true ">longtermdiv = 1 //input(true, title="Use long term Divergences?")divlookbackperiod = 55//input(55, minval=1, title="Lookback Period")fastLength = 12//input(12, minval=1),slowLength= 26 //input(26,minval=1)//signalLength= 9 //input(9,minval=1)smoother = 2 //input(2,minval=1)source = customcloseP = (AverageTrueRange[2](close))fastMA = average[fastLength,1](source)slowMA = average[slowLength,1](source)mmacd = fastMA - slowMAmacd2=(mmacd/slowMA)*100d = average[smoother](macd2) // smoothing PPObullishPrice = lowpriceMins = (bullishPrice > bullishPrice[1] and bullishPrice[1] < bullishPrice[2]) or (low[1] = low[2] and low[1] < low and low[1] < low[3]) or (low[1] = low[2] and low[1] = low[3] and low[1] < low and low[1] < low[4]) or (low[1] = low[2] and low[1] = low[3] and low[1] and low[1] = low[4] and low[1] < low and low[1] < low[5]) // this line identifies bottoms and plateaus in the priceoscMins= d > d[1] and d[1] < d[2] // this line identifies bottoms in the PPOBottomPointsInPPO = oscMinsbearishPrice = highpriceMax = (bearishPrice < bearishPrice[1] and bearishPrice[1] > bearishPrice[2]) or (high[1] = high[2] and high[1] > high and high[1] > high[3]) or( high[1] = high[2] and high[1] = high[3] and high[1] > high and high[1] > high[4]) or (high[1] = high[2] and high[1] = high[3] and high[1] and high[1] = high[4] and high[1] > high and high[1] > high[5]) // this line identifies tops in the priceoscMax = d < d[1] and d[1] > d[2] // this line identifies tops in the PPOTopPointsInPPO = oscMax//avoid loops!if oscMins thencurrenttrough4=d[1] //valuewhen (oscMins, d[1], 0) // identifies the value of PPO at the most recent BOTTOM in the PPOoscMinsBar = barindexendifif oscMax thencurrenttrough5=d[1] //valuewhen (oscMax, d[1], 0) // identifies the value of PPO at the most recent TOP in the PPOoscMaxBar = barindexendifif priceMins thencurrenttrough6= low[1]//valuewhen (priceMins, low[1], 0) // this line identifies the low (price) at the most recent bottom in the PricepriceMinsBar = barindexif barindex-oscMinsBar<3 then //=line 47delayedlow=low[1]elsedelayedlow=0endifif priceMins<>priceMins[1] then //=line62longtermbullfilt=lowest[divlookbackperiod](source)[0]endifendifif priceMax thenpriceMaxBar = barindexcurrenttrough7= high[1]//valuewhen (priceMax, high[1], 0) // this line identifies the high (price) at the most recent top in the Priceif barindex-oscMaxBar<3 then //=line48delayedhigh=high[1]elsedelayedhigh=0endifif priceMax<>priceMax[1] then //=line63longtermbearfilt=highest[divlookbackperiod](source)[0]endifendif// only take tops/bottoms in price when tops/bottoms are less than 5 bars away//filter = barssince(priceMins) < 5 ? lowest(currenttrough6, 4) : naif barindex-priceMinsBar<5 thenfilter = lowest[4](currenttrough6)elsefilter=0endif//filter2 = barssince(priceMax) < 5 ? highest(currenttrough7, 4) : naif barindex-priceMaxBar<5 thenfilter2=highest[4](currenttrough7)elsefilter2=0endif//delayedbottom/top when oscillator bottom/top is earlier than price bottom/top//y11 = valuewhen(oscMins, delayedlow, 0)if oscMins then//y11=delayedlowy7=currenttrough4 //=line71y9 = currenttrough6 //=line74if oscMins<>oscMins[1] and filter2>0 theny2=filter2 //=line59y8=currenttrough4[1] //=line72endifendif//y12 = valuewhen(oscMax, delayedhigh, 0)if oscMax then//y12 = delayedhighy3=currenttrough5 //=line 65y10=currenttrough7 //=line75if oscMax<>oscMax[1] and filter>0 theny6=filter //=line60y4=currenttrough5[1] //=line66endifendif// only take tops/bottoms in price when tops/bottoms are less than 5 bars away, since 2nd most recent top/bottom in osc//y2=0//y6=0//for xyz=0 to barindex do////y2=valuewhen(oscMax, filter2, 1) // identifies the highest high in the tops of price with 5 bar lookback period SINCE the SECOND most recent top in PPO////y6=valuewhen(oscMins, filter, 1) // identifies the lowest low in the bottoms of price with 5 bar lookback period SINCE the SECOND most recent bottom in PPO//if filter2[xyz]<>filter2 and filter2>0 then//y2=filter2[xyz]//endif//if filter[xyz]<>filter and filter>0 then//y6=filter[xyz]//endif//if y2>0 and y6>0 then//break//endif//next//bulldiv= BottomPointsInPPO ? d[1] : na // plots dots at bottoms in the PPOif BottomPointsInPPo thendrawtext("●",barindex[1],low-P[1],dialog,bold,30) coloured(0,255,255)endif//beardiv= TopPointsInPPO ? d[1]: na // plots dots at tops in the PPOif TopPointsInPPO thendrawtext("●",barindex[1],high+P[1],dialog,bold,30) coloured(255,0,0)endifi = currenttrough5 < highest[divlookbackperiod](d) // long term bearish oscilator divergencei2 = y10 > longtermbearfilt // long term bearish top divergencei3 = delayedhigh > longtermbearfilt and delayedhigh>0 // long term bearish delayedhigh divergencei4 = currenttrough4 > lowest[divlookbackperiod](d) // long term bullish osc divergencei5 = y9 < longtermbullfilt // long term bullish bottom divi6 = delayedlow < longtermbullfilt and delayedlow>0// long term bullish delayedbottom div//plot(y10>y2 and oscMax and y3 < y4 ? d :na, title = "Bearish Divergence2", color=orange, style= circles, linewidth=4)if y10>y2 and oscMax and y3 < y4 then//drawtext("●",barindex,low-P,dialog,bold,14) coloured(255,165,0)endif//plot(y9<y6 and oscMins and y7 > y8 ? d :na, title = "Bullish Divergence2", color=purple, style=circles, linewidth=4)if y9<y6 and oscMins and y7 > y8 then//drawtext("●",barindex,high+P,dialog,bold,14) coloured(128,0,128)endif//plot(delayedlow<y6 and y7 > y8 ? d :na, title = "Bullish Divergence2", color=purple, style=circles, linewidth=4)if delayedlow<y6 and y7 > y8 and delayedlow>0 then//drawtext("●",barindex,low-P,dialog,bold,14) coloured(128,0,128)endif//plot(delayedhigh>y2 and y3 < y4 ? d :na, title = "Bearish Divergence2", color=orange, style= circles, linewidth=4)if delayedhigh>y2 and y3 < y4 and delayedhigh>0 then//drawtext("●",barindex,high+P,dialog,bold,14) coloured(255,165,0)endif//plot(long_term_div and oscMax and i and i2 ? d :na, title = "Bearish Divergence2", color=orange, style= circles, linewidth=4)if longtermdiv and oscMax and i and i2 then//drawtext("●",barindex,low-P,dialog,bold,14) coloured(255,165,0)endif//plot(long_term_div and oscMins and i4 and i5 ? d : na, title = "Bullish Divergence2", color=purple, style=circles, linewidth=4)if longtermdiv and oscMins and i4 and i5 then//drawtext("●",barindex,high+P,dialog,bold,14) coloured(128,0,128)endif//plot(long_term_div and i and i3 ? d :na, title = "Bearish Divergence2", color=orange, style= circles, linewidth=4)if longtermdiv and i and i3 then//drawtext("●",barindex,low-P,dialog,bold,14) coloured(255,165,0)endif//plot(long_term_div and i4 and i6 ? d : na, title = "Bullish Divergence2", color=purple, style=circles, linewidth=4)if longtermdiv and i4 and i6 then//drawtext("●",barindex,high+P,dialog,bold,14) coloured(128,0,128)endifreturn customclose as " customclose "10/25/2018 at 2:17 PM #8351510/30/2018 at 10:16 AM #83770Merci beaucoup les amis, c’est super ! 🙂
En effet, pour le bouton, si vous encapsuler le code et que vous faîtes ensuite des retours en arrière ou des modifications du message, il est possible que les balises qui permettent le rendu du code soit effacé par inadvertance (l’idéal étant de vérifier dans l’onglet “text” de l’éditeur de message ou de ne plus toucher à rien du message une fois qu’on a utilisé le bouton).
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on