Help for ichimoku afl.

#11
Please i need your help to upgrade this afl that i founded yousefull for me...

i need to add the arrows for each condition bellow;

UP GREEN ARROW: Strong signals - A strong Buy Signal occurs when the Tenkan-Sen crosses above the Kijun-Sen from below.

Down RED ARROW:A strong Sell Signal occurs when the opposite occurs. The signals must be above the Kumo.

UP Bleu ARROW:Normal signals - A normal Buy Signal occurs when the Tenkan-Sen crosses above the Kijun-Sen from below.

Down Bleu ARROW:A normal Sell Signal occurs when the opposite occurs. The signals must be within the Kumo.

UP RED ARROW:Weak signals - A weak Buy Signal occurs when the Tenkan-Sen crosses above the Kijun-Sen from below.
A weak Sell Signal occurs when the opposite occurs. The signals must be below the Kumo.

Down RED ARROW:Overall strength - Strength is shown to be with the sellers if the Chikou Span is below the current price.
Strength is shown to be with the buyers when the opposite is True.

I need to add for this formula an explorer for all type signals...

Thinks a lot...

this is my formula:

// Ichimoku Kinko Hyo Chart
// Abo Elias May-20-2008

//////////////////////////////
// 1) Tenkan-Sen = Conversion Line = (Highest High + Lowest Low) / 2, for the past 9 periods
// 2) Kijun-Sen = Base Line = (Highest High + Lowest Low) / 2, for the past 26 periods
// 3) Chikou Span = Lagging Span = Today's closing price plotted 26 periods behind
// 4) Senkou Span A = Leading Span A = (Tenkan-Sen + Kijun-Sen) / 2, plotted 26 periods ahead
// 5) Senkou Span B = Leading Span B = (Highest High + Lowest Low) / 2, for the past 52 periods, plotted 26 periods ahead
// Kumo = Cloud = Area between Senkou Span A AND B
// http://www.prosticks.com/education/ikh.php
//////////////////////////////


_SECTION_BEGIN("Price");
HAswitch = ParamToggle("Heikin Ashi","Off,On");
PriceUpCol = ParamColor("Price UP Color",colorGreen);
PriceDnCol = ParamColor("Price DN Color",colorRed);
PriceSty = ParamStyle("Price Style",styleCandle,maskDefault | styleCandle | styleBar);

HaClose = ( O+H+L+C ) / 4;
HaOpen = AMA( Ref(HaClose, -1), 0.5);
HaHigh = Max(H, Max(HaClose, HaOpen));
HaLow = Min(L, Min(HaClose, HaOpen));

if(HAswitch)
PlotOHLC(HaOpen,HaHigh,HaLow,HaClose,"Heikin Ashi",IIf(HaClose > HaOpen,PriceUpCol,PriceDnCol),PriceSty);
else
Plot(C,"Price",IIf(C > Ref(C,-1), PriceUpCol, PriceDnCol), PriceSty);
_SECTION_END();

_SECTION_BEGIN("Tenkan-Sen");
TenkanPer = Param("Tenkan-Sen Period",9,1,100,1);
TenkanCol = ParamColor("Tenkan-Sen Color",colorRed);
TenkanSty = ParamStyle("Tenkan-Sen Style",styleLine | styleThick);
Tenkan = ( HHV(H,TenkanPer) + LLV(L,TenkanPer) ) / 2;
Plot(Tenkan,"Tenkan",TenkanCol,TenkanSty);
_SECTION_END();

_SECTION_BEGIN("Kijun-Sen");
KijunPer = Param("Kijun-Sen Period",26,1,100,1);
KijunCol = ParamColor("Kijun-Sen Color",colorBlue);
KijunSty = ParamStyle("Kijun-Sen Style",styleLine | styleThick);
Kijun = ( HHV(H,KijunPer) + LLV(L,KijunPer) ) / 2;
Plot(Kijun,"Kijun",KijunCol,KijunSty);
_SECTION_END();

