Need AFL for Stochastic...Experts Please help..

asnavale

Well-Known Member
#51
Anant,

Waiting for the new AFL,

Buy crossover below 20 triggers the buy and sell crossover above 80 triggers sell.

Kindly help me Anant sir

Awaiting your reply..

Regards,
Arvind
Hi Arvind,

Modify the Buy and Sell lines as follows:

Buy = Cross(SK, SD) AND SD<= 20;
Sell = Cross(SD, SK) AND SK >= 80;

-Anant
 
#52

Nehal_s143

Well-Known Member
#53
Dear friend,
Iam using it with 5 min charts. It give buy signal when the stoch indicator goes below 20 and after crossing entry it gives buy signal .for further confirmation use ema34 along with it.
similarly for sell signal when the stoch indicator crosses above 80 and comes below 80 it gives sell signal .confiwm with ema 34.
People following this please do paper trade for atleast 5 days to familrise the chart indicators.
regards
bala
this system is sold by some website tradingsystem . in for 4k
 
#54
below afl uses zig so cant be used for trading..since this function looks into future values...run bar reply n see signals ...how thy r moving

anant bhai,
i have develped this expl afl, can u try it and help to remove the short comings?

_SECTION_BEGIN("MACD Exploration");
r1 = Param( "Fast avg", 15, 2, 200, 1 );
r2 = Param( "Slow avg", 30, 2, 200, 1 );
r3 = Param( "Signal avg", 12, 2, 200, 1 );
Z=Param("zig",1,0,10,0.1);
periods = Param( "Periods", 25, 1, 200, 1 );
Ksmooth = Param( "%K avg", 5, 1, 200, 1 );
Dsmooth = Param( "%D avg", 5, 1, 200, 1 );
Volume_1=Param("V",20,1,100,1);
TP1 = Param("TP1",20,1,100,1);
TP2 = Param("TP2",80,1,100,1);

A1 = StochK( periods , Ksmooth) - StochD( periods , Ksmooth, DSmooth );
A2 = StochD( periods , Ksmooth, DSmooth ) - StochK( periods , Ksmooth);

Cond1 = Cross(MACD(r1,r2),Signal(r1,r2,r3));

Cond2 = A1>0;

Cond3 = StochK( periods , Ksmooth)>TP1;

Cond7 = Zig(C,z)>Ref(Zig(C,z),-1);

Cond9 = V>Ref(V*(1+(Volume_1/100)),-1);

Cond11 = Ref(StochK( periods , Ksmooth),-2)<TP1;


Buy = Cond1 AND Cond2 AND Cond3 AND Cond7 AND Cond9 AND Cond11;

Cond4 = Cross(Signal(r1,r2,r3),MACD(r1,r2));

Cond5 = A2>0;

Cond6 = StochK( periods , Ksmooth)<TP2;

Cond8 = Zig(C,z)<Ref(Zig(C,z),-2);

Cond10 = V>Ref(V*(1+(Volume_1/100)),-1);

Cond12 = Ref(StochK( periods , Ksmooth),-2)>TP2;

Sell = Cond4 AND Cond5 AND Cond6 AND Cond8 AND Cond10 AND Cond12;

Trigger = WriteIf(Buy, "Buy", "") + WriteIf(Sell, "Sell", "");

_N(Title = StrFormat("{{NAME}} {{DATE}} {{INTERVAL}}: O=%1.2f, H=%1.2f, L=%1.2f, C=%1.2f, V=%1.0f\n{{VALUES}}", O, H, L, C, V));

BG = IIf(Buy, colorPaleGreen, IIf(Sell, colorPink, colorDefault));
FG = IIf(Buy, colorDarkGreen, IIf(Sell, colorDarkRed, colorDefault));

Filter = Buy OR Sell;
AlertIf(Buy, "SOUND C:\\Windows\\Media\\Siren.wav", "Buy",1,1,100 );
AlertIf(Sell, "SOUND C:\\Windows\\Media\\SOUND4.wav", "Sell",2,1,100);
SetOption("NoDefaultColumns", True);

AddTextColumn(Name(), "Symbol", 77, FG, BG, 120);
AddColumn(DateTime(), "Date", formatDateTime, FG, BG, 100);
AddColumn(TimeNum() ,"Time",1, FG, BG, 100);
AddColumn(V/Ref(V,-1)*100,"Increase in Vol",1, FG, BG, 100);
AddColumn( C, "Close",0, FG, BG, 100);
AddColumn( H, "High", 0, FG, BG, 100);
AddColumn(V, "Volume",1, FG, BG, 100);
AddColumn(Ref(V,-1),"P-Vol",1, FG, BG, 100);

