Support et résistance avec Ichimoku
Forums › ProRealTime forum Français › Support ProBuilder › Support et résistance avec Ichimoku
- This topic has 25 replies, 2 voices, and was last updated 4 years ago by Fantasio2020.
Tagged: ichimoku, resistance, support
-
-
10/27/2020 at 5:47 PM #14870410/27/2020 at 6:53 PM #148708
la modification ne change rien…. 🙁
10/27/2020 at 7:03 PM #148711ci-dessous l’erreur remontée
10/27/2020 at 7:27 PM #148716123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384// Définition des paramètres du codeDefparam CumulateOrders = FalseDefparam Preloadbars = 30000daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0Distance = 15LookBack = 15000SR = 9// Timeframe SRLeveltimeframe (30 minutes, updateonclose)// --- icihmoku support and resistancekijun = (highest[26](high)+lowest[26](low))/2SSB = (highest[52](high[26])+lowest[52](low[26]))/2kijunp = summation[SR](Kijun=Kijun[1])=SRssbp = summation[SR](SSB=SSB[1])=SRif kijunp thenkijunPrice = kijunendifif ssbp thenssbPrice = SSBendifif kijunprice = ssbprice thenSRlevel = kijunpriceendif//Timeframe en UT de TradingTimeframe (10 seconds, default)//************************************************************************levier = 2capital = 500 + (strategyprofit*2/5)z = (capital / (close/20)) * levier//************************************************************************//Position acheteusebuycondition = rsi[14] crosses over 50buycondition2 = x Crosses Over 0.7 and Summation[2](x > 0.5) = 2if Buycondition and not onmarket and not daysForbiddenEntry thenallowtrading = 1for iSRB = 0 to lookback -1 dodist = abs(close-SRlevel[iSRB]) < distance*pipsizeif dist thenallowtrading = 0 //no trading is allowed we are near a SR!break //break the loop, no need to continue, trading is not allowed anymore!endifnextIf BuyCondition2 thenEntry = Barindexendifif Barindex-Entry <= 2 thenif allowtrading thenbuy z share at marketendifendifendif//Position Vendeusesellcondition = rsi[14] crosses under 50sellcondition2 = x Crosses Over 0.7 and Summation[2](x > 0.5) = 2if SellCondition and not onmarket and not daysForbiddenEntry thenallowtrading = 1for iSRV = 0 to lookback -1 dodist = abs(close-SRlevel[iSRV]) < distance*pipsizeif dist thenallowtrading = 0 //no trading is allowed we are near a SR!break //break the loop, no need to continue, trading is not allowed anymore!endifnextif SellCondition2 thenEntry = BarindexendifIf Barindex-Entry <= 2 thenif allowtrading thensellshort z share at marketendifendifendif//************************************************************************//Stop Loss & Trailing functionSet stop $loss capital*levier*4/100Set Target $Profit capital*levier*5/100Ci-dessus, la partie du code qui semble poser problème.
je me demande si ce n’est pas un problème de preloadbars entre les deux timeframe…
10/28/2020 at 9:00 AM #148751Un lookback de 15.000 bars est énorme ! Une boucle sur 15000 chandeliers c’est beaucoup trop, même si celle-ci n’ira jamais jusqu’au bout, puisqu’on trouvera un support ou une résistance avant d’arriver au terme de celle-ci.
Bref, le problème principale dans ton cas, c’est surtout que ProOrder ne peut pas charger plus de 10.000 unités d’historique, donc ta boucle ne peut pas dépasser cette valeur !
10/28/2020 at 9:10 AM #148753Je vais faire quelques tests… Je te revient lorsque j’ai réglé le soucis…. Je vais baisser la valeur à 10.000 dans un premier temps….
Merci du retour
10/28/2020 at 1:39 PM #148779Bjr Nicolas,
Problème réglé!
baisser LookBack à 9999 à réglé les arrêts.
Merci pour le retour.
10/31/2020 at 4:42 PM #1490901234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586Defparam CumulateOrders = FalseDefparam Preloadbars = 43200daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0Distance = 8LookBack = 5000SRk = 5SRs = 8// --- icihmoku support and resistancekijun = (highest[26](high)+lowest[26](low))/2SSB = (highest[52](high[26])+lowest[52](low[26]))/2kijunp = summation[SRk](Kijun=Kijun[1])=SRkssbp = summation[SRs](SSB=SSB[1])=SRsif kijunp thenkijunPrice = kijunendifif ssbp thenssbPrice = SSBendifif kijunprice = ssbprice thenSRlevel = kijunpriceif SRLevel > Close thenResLevel = SRlevelelsif SRLevel < Close thenSupLevel = SRlevelendifendif//************************************************************************levier = 2capital = 500 + (strategyprofit*2/5)z = (capital / (close/20)) * levier//************************************************************************//Buy Conditionsbuycondition = rsi[14] crosses over 50buycondition2 = x Crosses Over 0.7 and Summation[2](x > 0.5) = 2if Buycondition and not onmarket and not daysForbiddenEntry thenallowtrading = 1for iSRB = 0 to lookback -1 dodist = (Reslevel[iSRB] - Close) < distance*pipsizeif dist thenallowtrading = 0 //no trading is allowed we are near a SR!break //break the loop, no need to continue, trading is not allowed anymore!endifnextIf BuyConditionL thenEntry = Barindexendifif Barindex-Entry <= 2 thenif allowtrading thenbuy z share at marketendifendifendif//Sell Conditions<span class="crayon-cn">sellcondition = rsi[14] crosses over 50sellcondition2 = x Crosses Over 0.7 and Summation[2](x > 0.5) = 2if sellcondition and not onmarket and not daysForbiddenEntry then</span>allowtrading = 1for iSRV = 0 to lookback -1 dodist = (close-Suplevel[iSRV]) < distance*pipsizeif dist thenallowtrading = 0 //no trading is allowed we are near a SR!break //break the loop, no need to continue, trading is not allowed anymore!endifnextif SellCondition2 thenEntry = BarindexendifIf Barindex-Entry <= 2 thenif allowtrading thensellshort z share at marketendifendifendif//************************************************************************//Stop Loss & Trailing functionSet stop $loss capital*levier*4/100Set Target $Profit capital*levier*5/100Quelques corrections sur le code.
De cette manière les Supports et Résistances sont clairement identifiés.
10/31/2020 at 4:49 PM #149092Dans le même registre, est ce qu’il est possible de créer une boucle sur les mêmes conditions de distance, avec les supports et résistances du pivot (pivot compris)
1234567Pivot = (Dhigh(1) + Dlow(1) + Dclose(1) + Dopen(0))/4 //PivotRes3 = Dhigh(1)+(2*(Pivot-Dlow(1))) //Res3Res2 = Pivot+(Dhigh(1)-Dlow(1)) //Res2Res1 = (2*Pivot) - Dlow(1) //Res1Sup1 = (2*Pivot) - Dhigh(1) //Sup1Sup2 = Pivot-(Dhigh(1)-Dlow(1)) //Sup2Sup3 = Dlow(1)-(2*(Dhigh(1)-Pivot)) //Sup3Merci pour l’aide.
10/31/2020 at 11:37 PM #149112J’ai géré comme ci-dessous:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167//Pivot (H + L + C + O)/4If OpenDayOfWeek = 1 ThenHt = DHigh(2)Bs = DLow(2)C = DClose(2)O = DOpen(0)EndifIf OpenDayOfWeek => 2 and dayofweek < 6 ThenHt = DHigh(1)Bs = DLow(1)C = DClose(1)O = DOpen(0)EndifPivot = (Ht + Bs + C + O)/4Res4 = Ht + (3*(Pivot - BS))Res3 = Ht + (2*(Pivot - Bs))Res2 = Pivot + (Ht - Bs)Res1 = (2*Pivot) - BsSup1 = (2*Pivot) - HtSup2 = Pivot-(Ht - Bs)Sup3 = Bs - (2*(Ht - Pivot))Sup4 = Bs - (3*(Ht - Pivot))// Position acheteuseif close > pivot then//above PivotiPivt = 1while iPivt =< 4 doif iPivt = 1 thenFloor = PivotCeil = Res1if close > Floor and close < Ceil thenbreakendifelsif iPivt = 2 thenFloor = Res1Ceil = Res2if close > Floor and close < Ceil thenbreakendifelsif iPivt = 3 thenFloor = Res2Ceil = Res3if close > Floor and close < Ceil thenbreakendifelsif iPivt = 4 thenFloor = Res3Ceil = Res4if close > Floor and close < Ceil thenbreakendifendifiPivt = iPivt + 1wendelsif close < Pivot then//below PivotiPivt = 1while iPivt <= 4 doif iPivt = 1 thenFloor = Sup1Ceil = Pivotif close > Floor and close < Ceil thenbreakendifelsif iPivt = 2 thenFloor = Sup2Ceil = Sup1if close > Floor and close < Ceil thenbreakendifelsif iPivt = 3 thenFloor = Sup3Ceil = Sup2if close > Floor and close < Ceil thenbreakendifelsif iPivt = 4 thenFloor = Sup4Ceil = Sup3if close > Floor and close < Ceil thenbreakendifendifiPivt = iPivt + 1wendendifFor IPivt = 1 to 4 dodist = (Ceil - Close) < distance*pipsizeIf Dist thenallowtrading = 0Breakendifnext// Position vendeuseif close > pivot then//above PivotiPivt = 1while iPivt =< 4 doif iPivt = 1 thenFloor = PivotCeil = Res1if close > Floor and close < Ceil thenbreakendifelsif iPivt = 2 thenFloor = Res1Ceil = Res2if close > Floor and close < Ceil thenbreakendifelsif iPivt = 3 thenFloor = Res2Ceil = Res3if close > Floor and close < Ceil thenbreakendifelsif iPivt = 4 thenFloor = Res3Ceil = Res4if close > Floor and close < Ceil thenbreakendifendifiPivt = iPivt + 1wendelsif close < Pivot then//below PivotiPivt = 1while iPivt <= 4 doif iPivt = 1 thenFloor = Sup1Ceil = Pivotif close > Floor and close < Ceil thenbreakendifelsif iPivt = 2 thenFloor = Sup2Ceil = Sup1if close > Floor and close < Ceil thenbreakendifelsif iPivt = 3 thenFloor = Sup3Ceil = Sup2if close > Floor and close < Ceil thenbreakendifelsif iPivt = 4 thenFloor = Sup4Ceil = Sup3if close > Floor and close < Ceil thenbreakendifendifiPivt = iPivt + 1wendendifFor IPivt = 1 to 4 dodist = (Close - Floor) < distance*pipsizeIf Dist thenallowtrading = 0Breakendifnextça a l’air de fonctionner, mais j’ai l’impression que c’est interminable…!
y a t’il moyen de simplifier?
11/02/2020 at 2:38 PM #149294Très bien, j’ai créé une stratégie toute simple qui prendra ses ordres si “allowtrading” est égal à 1 (égal à 0 si trop proche d’un SR).
Dans la boucle on teste une proximité de “distance” avec un support/resistance détecté dans les “lookback” derniers chandeliers.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758defparam cumulateorders=false// — settingsdistance = 15 //no orders if there is a SR within X pointslookback = 1000 //lookback in bars to check recent SRtp = 30 //takeprofit in pointssl = 10 //stoploss in points// ———————————-// — icihmoku support and resistancekijun = (highest[26](high)+lowest[26](low))/2SSB = (highest[52](high[26])+lowest[52](low[26]))/2kijunp = summation[9](Kijun=Kijun[1])=9ssbp = summation[9](SSB=SSB[1])=9if kijunp thenkijunPrice= kijunendifif ssbp thenssbPrice= SSBendifif kijunprice=ssbprice thenSRlevel= kijunpriceendif// ———————————-// — dummy strategybuycondition = rsi[14] crosses over 50sellcondition = rsi[14] crosses under 50if buycondition or sellcondition then//check if the current price is distant from at least “distance” from recent support or resistanceallowtrading=1for i = 0 to lookback–1 dodist= abs(close–srlevel[i])<distance*pointsizeif dist thenallowtrading=0 //no trading is allowed we are near a SR!break //break the loop, no need to continue, trading is not allowed anymore!endifnext//trigger orders or notif allowtrading thenif buycondition thenbuy 1 contract at marketendifif sellcondition thensellshort 1 contract at marketendifendifset target pprofit tpset stop ploss slendif// ———————————-graph allowtrading as “0=near a SR , don’t trade!”Bjr Nicolas,
j’ai ajusté un peu les plats Kijun et SSB:
123456789101112131415161718192021222324SRk = 5SRs = 8// --- icihmoku support and resistancekijun = (highest[26](high)+lowest[26](low))/2SSB = (highest[52](high[26])+lowest[52](low[26]))/2kijunp = summation[SRk](Kijun=Kijun[1])=SRkssbp = summation[SRs](SSB=SSB[1])=SRsif kijunp thenkijunPrice = kijunendifif ssbp thenssbPrice = SSBendifif kijunprice = ssbprice thenSRlevel = kijunpriceif SRLevel > Close thenResLevel = SRlevelelsif SRLevel < Close thenSupLevel = SRlevelendifendifNéanmoins codé tel quel, j’ai l’impression que ça ne trace les SRlevel que lorsque kijunP et SSBp sont strictement = à SRk et SRs.
je n’arrive pas à codé une alternative ou il faut Min SRk pour Kijunp et Min SRs pour SSBp.
une idée?
-
AuthorPosts
Find exclusive trading pro-tools on