_SECTION_BEGIN("Chikou Span");
ChikouShft = Param("Chikou Span Shift",26,1,100,1);
ChikouCol = ParamColor("Chikou Span Color",colorViolet);
ChikouSty = ParamStyle("Chikou Span Style",styleLine | styleNoLabel);
Chikou = C;
Plot(Chikou,"",ChikouCol,ChikouSty,Null,Null,-ChikouShft);
_SECTION_END();

_SECTION_BEGIN("Senkou-Kumo");
SenkouKumoShft = Param("Senkou-Kumo Shift",26,0,100,1);
_SECTION_END();

_SECTION_BEGIN("Senkou Span A");
SenkouACol = ParamColor("Senkou Span A Color",colorSeaGreen);
SenkouASty = ParamStyle("Senkou Span A Style",styleLine);
SenkouA = ( Tenkan + Kijun ) / 2;
Plot(SenkouA,"Senkou A",SenkouACol,SenkouASty,Null,Null,SenkouKumoShft);
_SECTION_END();

_SECTION_BEGIN("Senkou Span B");
SenkouBPer = Param("Senkou Span B Period",52,1,200,1);
SenkouBCol = ParamColor("Senkou Span B Color",colorPink);
SenkouBSty = ParamStyle("Senkou Span B Style",styleLine);
SenkouB = ( HHV(H,SenkouBPer) + LLV(L,SenkouBPer) ) / 2;
Plot(SenkouB,"Senkou B",SenkouBCol,SenkouBSty,Null,Null,SenkouKumoShft);
_SECTION_END();

_SECTION_BEGIN("Kumo");
KumoUpCol = ParamColor("Kumo UP Color",colorSeaGreen);
KumoDnCol = ParamColor("Kumo DN Color",colorPink);
PlotOHLC(SenkouA,SenkouA,SenkouB,SenkouB,"",IIf(SenkouA>SenkouB,KumoUpCol,KumoDnCol),styleCloud | styleNoLabel,Null,Null,SenkouKumoShft);
_SECTION_END();

_SECTION_BEGIN("BK");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor( ParamColor("Color Axes", colorBlack) );
SetChartBkGradientFill( ParamColor("BgTop", colorWhite),ParamColor("BgBottom", colorDarkGrey));
_SECTION_END();

_SECTION_BEGIN("AuthorName");
k = (GetPerformanceCounter()/100)%100;
printf("GetPerformance Counter %g",k);
GfxSelectFont("comics", 14,800);
GfxSetBkMode(1);
GfxSetTextColor(colorWhite);
GfxTextOut("ABDEL01S",-10+k,20);
RequestTimedRefresh(10);
_SECTION_END();



