Hi,
I found below afl somewhere on net but its giving error in Amibroker 5.50, can someone correct this afl. I don't know much about afl but believe it is for Ichimoku. Thanks in advance!!
_SECTION_BEGIN(bands);
CStyle = ParamToggle(BANDS?,N|Y);
if(Cstyle)
{
TOPP = ParamField(TOPPField,1);
BOTP = ParamField(BOTPField,2);
type = ParamList(Type , Keltner Bands|Bollinger Bands|Percent Bands);
TOPPeriods = Param(TOPPeriods, 21, 2, 300 );
BOTPeriods = Param(BOTPeriods, 21, 2, 300 );
Width = Param(Width, 2, 0, 10, 0.05 );
Color = ParamColor(Color, colorCycle );
Style = ParamStyle(Style);
TOPCenterLine = MA( TOPP, TOPPeriods );
DOWNCenterLine = MA( BOTP, BOTPeriods );
KTop = TOPCenterLine + Width * ATR( TOPPeriods );
KBot = DOWNCenterLine Width * ATR( BOTPeriods );
if( Type == Keltner Bands )
{Plot( KTop, KBTop + _PARAM_VALUES(), Color, Style );
Plot( KBot, KBBot + _PARAM_VALUES(), Color, Style ); }
else if( Type == Bollinger Bands )
{Plot( BBandTop( TOPP, TOPPeriods, Width ), BBTop + _PARAM_VALUES(), Color, Style );
Plot( BBandBot( BOTP, BOTPeriods, Width ), BBBot + _PARAM_VALUES(), Color, Style );}
else if( Type == Percent Bands )
{Plot( (1 + Width * 0.01) * TOPCenterLine, %EnvTop + _PARAM_VALUES(), Color, Style );
Plot( (1 Width * 0.01) * DOWNCenterLine, %EnvBot + _PARAM_VALUES(), Color, Style );
}
}
_SECTION_BEGIN(ichimoku kiyo);
//=======================================================================
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat({{NAME}} {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol +WriteVal( V, 1.0 ) + {{VALUES}}, O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, Close, ParamColor(Color, colorBlack ), styleNoTitle | ParamStyle(Style) | GetPriceStyle() );
if( ParamToggle(Tooltip shows, All Values|Only Prices ) )
{
ToolTip=StrFormat(Open: %g\nHigh: %g\nLow: %g\nClose: %g (%.1f%%)\nVolume: +NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 )));
}
SL = ( HHV( H, 26 ) + LLV( L, 26) )/2;
TL = ( HHV( H, 9 ) + LLV( L, 9 ) )/2;
DL = Ref( C, 26 );
Span1 = (( SL + TL )/2);
Span2 = (HHV( H, 52) + LLV(L, 52))/2;
//Plot(SL,SL,2,styleThick); // standard, base, or kijun-sen line
//Plot(TL,TL,2,styleThick); // turning, conversion, or tenkan-sen line
//Plot(DL,",colorLightBlue,styleLine); // delayed, lagging, or chikou span
Plot(Span1,",colorGreen,1,0,0,26); // senkou span A, kumo, or white clouds
Plot(Span2,",colorSeaGreen,1,0,0,26); // senkou span B, kumo, or white clouds
PlotOHLC(Span1,Span2,Span1,Span2,",IIf(Span1>Span2,8,9),styleCloud|4096,0,0,26);
Buy = Cross(TL,SL);
Sell = Cross(SL,TL);
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
//PlotShapes(shape,IIf(Buy,colorDarkGreen,colorRed), 0,IIf//(Buy,Low,High));
//==========================================================
_SECTION_END();
_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() );
HI = Close > Ref(HHV(High,260),-1);
LW = Close < Ref(LLV(Low,260),-1);
Valueofrsi = RSI(100);
NHI = Valueofrsi > Ref(HHV(RSI(100),260),-1);
Filter = NHI;
AddColumn( Close > Ref(HHV(High,260),-1), 52 Week High, 1 );
AddColumn( Close < Ref(LLV(Low,260),-1), 52 Week Low, 1 );
AddColumn( C, Close, 1.2 );
_SECTION_END();
I found below afl somewhere on net but its giving error in Amibroker 5.50, can someone correct this afl. I don't know much about afl but believe it is for Ichimoku. Thanks in advance!!
_SECTION_BEGIN(bands);
CStyle = ParamToggle(BANDS?,N|Y);
if(Cstyle)
{
TOPP = ParamField(TOPPField,1);
BOTP = ParamField(BOTPField,2);
type = ParamList(Type , Keltner Bands|Bollinger Bands|Percent Bands);
TOPPeriods = Param(TOPPeriods, 21, 2, 300 );
BOTPeriods = Param(BOTPeriods, 21, 2, 300 );
Width = Param(Width, 2, 0, 10, 0.05 );
Color = ParamColor(Color, colorCycle );
Style = ParamStyle(Style);
TOPCenterLine = MA( TOPP, TOPPeriods );
DOWNCenterLine = MA( BOTP, BOTPeriods );
KTop = TOPCenterLine + Width * ATR( TOPPeriods );
KBot = DOWNCenterLine Width * ATR( BOTPeriods );
if( Type == Keltner Bands )
{Plot( KTop, KBTop + _PARAM_VALUES(), Color, Style );
Plot( KBot, KBBot + _PARAM_VALUES(), Color, Style ); }
else if( Type == Bollinger Bands )
{Plot( BBandTop( TOPP, TOPPeriods, Width ), BBTop + _PARAM_VALUES(), Color, Style );
Plot( BBandBot( BOTP, BOTPeriods, Width ), BBBot + _PARAM_VALUES(), Color, Style );}
else if( Type == Percent Bands )
{Plot( (1 + Width * 0.01) * TOPCenterLine, %EnvTop + _PARAM_VALUES(), Color, Style );
Plot( (1 Width * 0.01) * DOWNCenterLine, %EnvBot + _PARAM_VALUES(), Color, Style );
}
}
_SECTION_BEGIN(ichimoku kiyo);
//=======================================================================
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat({{NAME}} {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol +WriteVal( V, 1.0 ) + {{VALUES}}, O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, Close, ParamColor(Color, colorBlack ), styleNoTitle | ParamStyle(Style) | GetPriceStyle() );
if( ParamToggle(Tooltip shows, All Values|Only Prices ) )
{
ToolTip=StrFormat(Open: %g\nHigh: %g\nLow: %g\nClose: %g (%.1f%%)\nVolume: +NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 )));
}
SL = ( HHV( H, 26 ) + LLV( L, 26) )/2;
TL = ( HHV( H, 9 ) + LLV( L, 9 ) )/2;
DL = Ref( C, 26 );
Span1 = (( SL + TL )/2);
Span2 = (HHV( H, 52) + LLV(L, 52))/2;
//Plot(SL,SL,2,styleThick); // standard, base, or kijun-sen line
//Plot(TL,TL,2,styleThick); // turning, conversion, or tenkan-sen line
//Plot(DL,",colorLightBlue,styleLine); // delayed, lagging, or chikou span
Plot(Span1,",colorGreen,1,0,0,26); // senkou span A, kumo, or white clouds
Plot(Span2,",colorSeaGreen,1,0,0,26); // senkou span B, kumo, or white clouds
PlotOHLC(Span1,Span2,Span1,Span2,",IIf(Span1>Span2,8,9),styleCloud|4096,0,0,26);
Buy = Cross(TL,SL);
Sell = Cross(SL,TL);
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
//PlotShapes(shape,IIf(Buy,colorDarkGreen,colorRed), 0,IIf//(Buy,Low,High));
//==========================================================
_SECTION_END();
_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() );
HI = Close > Ref(HHV(High,260),-1);
LW = Close < Ref(LLV(Low,260),-1);
Valueofrsi = RSI(100);
NHI = Valueofrsi > Ref(HHV(RSI(100),260),-1);
Filter = NHI;
AddColumn( Close > Ref(HHV(High,260),-1), 52 Week High, 1 );
AddColumn( Close < Ref(LLV(Low,260),-1), 52 Week Low, 1 );
AddColumn( C, Close, 1.2 );
_SECTION_END();