Can someone correct below afl

#1
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();
 

KelvinHand

Well-Known Member
#2
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();
1. Replace all “ to "
2. Replace all ” to "
3. Replace all – to -
4. Change Span 2 to Span2 at Ln 47
 
Last edited:
#3
_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>Span 2,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();
 

KelvinHand

Well-Known Member
#4
_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>Span 2,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();
Still not completed yet.
One look you can see your left enclosing " is ok, but right enclosing ” is still not done and
You did not press the "Verify Syntax" button to check.

The AFL Editor to do the replace is not so good, it manual one by one and you may landed replace only some part.
What you should do is to use wordpad (or other powerful editor) to replace all at once.
then copy to the afl editor to "Verify Syntax" again.
 
Last edited:
#5
Hi KelvinHand,

I made changes as suggested by you and below is the final corrected and working afl. Thaks a lot KelvinHand, you are a genius!!:clap::clap:

_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();

1. Replace all to "
2. Replace all to "
3. Replace all to -
4. Change Span 2 to Span2 at Ln 47
 

KelvinHand

Well-Known Member
#6
Hi KelvinHand,

I made changes as suggested by you and below is the final corrected and working afl. Thaks a lot KelvinHand, you are a genius!!:clap::clap:
Great Job done.

Ln 47 error without bracketing with "code""/code" or "html""\html" will already cause those copy from your "Quote""\Quote" error.
See this I correct the problem immediately 3-4 times, Span2 keep separated into Span 2
PlotOHLC(Span1,Span2,Span1,Span2,"",IIf(Span1>Span2,8,9),styleCloud|4096,0,0,26);

with this
Code:
PlotOHLC(Span1,Span2,Span1,Span2,"",IIf(Span1>Span2,8,9),styleCloud|4096,0,0,26);
 
Last edited:

ayush2020

Well-Known Member
#7
Hi KelvinHand,

I made changes as suggested by you and below is the final corrected and working afl. Thaks a lot KelvinHand, you are a genius!!:clap::clap:

_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();
post some images...
 

Similar threads