/*
Interpreting the Chart

Strong signals - A strong Buy Signal occurs when the Tenkan-Sen crosses above the Kijun-Sen from below.
A strong Sell Signal occurs when the opposite occurs. The signals must be above the Kumo.

Normal signals - A normal Buy Signal occurs when the Tenkan-Sen crosses above the Kijun-Sen from below.
A normal Sell Signal occurs when the opposite occurs. The signals must be within the Kumo.

Weak signals - A weak Buy Signal occurs when the Tenkan-Sen crosses above the Kijun-Sen from below.
A weak Sell Signal occurs when the opposite occurs. The signals must be below the Kumo.

Overall strength - Strength is shown to be with the sellers if the Chikou Span is below the current price.
Strength is shown to be with the buyers when the opposite is True.

Support/resistance levels - Support AND resistance levels are represented by the presence of the Kumo.
if the price is entering the Kumo from below, then the price is at a resistance level.
if the price is falling into the Kumo, then there is a support level.

Trends - Trends can be determined by simply looking at where the current price is in relation to the Kumo.
if the price stays below the Kumo, then there is a downward trend (bearish).
Alternatively, if the price stays above the Kumo, then there is an upward trend (bullish).

//http://www.investopedia.com/articles/technical/04/072104.asp

//------------------------------------------------------------------------------
//
// Formula Name: Trending Ribbon
// Author/Uploader: Jim Wiehe
// E-mail:
// Date/Time Added: 2006-07-17 06:22:25
// Origin: It leaked out of my brain.
// Keywords: ADX and MACD
// Level: basic
// Flags: indicator
// Formula URL: http://www.amibroker.com/library/formula.php?id=635
// Details URL: http://www.amibroker.com/library/detail.php?id=635
//
//------------------------------------------------------------------------------
//
// This uses the nifty ribbon function in Amibroker. I use this in most of my
// price charts because it reduces the clutter with too many indicators on the
// screen. So if the ribbon is green both the MACD and ADX have started
// trending up. If the ribbon is red both the MACD and ADX are trending down.
//
//------------------------------------------------------------------------------

// Paste the code below to your price chart somewhere and green ribbon means both
// both MACD and ADX trending up so if the red ribbon shows up the MACD and the ADX
// are both trending down.

Plot( C, "", colorBlack, styleBar, 0, 0, 0 );
Title = "mouseButtons returns: " + (GetCursorMouseButtons()) + "\nclick counter: " + StaticVarGet("counter");



This code is giving error. Please provide new code.
 
#12
There is no errors, sometimes copying from Web adds some spacess. here is the correct one.
Have a good day...


_SECTION_BEGIN("Price");
HAswitch = ParamToggle("Heikin Ashi","Off,On");
PriceUpCol = ParamColor("Price UP Color",colorGreen);
PriceDnCol = ParamColor("Price DN Color",colorRed);
PriceSty = ParamStyle("Price Style",styleCandle,maskDefault | styleCandle | styleBar);

HaClose = ( O+H+L+C ) / 4;
HaOpen = AMA( Ref(HaClose, -1), 0.5);
HaHigh = Max(H, Max(HaClose, HaOpen));
HaLow = Min(L, Min(HaClose, HaOpen));

if(HAswitch)
PlotOHLC(HaOpen,HaHigh,HaLow,HaClose,"Heikin Ashi",IIf(HaClose > HaOpen,PriceUpCol,PriceDnCol),PriceSty);
else
Plot(C,"Price",IIf(C > Ref(C,-1), PriceUpCol, PriceDnCol), PriceSty);
_SECTION_END();

_SECTION_BEGIN("Tenkan-Sen");
TenkanPer = Param("Tenkan-Sen Period",9,1,100,1);
TenkanCol = ParamColor("Tenkan-Sen Color",colorRed);
TenkanSty = ParamStyle("Tenkan-Sen Style",styleLine | styleThick);
Tenkan = ( HHV(H,TenkanPer) + LLV(L,TenkanPer) ) / 2;
Plot(Tenkan,"Tenkan",TenkanCol,TenkanSty);
_SECTION_END();

_SECTION_BEGIN("Kijun-Sen");
KijunPer = Param("Kijun-Sen Period",26,1,100,1);
KijunCol = ParamColor("Kijun-Sen Color",colorBlue);
KijunSty = ParamStyle("Kijun-Sen Style",styleLine | styleThick);
Kijun = ( HHV(H,KijunPer) + LLV(L,KijunPer) ) / 2;
Plot(Kijun,"Kijun",KijunCol,KijunSty);
_SECTION_END();

_SECTION_BEGIN("Chikou Span");
ChikouShft = Param("Chikou Span Shift",26,1,100,1);
ChikouCol = ParamColor("Chikou Span Color",colorViolet);
ChikouSty = ParamStyle("Chikou Span Style",styleLine | styleNoLabel);
Chikou = C;
Plot(Chikou,"",ChikouCol,ChikouSty,Null,Null,-ChikouShft);
_SECTION_END();

_SECTION_BEGIN("Senkou-Kumo");
SenkouKumoShft = Param("Senkou-Kumo Shift",26,0,100,1);
_SECTION_END();

_SECTION_BEGIN("Senkou Span A");
SenkouACol = ParamColor("Senkou Span A Color",colorSeaGreen);
SenkouASty = ParamStyle("Senkou Span A Style",styleLine);
SenkouA = ( Tenkan + Kijun ) / 2;
Plot(SenkouA,"Senkou A",SenkouACol,SenkouASty,Null,Null,SenkouKumoShft) ;
_SECTION_END();

_SECTION_BEGIN("Senkou Span B");
SenkouBPer = Param("Senkou Span B Period",52,1,200,1);
SenkouBCol = ParamColor("Senkou Span B Color",colorPink);
SenkouBSty = ParamStyle("Senkou Span B Style",styleLine);
SenkouB = ( HHV(H,SenkouBPer) + LLV(L,SenkouBPer) ) / 2;
Plot(SenkouB,"SenkouB",SenkouBCol,SenkouBSty,Null,Null,SenkouKumoShft) ;
_SECTION_END();

_SECTION_BEGIN("Kumo");
KumoUpCol = ParamColor("Kumo UP Color",colorSeaGreen);
KumoDnCol = ParamColor("Kumo DN Color",colorPink);
PlotOHLC(SenkouA,SenkouA,SenkouB,SenkouB,"",IIf(SenkouA>SenkouB,KumoUpCol,KumoDnCol),styleCloud | styleNoLabel,Null,Null,SenkouKumoShft);
_SECTION_END();

_SECTION_BEGIN("BK");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor( ParamColor("Color Axes", colorBlack) );
SetChartBkGradientFill( ParamColor("BgTop", colorWhite),ParamColor("BgBottom", colorDarkGrey));
_SECTION_END();

_SECTION_BEGIN("AuthorName");
k = (GetPerformanceCounter()/100)%100;
printf("GetPerformance Counter %g",k);
GfxSelectFont("comics", 14,800);
GfxSetBkMode(1);
GfxSetTextColor(colorWhite);
GfxTextOut("ABDEL01S",-10+k,20);
RequestTimedRefresh(10);
_SECTION_END();

_SECTION_BEGIN("Cross");
SL = ( HHV( H, 26 ) + LLV( L, 26) )/2;
TL = ( HHV( H, 9 ) + LLV( L, 9 ) )/2;
//DL = Ref( C, 26 );
DL=C;
Span1 = (( SL + TL )/2);
Span2 = (HHV( H, 52) + LLV(L, 52))/2;

above=IIf((C>=Ref(Span1,-26) AND C>=Ref(Span2,-26)),1,0);
withinup=IIf((C>=Ref(Span1,-26) AND C<=Ref(Span2,-26)),1,0) ;
withindn=IIf((C<=Ref(Span1,-26) AND C>=Ref(Span2,-26)),1,0);
below=IIf((C<=Ref(Span1,-26) AND C<=Ref(Span2,-26)),1,0);

dlup=DL>Ref(C,-26) ;
stocup=StochK()>StochD() ;
MFIup=MFI()>MA(MFI(),7) ;
MACDup=MACD()>Signal() ;
Lim=ADX()<30 AND StochK()<70 ;
PDIup=PDI()>MDI() ;

Buy = Cross(TL,SL) AND macdup OR
Cross(MACD(),Signal()) AND TL>SL AND lim OR
Cross(C,SL) AND MACDup AND dlup OR
Cross(MACD(),Signal()) AND C>SL AND dlup AND lim OR
Cross(DL,Ref(C,-26)) AND MACDup OR
Cross(MACD(),Signal()) AND dlup AND Lim OR
Cross(StochK(),StochD()) AND StochK()<50 AND L>=SL AND TL>SL AND PDIup AND dlup ;
Sell = Cross(SL,TL);

StrongBuy = Buy AND above;
MediumBuy = Buy AND withinup OR Buy AND withindn;
WeakBuy = Buy AND below;
StrongSell = Sell AND below;
MediumSell = Sell AND withinup OR Sell AND withindn;
WeakSell = Sell AND above;

PlotShapes(IIf(StrongBuy,shapeUpTriangle,shapeNone ),colorBlue,0,Low,Offset=-15);
PlotShapes(IIf(MediumBuy,shapeUpArrow,shapeNone),colorBlue,0,Low,Offset=-15);
PlotShapes(IIf(WeakBuy,shapeHollowUpArrow,shapeNone),colorBlue,0,Low,Offset=-15);
PlotShapes(IIf(StrongSell,shapeDownTriangle,shapeNone),colorRed,0,High,Offset=-15);
PlotShapes(IIf(MediumSell,shapeDownArrow,shapeNone ),colorRed,0,High,Offset=-15);
PlotShapes(IIf(WeakSell,shapeHollowDownArrow,shapeNone),colorRed,0,High,Offset=-15);
_SECTION_END();
 
Last edited:
#15
Use parameter of the chart, to change line as dash line. :)
 

kiran_thiru

Well-Known Member
#16
Use parameter of the chart, to change line as dash line. :)
sir, it changed just line. but cloud was thick. how can we change the cloud area as dashes instead of thick like mt4 indicator?
 
#17
sir, it changed just line. but cloud was thick. how can we change the cloud area as dashes instead of thick like mt4 indicator?
I will check after market if it can be changed using parameters. But is it no necessary, I do not think it make any difference in reading a thick cloud ichimoku chart.
BTW, sir aadmi ke dhad (body) ke upar hi theek hai, yehan nahin. Right naa.
 

amsin21

Well-Known Member
#18
Have a look on my AFL used daily in intraday. Customized for my personal use. Code components are grabbed from internet. You can toggle on/off all the components of Ichimoku. It has sound alerts when TK/KS crossover happens..Enjoy

_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", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

///////////////////////////////////////////////////////////////////////
function SayNotTooOften2( text2, Minperiod2 )
{
elapsed2=GetPerformanceCounter()/1000;
Lastelapsed2 = Nz( StaticVarGet("lastsaytime2") );

if( elapsed2 - Lastelapsed2 > Minperiod2 )
{
StaticVarSet("lastsaytime2", elapsed2 );
Say( text2 );
}
}
///////////////////////////////////////////////////////////////////////
function SayNotTooOften3( text3, Minperiod3 )
{
elapsed3=GetPerformanceCounter()/1000;
Lastelapsed3 = Nz( StaticVarGet("lastsaytime3") );

if( elapsed3 - Lastelapsed3 > Minperiod3 )
{
StaticVarSet("lastsaytime3", elapsed3 );
Say( text3 );
}
}


//***************************************************** Ichimoku : Tenkan-sen (Conversion Line) ***************************************//
_SECTION_BEGIN("Ichimoku-TK");

