Experts please help to add buy/sell signal in the following AFL

#11
@san

please post the manual .. or where did you get the code from..?

it is similar to keltner bands and bollinger bands...
i have tried to add buy and sell..

please post the manual or the buy and sell ruless..



CY1 = Param("Short Cycle Length?" ,10, 1 ,1000 ,1 )/2;
CY2 = Param("Medium Cycle Length?" ,80, 1 ,1000 ,1 )/2;
M1 = Param("Short Cycle Multiplyer?" ,1, 0.01 ,10 ,1 );
M2 = Param("Medium Cycle Multiplyer?" ,3, 0.01 ,10 ,1 );
T1 = Ref(MA(Close ,CY1 ),CY1/2)+ M1*ATR(CY1 );
B1 = Ref(MA( Close ,CY1 ),CY1/2)- M1*ATR(CY1 );
T2 = Ref(MA(Close ,CY2 ),CY2/2)+ M2*ATR(CY2 );
B2 = Ref(MA( Close ,CY2 ),CY2/2)- M2*ATR(CY2 );

Plot(T1, "", colorBlue);
Plot(B1, "", colorLime);
Plot(T2, "", colorRed);
Plot(B2, "", colorBlack);

Sell = Cross(T2,T1) AND Close < Open AND Close < Ref(Close,-1);
Buy = Cross(B2,B1) AND Close > Open AND Close > Ref(Close,-1);
GraphXSpace = 5;
_SECTION_BEGIN( "Price" );
SetChartOptions( 0, chartShowDates | chartShowArrows | chartLogarithmic | chartWrapTitle );
_N( Title = StrFormat( "{{NAME}} - " + SectorID( 1 ) + " - {{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", colorBlack, styleCandle | 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 ) ) );
}
_SECTION_END();

please post the manual.. and please backtest before trading ,, iam not sure
thank you


Thanks a lot sir. i got this code from wisestocktrader. It's called hurts band. i was watching this from last few weeks. it looks okay when confirmation with other indicators like macd,rsi, stoch... i understand it looks future. i do not have any manual sir...

but, would like to see buy sell singla when the candle touches upper/lower red bands.

Once again thanks.

regards
Santhosh
 

amibrokerfans

Well-Known Member
#12
Amibrokerfans,

Kindly can you throw some light how to trade using "Hurst Bands".Do we need to watch whether price is touching the envelop or not and then only take a position?
dear

few days ago i posted a collection of cycle indicator in a new thread here. u can download those. there are few indis on hurst. play with them. and before u use those indi, u have to understand what they mean. only i can say, its very hard topic! need years of study and experiments to know about it. i am just started it..
 
Last edited:
#14
dear

few days ago i posted a collection of cycle indicator in a new thread here. u can download those. there are few indis on hurst. play with them. and before u use those indi, u have to understand what they mean. only i can say, its very hard topic! need years of study and experiments to know about it. i am just started it..

Thank you bro :)
 
#15
CY1 = Param("Short Cycle Length?" ,10, 1 ,1000 ,1 )/2;
CY2 = Param("Medium Cycle Length?" ,80, 1 ,1000 ,1 )/2;
M1 = Param("Short Cycle Multiplyer?" ,1, 0.01 ,10 ,1 );
M2 = Param("Medium Cycle Multiplyer?" ,3, 0.01 ,10 ,1 );
T1 = Ref(MA(Close ,CY1 ),CY1/2)+ M1*ATR(CY1 );
B1 = Ref(MA( Close ,CY1 ),CY1/2)- M1*ATR(CY1 );
T2 = Ref(MA(Close ,CY2 ),CY2/2)+ M2*ATR(CY2 );
B2 = Ref(MA( Close ,CY2 ),CY2/2)- M2*ATR(CY2 );

Plot(T1, "", colorBlue);
Plot(B1, "", colorLime);
Plot(T2, "", colorRed);
Plot(B2, "", colorBlack);

Sell = Cross(T2,T1) AND Close < Open AND Close < Ref(Close,-1);
Buy = Cross(B2,B1) AND Close > Open AND Close > Ref(Close,-1);
GraphXSpace = 5;

Cover = Buy ;
Short = Sell;

SetPositionSize(1,spsShares);

PlotShapes(IIf(Buy==1, shapeUpArrow , shapeNone), colorWhite, 0,Low, Offset=-20);
PlotShapes(IIf(Sell==1, shapeDownArrow, shapeNone), colorWhite, 0,High, Offset=-20);

_SECTION_BEGIN( "Price" );
SetChartOptions( 0, chartShowDates | chartShowArrows | chartLogarithmic | chartWrapTitle );
_N( Title = StrFormat( "{{NAME}} - " + SectorID( 1 ) + " - {{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", colorBlack, styleCandle | 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 ) ) );
}
_SECTION_END();
 
#17
is the following afl repaint or works fine ? how to find afl is non repaint one ?

_SECTION_BEGIN("315 cross");
Plot(Close,"Price",colorBlack, styleCandle);
Plot(EMA(Close,3),"3EMA",colorBlue,style=styleThick);
Plot(EMA(Close,15),"15EMA",colorRed,style=styleThick);
Buy=Cross(EMA(Close,3),EMA(Close,15));
Sell=Cross(EMA(Close,15),EMA(Close,3));
Short=Sell;
Cover=Buy;
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );
_SECTION_END();


_SECTION_BEGIN("Ribbon");

no=Param( "Swing", 20, 1, 55 );
res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot( 2, "Ribbon",IIf(C>tsl,colorBlue,colorRed),styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
_SECTION_END();

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

rrrajguru

Well-Known Member
#18
is the following afl repaint or works fine ? how to find afl is non repaint one ?

_SECTION_BEGIN("315 cross");
Plot(Close,"Price",colorBlack, styleCandle);
Plot(EMA(Close,3),"3EMA",colorBlue,style=styleThick);
Plot(EMA(Close,15),"15EMA",colorRed,style=styleThick);
Buy=Cross(EMA(Close,3),EMA(Close,15));
Sell=Cross(EMA(Close,15),EMA(Close,3));
Short=Sell;
Cover=Buy;
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );
_SECTION_END();


_SECTION_BEGIN("Ribbon");

no=Param( "Swing", 20, 1, 55 );
res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot( 2, "Ribbon",IIf(C>tsl,colorBlue,colorRed),styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
_SECTION_END();

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() );
This AFL is not repainting, working fine.

If buy / sell arrows or signals change with time, some time vanish, then come again, then it is repainting for sure.
 

Similar threads