Complete Ichimoku Trading System |
//www.aflcode.com _SECTION_BEGIN("i"); /* ICHIMOKU CHART */ n1 = Param("Èøèìîêó: ïåðèîä 1",9,1,200,1); n2 = Param("Èøèìîêó: ïåðèîä 2",26,1,400,1); n3 = Param("Èøèìîêó: ïåðèîä 3",52,1,600,1); TenkanSen =(HHV(H,n1)+LLV(L,n1))/2; // Tenkan-sen (Òåíêàí-ñåí) – ýòî ñðåäíåå çíà÷åíèå öåíû çà ïåðâûé ïðîìåæóòîê âðåìåíè (ðàâíà (high+low)/2, ãäå high è low – ìàêñèìóì è ìèíèìóì çà ïåðèîä). KijunSen =(HHV(H,n2)+LLV(L,n2))/2; // Kijun-sen (Êèäæóí-ñåí) – ýòî ñðåäíåå çíà÷åíèå öåíû çà âòîðîé ïðîìåæóòîê. ChinkouSpan =Ref(C,-n2); // Chinkou Span (×èêîó ñïåí) - öåíà çàêðûòèÿ òåêóùåãî áàðà, ñäâèíóòàÿ íàçàä íà âåëè÷èíó âòîðîãî âðåìåííîãî èíòåðâàëà. Cks = Close; // Ãðàôè÷åñêèé Chinkou Span, ñäâèã íàçàä çàñ÷åò îòðèñîâêè. SenkouSpanA =Ref((KijunSen+TenkanSen)/2,-n2); // Senkou Span A (Ñåíêîó ñïåí À) / Up Kumo - ñåðåäèíà ðàññòîÿíèÿ ìåæäó Tenkan-sen è Kijun-sen, ñäâèíóòîå âïåðåä íà âåëè÷èíó âòîðîãî âðåìåííîãî èíòåðâàëà. SpA =(KijunSen+TenkanSen)/2; // Ãðàôè÷åñêèé Senkou Span A , ñäâèã âïåðåä çàñ÷åò îòðèñîâêè. SenkouSpanB =Ref((HHV(H,n3)+LLV(L,n3))/2,-n2); // Senkou Span B (Ñåíêîó ñïåí Â) / Down Kumo - ñðåäíåå çíà÷åíèå öåíû çà òðåòèé âðåìåííîé èíòåðâàë, ñäâèíóòîå âïåðåä íà âåëè÷èíó âòîðîãî âðåìåííîãî èíòåðâàëà. SpB =(HHV(H,n3)+LLV(L,n3))/2; // Ãðàôè÷åñêèé Senkou Span B, ñäâèã âïåðåä çàñ÷åò îòðèñîâêè. DL = Ref( C, 25 ); Cond1 = Ref(Close > Max(SenkouSpanA,SenkouSpanB),-1); //öåíà âûøå îáëàêà -- áû÷üå íàñòðîåíèå Cond2 = Ref(Close < Min(SenkouSpanA,SenkouSpanB),-1); //öåíà íèæå îáëàêà -- ìåäâåæüå íàñòðîåíèå Cond3 = Ref(Cross(TenkanSen,KijunSen),-1); //ïåðåñå÷åíèå Òåíêàí è Êèäæóí -- ñèãíàë íà ïîêóïêó Cond4 = Ref(Cross(KijunSen,TenkanSen),-1); //ïåðåñå÷åíèå Òåíêàí è Êèäæóí -- ñèãíàë íà ïðîäàæó Cond5 = Ref(Cross(Close,ChinkouSpan ),-1); //ïåðåñå÷åíèå ×èêîó è öåíû Cond6 = Ref(Cross(ChinkouSpan ,Close),-1); //ïåðåñå÷åíèå ×èêîó è öåíû Cond7 = Ref(Cross (Close , Max(SenkouSpanA,SenkouSpanB)),-1); //öåíà âûõîäèò ââåðõ èç îáëàêà -- ñèãíàë íà ïîêóïêó Cond8 = Ref(Cross ( Min(SenkouSpanA,SenkouSpanB), Close),-1); //öåíà âûõîäèò âíèç èç îáëàêà -- ñèãíàë íà ïðîäàæó Cond9 = Close > TenkanSen AND TenkanSen > KijunSen AND KijunSen > Max(SenkouSpanA,SenkouSpanB); // ñèãíàë òðåõ ëèíèé ââåðõ Cond10= Close < TenkanSen AND TenkanSen < KijunSen AND KijunSen < Min(SenkouSpanA,SenkouSpanB); // ñèãíàë òðåõ ëèíèé âíèç RemCond9=ExRem(Cond9,NOT Cond9); RemCond10=ExRem(Cond10,NOT Cond10); ColSenk =IIf (Cond1,colorGreen, IIf(Cond2,colorRed,colorLightGrey)); // çàäàåò öâåò, åñëè öåíà âûøå/íèæå/âíóòðè îáëàêà. Flat = TenkanSen == Ref(TenkanSen,-1) OR (NOT(Cond1) AND NOT(Cond2)) ; for( i = 0; i < BarCount; i++ ) //ðàñêðàøèâàåò ñðåäíþþ ëèíèþ èíäèêàòîðà ïî âçàèìîðàñïîëîæåíèþ è íàïðàâëåíèÿ äâèæåíèÿ TenkanSen, öåíû è îáëàêà. { if (Flat[i]) ColTenk[i] = colorLightGrey; else { if (Cond1[i] AND TenkanSen[i] > TenkanSen[i-1]) ColTenk[i] = colorGreen; if (Cond1[i] AND TenkanSen[i] < TenkanSen[i-1]) ColTenk[i] = colorRed; if (Cond2[i] AND TenkanSen[i] < TenkanSen[i-1]) ColTenk[i] = colorRed; if (Cond2[i] AND TenkanSen[i] > TenkanSen[i-1]) ColTenk[i] = colorGreen; } } AlertIf( Cond3 OR Cond4, "SOUND c:/WINDOWS/Media/notify.wav", "ïåðåñå÷åíèå Òåíêàí è Êèäæóí",0,1+2+4+8); AlertIf( Cond5 OR Cond6, "SOUND c:/WINDOWS/Media/notify.wav", "ïåðåñå÷åíèå ×èêîó è öåíû",0,1+2+4+8); AlertIf( Cond7 OR Cond8, "SOUND c:/WINDOWS/Media/notify.wav", "öåíà âûõîäèò èç îáëàêà",0,1+2+4+8); AlertIf( RemCond9 OR RemCond10, "SOUND c:/WINDOWS/Media/notify.wav", "ñèãíàë òðåõ ëèíèé",0,1+2+4+8); //PlotShapes(IIf(Cond7, shapeSmallUpTriangle ,shapeNone),colorGreen,0,H,10); //PlotShapes(IIf(Cond8, shapeSmallDownTriangle ,shapeNone),colorRed,0,L,10); //PlotShapes(IIf(Cond3, shapeHollowSmallUpTriangle,shapeNone),colorGreen,0,H,12); //PlotShapes(IIf(Cond4, shapeHollowSmallDownTriangle ,shapeNone),colorRed,0,L,12); //PlotShapes(IIf(Cond5, shapeSmallCircle ,shapeNone),colorGreen,0,H,4); //PlotShapes(IIf(Cond6, shapeSmallCircle + shapePositionAbove ,shapeNone),colorRed,0,L,4); //PlotShapes(IIf(RemCond9 , shapeHollowSquare ,shapeNone),colorGreen,0,H,18); //PlotShapes(IIf(RemCond10, shapeHollowSquare + shapePositionAbove ,shapeNone),colorRed,0,L,18); //Plot (C,"Close",colorBlack,styleThick); Plot (C,"Bars",colorBlack,styleCandle); Plot (TenkanSen,"Tenkan-sen",colorRed); Plot (KijunSen, "Kijun-sen", colorBlue); Plot (Cks,"Chinkou Span",colorLime, style = styleLine,0,0,-n2); Plot (SpA,"SenkouSpanA",colorOrange,styleDashed,0,0,n2); Plot (SpB,"SenkouSpanB",colorViolet,styleDashed + styleThick,0,0,n2); PlotOHLC (SpA,SpA,SpB,SpB,"Cloud",IIf (SpA > SpB,colorPink,colorLavender),styleCloud, 10, 10, n2 ); above = IIf(KijunSen>SenkouSpanA AND TenkanSen>SenkouSpanB,1,0); within = IIf(KijunSen>SenkouSpanA AND TenkanSen<SenkouSpanB,1,0); below = IIf(TenkanSen<SenkouSpanA AND TenkanSen<SenkouSpanB,1,0); Buy = Cross(TenkanSen,KijunSen) AND (DL>Close); Sell = Cross(KijunSen,TenkanSen) AND (DL<KijunSen); StrongBuy = Buy AND above; MediumBuy = Buy AND within; WeakBuy = Buy AND below; StrongSell = Sell AND below; MediumSell = Sell AND within; WeakSell = Sell AND above; IIf( (StrongBuy),PlotShapes(shapeUpTriangle*StrongBuy,colorGreen),0); IIf( (MediumBuy),PlotShapes(shapeUpArrow*MediumBuy,colorGreen),0); IIf( (WeakBuy),PlotShapes(shapeHollowUpArrow*WeakBuy,colorIndigo),0); IIf( (StrongSell),PlotShapes(shapeDownTriangle*StrongSell,colorRed),0); IIf( (MediumSell),PlotShapes(shapeDownArrow*MediumSell,colorRed),0); IIf( (WeakSell),PlotShapes(shapeHollowDownArrow*WeakSell,colorBrown),0); // Ãîðèçîíòàëüíàÿ öâåòíàÿ èíäèêàòîðíàÿ ïîëîñà (ïðèìåð). Plot( 1, "Ribbon", ColTenk, styleOwnScale|styleArea|styleNoLabel, -2, 200 ); // èíäèöèðóåò ôëýò íà TenkanSen. Plot( 4, "Ribbon", ColSenk, styleOwnScale|styleArea|styleNoLabel, -1, 200 ); // èíäèöèðóåò ïîëîæåíèå öåíû îòíîñèòåëüíî îáëàêà _SECTION_END();
Sign up here with your email
ConversionConversion EmoticonEmoticon