P1 = Param("Conversion Period", 9, 2, 200, 1, 0);
C1 = ParamColor("Conversion Color", colorRed);
CL = (HHV(H,P1)+LLV(L,P1))/2;
if( ParamToggle("Plot TK", "No|Yes", 0 ) )
{
Plot(CL,"Tenkan-sen", C1, ParamStyle("Style"));
}
else
{
}
_SECTION_END();



//***************************************************** Ichimoku : Kijun-sen (Base Line) ***************************************//
_SECTION_BEGIN("Ichimoku-KS");

P2 = Param("Base Period", 26, 2, 200, 1, 0);
C2 = ParamColor("Base Color", ColorRGB(0,128,255));
BL = (HHV(H,P2)+LLV(L,P2))/2;
if( ParamToggle("Plot KS", "No|Yes", 0 ) )
{
Plot(BL, "Kijun-sen", C2, ParamStyle("Style"));
}
else
{
}
_SECTION_END();



//***************************************************** Ichimoku : TK|KS crossover alert ***************************************//

_SECTION_BEGIN("Ichimoku-TKKSAlert");
Buy1=Cross(CL,BL);
Sell1=Cross(BL,CL);
Short1=Sell1;
Cover1=Buy1;
Buy1=ExRem(Buy1,Sell1);
Sell1=ExRem(Sell1,Buy1);
Short1=ExRem(Short1,Cover1);
Cover1=ExRem(Cover1,Short1);
AlertIf( Buy1, "SOUND c:\\Ichimoku.wav", "Audio alert",0,1+2+4+8);
AlertIf( Sell1, "SOUND c:\\Ichimoku.wav", "Audio alert",0,1+2+4+8);