AddColumn( Buy, "Buy", 1);
AddColumn( Sell, "Sell", 1);

_SECTION_END();
 
#55
Hi,

I tried to use it but not working and gives msg as follows:

You need to define NumColumns variable.

Since I am not an engineer possibly I am not knowing how to use thisfor
exploration. Pl guide me. Thanks in advance.
 
#56
IAM USING ONE AMIBROKER INTRADAY INDICATORE

I NEED TO ADD MY OWN BACKTESTING FOR BUY SELL INDICATOR

MY NEED IS:::

BUY CONDITION: ALL BUY SIGNAL BUY ABOVE HIGH OF SIGNAL CANDLE.

SELL CONDITION: ALL SEIGNAL SIGNAL SELL BELOW LOW OF SIGNAL CANDLE



MY AFL IS BELOW



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

_SECTION_BEGIN("Advanced Trailstop System");



mult=Param("multi", 2.0, 0.1, 10, 0.05);
Aper=Param("ATR period", 7, 2, 100, 1 );
atrvalue=(mult*ATR(aper));

Bs[0]=0;//=L;
L[0]=0;
C[0]=0;

for( i = 9; i < BarCount; i++ )
{
if ( L[ i ] > L[ i - 1 ] AND L[ i ] > L[ i - 2 ] AND L[ i ] > L[ i - 3 ] AND L[ i ] > L[ i - 4 ] AND
L[ i ] > L[ i - 5 ] AND L[ i ] > L[ i - 6 ] AND L[ i ] > L[ i - 7 ] AND L[ i ] > L[ i - 8 ] AND
L[ i ] > L[ i - 9 ] AND C[ i ] > bs[ i - 1 ])
{
bs[ i ] = L[ i ] - ATRvalue[ i ] ;

}
else
{
if ( H[ i ] < H[ i - 1 ] AND H[ i ] < H[ i - 2 ] AND H[ i ] < H[ i - 3 ] AND H[ i ] < H[ i - 4 ] AND
H[ i ] < H[ i - 5 ] AND H[ i ] < H[ i - 6 ] AND H[ i ] < H[ i - 7 ] AND H[ i ] < H[ i - 8 ] AND
H[ i ] < H[ i - 9 ] AND C[ i ] < bs[ i - 1 ] )
{
bs[ i ] = H[ i ] + ATRvalue[ i ];

}
else
{
bs[ i ] = bs[ i - 1];
} }}

//================================================== ==
Mycolor=IIf(C>bs,colorLime,colorRed);
bcolor=IIf(C>bs,colorBlue,colorBlue);
//PlotOHLC( Open, High, Low, Close, "", Mycolor, styleBar| styleThick );
Plot(bs,"ATS",bcolor,1|styleThick);
Buy=Cover=Cross(C,bs);
Sell=Short=Cross(bs,C);
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shapeUpArrow*Buy, colorLime, 0, L, -95 );
PlotShapes(shapeDownArrow*Sell, colorRed, 0, H, -30 );
SellPrice=ValueWhen(Sell,C,1);
BuyPrice=ValueWhen(Buy,C,1);
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy );
_SECTION_END();
Filter= Buy OR Sell OR Short OR Cover;
//=================TITLE============================ ================================================== ==================

_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorWhite)+ "Advanced Trailstop System " + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - "+"\n" +EncodeColor(colorRed) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n"+
EncodeColor(colorLime)+
WriteIf (Buy , " GO LONG / Reverse Signal at "+C+" ","")+
WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+" ","")+"\n"+EncodeColor(colorWhite)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","")+
WriteIf(Long AND NOT Buy, "Trade : Long - Entry price Rs."+(BuyPrice),"")+
WriteIf(shrt AND NOT Sell, "Trade : Short - Entry price Rs."+(SellPrice),"")+"\n"+
WriteIf(Long AND NOT Buy, "Current Profit/Loss Rs."+(C-BuyPrice)+"","")+
WriteIf(shrt AND NOT Sell, "Current Profit/Loss Rs."+(SellPrice-C)+"",""));
_SECTION_END();
 

Similar threads