Tenkan Sen Kijun Sen Cross Over Amibroker Scanner
Buy Tenkan Sen > Kijun Sen
Sell Tenkan Sen < Kijun Sen
AFL Code Below:
//Disclaimer:
//All the AFL’s posted in this section are for learning purpose.
//I do not necessarily own these AFL’s and I don’t have any intellectual property rights on them. I might copy useful AFL’s from public forums
//and post it in this section in a presentable format. The intent is not to copy anybody’s work but to share knowledge.
//If you find any misleading or non-reproducible content then please disregard this AFL_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
_SECTION_BEGIN("Volume");
Plot( Volume, _DEFAULT_NAME(), IIf( C > O, ParamColor("Up Color", colorGreen ), ParamColor("Down Color", colorRed ) ), styleNoTitle | ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick | styleNoLabel, maskHistogram ), 10 );
_SECTION_END();
_SECTION_BEGIN("Ichimoku");
/* ICHIMOKU CHART */
n1 = Param("Tenkan-Sen",9,1,200,1);
n2 = Param("Kijun-Sen",26,1,400,1);
n3 = Param("Senkou Span",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",colorBrown,styleNoLine,0,0,n2);
Plot (SpB,"SenkouSpanB",colorBlack,styleNoLine,0,0,n2);
PlotOHLC (SpA,SpA,SpB,SpB,"Cloud",IIf (SpA > SpB,colorGreen,colorLightOrange),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),2);
IIf( (MediumBuy),PlotShapes(shapeUpArrow*MediumBuy,colorGreen),2);
IIf( (WeakBuy),PlotShapes(shapeHollowUpArrow*WeakBuy,colorIndigo),2);
IIf( (StrongSell),PlotShapes(shapeDownTriangle*StrongSell,colorRed),2);
IIf( (MediumSell),PlotShapes(shapeDownArrow*MediumSell,colorRed),2);
IIf( (WeakSell),PlotShapes(shapeHollowDownArrow*WeakSell,colorBrown),2);
*/
// ÃîðèçîÃòà ëüÃà ÿ öâåòÃà ÿ èÃäèêà òîðÃà ÿ ïîëîñà (ïðèìåð).
// Plot( 1, "Ribbon", ColTenk, styleOwnScale|styleArea|styleNoLabel, -2, 200 ); // èÃäèöèðóåò ôëýò Ãà TenkanSen.
// Plot( 4, "Ribbon", ColSenk, styleOwnScale|styleArea|styleNoLabel, -1, 200 ); // èÃäèöèðóåò ïîëîæåÃèå öåÃû îòÃîñèòåëüÃî îáëà êÃ
_SECTION_END();
Technical Analysis For Forex, Cryptocurrency and Stocks.
No Hype...No Tsismis... No Drama.... Just Chart!!!!