shape = Buy1 * shapeHollowUpArrow + Sell1 * shapeHollowDownArrow;

if(LastValue(Buy1)) SayNotTooOften2(Name()+Interval(2)+"Buy Ichimoku",180);
if(LastValue(Sell1)) SayNotTooOften3(Name()+Interval(2)+"Sell Ichimoku",180);

if( ParamToggle("Ichimoku : TK|KS crossover - arrows", "No|Yes", 0 ) )
{
PlotShapes( shape, IIf( Buy1, colorBrightGreen, colorLightOrange ), 0, IIf( Buy1, Low, High ) );
}
else
{
}
_SECTION_END();

//***************************************************** Ribbon Ichimoku:TK|KS ***************************************//


_SECTION_BEGIN("Ribbon-Ichimoku");

if( ParamToggle("Ribbon - Ichimoku:TK|KS", "No|Yes", 0 ) )
{
Ribbon1=IIf( CL>BL ,colorDarkOliveGreen, IIf(BL>CL, colorGrey40,colorOrange));
Plot(1, "Ribbon", Ribbon1, styleOwnScale| styleArea| styleNoLabel,-0.5,100);
}
else
{
}
_SECTION_END();


//***************************************************** Ichimoku : Senkou Span (Leading Span)***************************************//

_SECTION_BEGIN("Ichimoku-SS");

