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

#1
Hi

AFL Experts

Could anyone add buy sell signal in the following afl. I tried but could not do it. If u can please help me.

FYI, Would like to see buy/sell arrow when candle touches red color bands.

Thanks




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, "", colorLime);
Plot(B1, "", colorLime);
Plot(T2, "", colorRed);
Plot(B2, "", colorRed);

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

johnnypareek

Well-Known Member
#4
Well, The code looks into futures. 44 Future data are used so buy sell signal will be changed. Though, You can use it as some kind of confirmation. I will try to fix.

johnny
 
#7
Johnny sir, did you get any chance to fix this ?
@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
 

prabhsingh

Well-Known Member
#10
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?
 

Similar threads