P3 = Param("Leading Span Displacement", 26, 2, 200, 1, 0);
C3 = ParamColor("Leading A Color", ColorRGB(38,98,98));
LSA = (CL+BL)/2;

P4 = Param("Leading B Span", 52, 2, 200, 1, 0);
C4 = ParamColor("Leading B Color", ColorRGB(106,27,0));
LSB = (HHV(H,P4)+LLV(L,P4))/2;
if( ParamToggle("Plot SS", "No|Yes", 0 ) )
{
Plot(LSA, "Senkou Span A", C3, ParamStyle("Style"), 0, 0, P3);
Plot(LSB, "Senkou Span B", C4, ParamStyle("Style"), 0, 0, P3);
}
else
{
}

_SECTION_END();


//***************************************************** Ichimoku : Chikou Span (Lagging Span) ***************************************//
_SECTION_BEGIN("Ichimoku-CS");
P5 = Param("Lagging Displacement", -26, 2, 200, 1, 0);
C5 = ParamColor("Lagging Color", ColorRGB(83,83,0));
if( ParamToggle("Plot CS", "No|Yes", 0 ) )
{
Plot(C, "Chikou Span", C5, ParamStyle("Style"), 0, 0, P5);
}
else
{
}

//***************************************************** Ichimoku : Cloud ***************************************//

_SECTION_BEGIN("Ichimoku-Cloud");
C6 = ParamColor("LSA", ColorRGB(0,23,23));
C7 = ParamColor("LSB", ColorRGB(40,0,0));
if( ParamToggle("Plot Cloud", "No|Yes", 0 ) )
{
PlotOHLC (LSA,LSA,LSB,LSB,"Cloud",IIf(LSA>LSB,C6,C7),styleCloud, 0, 0, P3);
}
else
{
}
_SECTION_END();

_SECTION_BEGIN("Price Line");

PriceLineColor=ParamColor("PriceLineColor",ColorRGB(82,82,82));
PriceLevel = ParamField("PriceField", field = 3 );

Daysback = Param("Bars Back",100,10,500,1);
FirstBar = BarCount - DaysBack;
YY = IIf(BarIndex() >= Firstbar,EndValue(PriceLevel),Null);

Plot(YY,"Current Price",PriceLineColor,ParamStyle("LineStyle",styleLine|styleDashed|styleNoTitle|styleNoLabel,maskAll));


side = Param("side",1,0,1000,1);

dist = -1;

for( i = 0; i < BarCount; i++ )
{
if(i+side== BarCount) PlotText( " " + PriceLevel[ i ], i, YY[ i ]-dist, colorLightBlue );
}


_SECTION_END();

 

Similar threads