My afl collection

Status
Not open for further replies.

shivangi77

Well-Known Member

Wolf Wave



Code:
Version(5.20);
SetChartBkColor(16);
SetBarsRequired(sbrAll);
GraphXSpace=Param("GraphXSpace",15,-100,300,1);
daynum= Now(9);//day of the week
SatSun= IIf((daynum==1 OR daynum==7),1,0);
dec= IIf(StrRight(Name(),3) == "", 3.2, 3.2);
dec= (Param("Decimals",2,0,7,1)/10)+1;
uc= ParamColor("Up Candle Fill Color",19);
dc= ParamColor("Dn Candle Fill Color",24);
nc= ParamColor("Neutral Fill Color",21);
bc= BarCount-1;
x= BarIndex();
Lx= LastValue(x);
sx= SelectedValue(x);
//==============================
SetBarFillColor(IIf(C>O,uc,IIf(C<O,dc,nc)));
Plot(C,"",IIf(C>Ref(C,-1),34,IIf(C<Ref(C,-1),32,42)),64);
Plot(MA(C,200),"",52,4);
//========= GFX Status =========
lvb= Status("LastVisibleBar");
fvb= Status("FirstVisibleBar");
mny= Status("AxisMiny"); mxy= Status("AxisMaxy");
pxl= Status("pxChartLeft"); pxw= Status("pxChartWidth");
pxh= Status("pxChartHeight"); pxb= Status("pxChartBottom");
mth= mxy-mny;
tvb= lvb-fvb;
function tpX(x) { return pxl+(x-fvb)*pxw/(tvb+1); }
function tpY(y) { return pxb-floor(0.5 +(y-mny)*pxh/mth); }
//======== GFX Flat Line ========
procedure sln(xs,ys,xe,col,thk,sty) {
xs=LastValue(tpx(xs)); ys=LastValue(tpy(ys));
xe=LastValue(tpx(xe)); av=xs>0 AND xe>xs;
GfxSelectPen(col,thk,sty); GfxSetBkColor(16);
IIf(av,GfxPolyline(xs,ys,xe,ys),Null); }
//======== Fib Function =========
f0=0; f1=0; p=0; n=0; d=0;
function fvd(fib) {
fv=fib*d; ffv=IIf(p,f0+fv,f0-fv);
return IIf(ffv>0,ffv,Null); }
//======== Plot Shapes ========
procedure pshp(x,y,shp,co,shf) {
x=SelectedValue(x); y=SelectedValue(y);
PlotShapes(IIf(BarIndex()==x,shp,0),co,0,y,shf); }
//======== Fractal Peak Trough ========
x= BarIndex();
function pkID(nb){ p=H==HHV(H,2*nb)AND Ref(HHV(H,nb),nb)<H;
return p AND LastValue(x)-ValueWhen(p,x)>nb; }
function trID(nb){ t=L==LLV(L,2*nb)AND Ref(LLV(L,nb),nb)>L;
return t AND LastValue(x)-ValueWhen(t,x)>nb; }
//=============================
_SECTION_BEGIN("Select Pivots");
//=============================
//SetBarsRequired(sbrAll,sbrAll);
nn= Param("Fractal Minimum",5,2,150,1);
plf= ParamList("Pivots/Ribbon","Off|Fractals|Ribbon|Both",0);
wwv=ParamToggle("Plot Wolfe Wave","Off|On",1);
cvg= ParamToggle("Require Convergence","Off|On",1);
sym= ParamToggle("Require Symmetry","Off|On",1);
fib=ParamToggle("Fib Retracements","Off|On",1);
mnR= Param("Min Time Retrace %",0.50,0.50,1.00,0.01);//Min % of P1-P2 bars
mxR= Param("Max Time Retrace %",1.62,1.00,4.00,0.01);//Max % of P1-P2 bars
mx5= Param("Max P5 Time Retrace %",2.62,1,5,0.01);//Max % of P2-P3 bars
nmn= Param("Near 5 %",0.62,0.50,0.995,0.001);//% of Retrace
//==================
x= BarIndex();
Lx=LastValue(x);
//==================
pk= pkID(nn); tr= trID(nn);
tx1= ValueWhen(tr,x,1); px2= ValueWhen(pk,x,2);
pk= IIf(pk,IIf(px2<tx1,pk,IIf(ValueWhen(pk,H,2)>H,False,pk)),pk);
px1= ValueWhen(pk,x,1); tx2= ValueWhen(tr,x,2);
tr= IIf(tr,IIf(tx2<px1,tr,IIf(ValueWhen(tr,L,2)<L,False,tr)),tr);
px0= ValueWhen(pk,x,0); tx0= ValueWhen(tr,x,0);
py0= ValueWhen(pk,H,0); ty0= ValueWhen(tr,L,0);
pk= IIf(pk AND px0>x,IIf(px0<tx0,IIf(py0>=H,False,pk),pk),pk);
tr= IIf(tr AND tx0>x,IIf(tx0<px0,IIf(ty0<=L,False,tr),tr),tr);
//===================
px= BarsSince(pk==1); tx= BarsSince(tr==1);
sup= SelectedValue(px) > SelectedValue(tx);
res= SelectedValue(tx)>= SelectedValue(px);
shp=shapeSmallCircle;
col= IIf(pk==1,42,IIf(tr==1,10,IIf(px>tx,19,IIf(tx>px,24,29))));
if(plf=="Ribbon" OR plf=="Both")Plot(2.25,"F
Swing",col,styleOwnScale|styleArea|4096,-1,100);
if(plf=="Fractals" OR plf=="Both"){PlotShapes(shp*pk,42,0,H,5);
PlotShapes(shp*tr,10,0,L,-5);}
//===================
yr1= ValueWhen(pk,H,1); xr1= ValueWhen(pk,x,1);
yr2= ValueWhen(pk,H,2); xr2= ValueWhen(pk,x,2);
yr3= ValueWhen(pk,H,3); xr3= ValueWhen(pk,x,3);
ys1= ValueWhen(tr,L,1); xs1= ValueWhen(tr,x,1);
ys2= ValueWhen(tr,L,2); xs2= ValueWhen(tr,x,2);
ys3= ValueWhen(tr,L,3); xs3= ValueWhen(tr,x,3);
//======== 5 POINT BEAR WAVE ========
be45xR= (xs1-xr2)/(xs2-xr3);
be55xR= (xr1-xs1)/(xr2-xs2);
becvg5= (yr2-ys1)<=(yr3-ys2);
be45xV= be45xR>=mnR AND be45xR<=mxR;
be55xV= be55xR>=mnR AND be55xR<=mx5;
if(sym==0)bexo5= xr1>xs1 AND xs1>xr2 AND xr2>xs2 AND xs2>xr3;
if(cvg==0)bepo5= yr2>yr3 AND yr1>yr2 AND ys1>ys2 AND ys1<yr2;
if(sym==1)bexo5= xr1>xs1 AND xs1>xr2 AND xr2>xs2 AND xs2>xr3 AND be45xV AND
be55xV;
if(cvg==1)bepo5= yr2>yr3 AND yr1>yr2 AND ys1>ys2 AND ys1<yr2 AND becvg5;
bq5= bexo5 AND bepo5;
//===================
x15= SelectedValue(ValueWhen(bq5,xr3));
y15= SelectedValue(ValueWhen(bq5,yr3));//P1
x25= SelectedValue(ValueWhen(bq5,xs2));
y25= SelectedValue(ValueWhen(bq5,ys2));//P2
x35= SelectedValue(ValueWhen(bq5,xr2));
y35= SelectedValue(ValueWhen(bq5,yr2));//P3
x45= SelectedValue(ValueWhen(bq5,xs1));
y45= SelectedValue(ValueWhen(bq5,ys1));//P4
x55= SelectedValue(ValueWhen(bq5,xr1));
y55= SelectedValue(ValueWhen(bq5,yr1));//P5
Ln135= LineArray(x15,y15,x35,y35,1);
Ln245= LineArray(x25,y25,x45,y45,1);
trgt5= LineArray(x15,y15,x45,y45,1);
//========= BEAR PLOTTING =========
if(wwv) {
Plot(Ln135,"",25,4|2048);
Plot(Ln245,"",43,4|2048);
Plot(trgt5,"",42,4|2048);
pshp(x15,y15,shapeDigit1,42,15); pshp(x25,y25,shapeDigit2,42,-15);
pshp(x35,y35,shapeDigit3,42,15); pshp(x45,y45,shapeDigit4,42,-15);
pshp(x55,y55,shapeDigit5,42,15);
}
x5up= ValueWhen(x>x45,Cross(H,Ln135));
x5dn= ValueWhen(x>x45,Cross(Ln135,H));
near= ValueWhen(x>x45,C>Ln245+(Ln135-Ln245)*nmn AND C<Ln135 AND NOT x5up AND
NOT x5dn);
//======== BEAR PRICE & TIME FIBS ========
if(fib) {
//======== Price Fibs ========
p=x45>x35; n=x45<x35; f0=y45; f1=y35; d=y35-y45;//Price Fibs
i618=fvd(0.618); i127=fvd(1.27); i162=fvd(1.62);
//====== Price AP Fibs ======
p=x45>x35; n=x45<x35; f0=y45; f1=y35; d=y35-y25;//AP Fibs
a618=fvd(0.618); a100=fvd(1.00); a127=fvd(1.27);
a162=fvd(1.62); a200=fvd(2.00); a224=fvd(2.24); a262=fvd(2.62);
//======== Time Fibs ========
p=x45>x35; n=x45<x35; f0=x45; f1=x35; d=x35-x25;//Time Fibs
x500=fvd(0.500); x618=fvd(0.618); x100=fvd(1.00);
x162=fvd(1.618); x262=fvd(2.62);
//======== PLOTTING ========
sln(x500,i618,x162,43,1,1); sln(x500,i127,x162,36,1,1);
sln(x500,i162,x162,34,1,1); sln(x500,y35,x162,32,1,1);
sln(x500,a618,x162,43,1,0); sln(x500,a100,x262,55,1,0);
sln(x500,a127,x262,44,1,0); sln(x500,a162,Lx,34,1,0);
sln(x100,a200,Lx,52,1,0); sln(x100,a224,Lx,42,1,0);
sln(x100,a262,Lx,51,1,0);
}
//===================
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxx
//======== 5 POINT BULL WAVE ========
bu45xR= (xr1-xs2)/(xr2-xs3);
bu55xR= (xs1-xr1)/(xs2-xr2);
bucvg5= (yr1-ys2)<=(yr2-ys3);
bu45xV= bu45xR>=mnR AND bu45xR<=mxR;
bu55xV= bu55xR>=mnR AND bu55xR<=mx5;
if(sym==0)buxo5= xs1>xr1 AND xr1>xs2 AND xs2>xr2 AND xr2>xs3;
if(cvg==0)bupo5= yr2>ys3 AND yr2>yr1 AND ys3>ys2 AND ys2>ys1 AND yr2>yr1 AND
yr1>ys3;
if(sym==1)buxo5= xs1>xr1 AND xr1>xs2 AND xs2>xr2 AND xr2>xs3 AND bu45xV AND
bu55xV;
if(cvg==1)bupo5= yr2>ys3 AND yr2>yr1 AND ys3>ys2 AND ys2>ys1 AND yr2>yr1 AND
yr1>ys3 AND bucvg5;
pq5= buxo5 AND bupo5;
//===================
x15= SelectedValue(ValueWhen(pq5,xs3));
y15= SelectedValue(ValueWhen(pq5,ys3));//P1
x25= SelectedValue(ValueWhen(pq5,xr2));
y25= SelectedValue(ValueWhen(pq5,yr2));//P2
x35= SelectedValue(ValueWhen(pq5,xs2));
y35= SelectedValue(ValueWhen(pq5,ys2));//P3
x45= SelectedValue(ValueWhen(pq5,xr1));
y45= SelectedValue(ValueWhen(pq5,yr1));//P4
x55= SelectedValue(ValueWhen(pq5,xs1));
y55= SelectedValue(ValueWhen(pq5,ys1));//P5
Ln135= LineArray(x15,y15,x35,y35,1);
Ln245= LineArray(x25,y25,x45,y45,1);
trgt5= LineArray(x15,y15,x45,y45,1);
//========= BULL PLOTTING =========
if(wwv) {
Plot(Ln135,"",27,4|2048);
Plot(Ln245,"",32,4|2048);
Plot(trgt5,"",51,4|2048);
pshp(x15,y15,shapeDigit1,43,-15); pshp(x25,y25,shapeDigit2,43,15);
pshp(x35,y35,shapeDigit3,43,-15); pshp(x45,y45,shapeDigit4,43,15);
pshp(x55,y55,shapeDigit5,10,-15);
}
x5up= ValueWhen(x>x45,Cross(L,Ln135));
x5dn= ValueWhen(x>x45,Cross(Ln135,L));
near= ValueWhen(x>x45,C<Ln245-(Ln245-Ln135)*nmn AND NOT x5up AND NOT x5dn);
//======== BEAR PRICE & TIME FIBS ========
if(fib) {
//======== Price Fibs ========
p=x45<x35; n=x45>x35; f0=y45; f1=y35; d=y45-y35;//Price Fibs
i618=fvd(0.618); i127=fvd(1.27); i162=fvd(1.62);
//====== Price AP Fibs ======
p=x45<x35; n=x45>x35; f0=y45; f1=y35; d=y25-y35;//AP Fibs
a618=fvd(0.618); a100=fvd(1.00); a127=fvd(1.27);
a162=fvd(1.62); a200=fvd(2.00); a224=fvd(2.24); a262=fvd(2.62);
//======== Time Fibs ========
p=x45>x35; n=x45<x35; f0=x45; f1=x35; d=x35-x25;//Time Fibs
x500=fvd(0.500); x618=fvd(0.618); x100=fvd(1.00);
x162=fvd(1.618); x262=fvd(2.62);
//======== PLOTTING ========
sln(x500,i618,x162,43,1,1); sln(x500,i127,x162,36,1,1);
sln(x500,i162,x162,34,1,1); sln(x500,y35,x162,32,1,1);
sln(x500,a618,x162,43,1,0); sln(x500,a100,x262,55,1,0);
sln(x500,a127,Lx,44,1,0); sln(x500,a162,Lx,34,1,0);
sln(x100,a200,Lx,52,1,0); sln(x100,a224,Lx,42,1,0);
sln(x100,a262,Lx,51,1,0);
}
RequestTimedRefresh(1);
Title = "\\c55" + Title = Name() + " " + FullName()+ " \\c32" +
Date() + " \\c43" + "{{INTERVAL}} " +
"\\c55 Open = \\c43" + WriteVal(O,dec) +
"\\c55 High = \\c43" + WriteVal(H,dec) +
"\\c55 Low = \\c32" + WriteVal(L,dec) +
"\\c55 Close = \\c52" + WriteVal(C,dec)+
"\\c55 Volume = \\c43"+ WriteVal(V,dec) +
"\\c55 ATR-9 = \\c42" + WriteVal(ATR(9),dec) +
"\\c55 Fractal =\\c10"+nn+"\\c55 Bars " +
"\\c55 x = " + WriteVal(x,1)+"\n\n" +
"\\c55x4 Retrace = \\c43"+ WriteVal(be45xR,1.2)+"%\n" +
"\\c55x5 Retrace = \\c43"+ WriteVal(be55xR,1.2);


_SECTION_BEGIN("Background text");
C13=Param("fonts",20,10,30,1 );
C14=Param("left-right",2.1,1.0,5.0,0.1 );
C15=Param("up-down",7,1,20,1 );
Miny = Status("axisminy");
Maxy = Status("axismaxy");
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
pxwidth = Status("pxwidth");
pxheight = Status("pxheight");
GfxSetBkMode(transparent=1);
GfxSetOverlayMode(1);
GfxSelectFont("Tahoma", Status("pxheight")/C13 );
GfxSetTextAlign( 6 );
GfxSetTextColor( ColorRGB (217,217,213));
GfxTextOut( Name(), Status("pxwidth")/C14, Status("pxheight")/C15 );
GfxSelectFont("Tahoma", Status("pxheight")/C13*0.5 );
GfxSetTextColor( ColorRGB (103,103,103));
GfxSelectFont(" Brush Script MT", Status("pxheight")/C13*0.5 );
GfxSetTextColor( ColorRGB (0,0,225));
GfxSelectFont("MS Sans Serif", 10, 500, False, False, 0);
 

shivangi77

Well-Known Member


Very Nice Results in 15 mins chart!!

Source: Khushi's Collection(shared with me)



Code:
wc = TimeFrameCompress( Close, in15Minute ); 

/* now the time frame is still unchanged (say daily) and our MA will operate on daily data */ 
dailyma = EMA( C, 39 ); 

/* but if we call MA on compressed array, it will give MA from other time frame */ 
weeklyma = EMA( wc, 39 ); // note that argument is time-compressed array 



weeklyma = TimeFrameExpand( weeklyma, in15Minute ); // expand for display 

Plot( weeklyma, "WeeklyMA", colorBlue ); 

wc = TimeFrameCompress( Close, in15Minute ); 

/* now the time frame is still unchanged (say daily) and our MA will operate on daily data */ 
dailyma = EMA( C, 104 ); 

/* but if we call MA on compressed array, it will give MA from other time frame */ 
weeklyma = EMA( wc, 104 ); // note that argument is time-compressed array 


weeklyma = TimeFrameExpand( weeklyma, in15Minute ); // expand for display 

Plot( weeklyma, "WeeklyMA", colorBrightGreen ); 
wc = TimeFrameCompress( Close, in15Minute ); 

/* now the time frame is still unchanged (say daily) and our MA will operate on daily data */ 
dailyma = MA( C, 104 ); 

/* but if we call MA on compressed array, it will give MA from other time frame */ 
weeklyma = MA( wc, 104 ); // note that argument is time-compressed array 


weeklyma = TimeFrameExpand( weeklyma, in15Minute ); // expand for display 

Plot( weeklyma, "WeeklyMA", colorLightGrey ); 
_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", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

_SECTION_BEGIN("swing1");
no=20;
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);
supres=IIf(avn==1,sup,res);

a=Cross(C,supres);
b=Cross(supres,C);

style = a * styleStaircase + b * styleStaircase;

_SECTION_END();


DayH = SelectedValue(TimeFrameGetPrice("H", inDaily));// yesterdays high 
DayL = SelectedValue(TimeFrameGetPrice("L", inDaily));//low 
DayH1 = SelectedValue(TimeFrameGetPrice("H", inDaily, -1));// yesterdays high 
DayL1 = SelectedValue(TimeFrameGetPrice("L", inDaily, -1));//low 
DayH2 = SelectedValue(TimeFrameGetPrice("H", inDaily, -2));// yesterdays high 
DayL2 = SelectedValue(TimeFrameGetPrice("L", inDaily, -2));//low 

Range = ((DayH +DayH1  +DayH2)/3 - (DayL+DayL1+DayL2)/3);
sr1= (Range *0.292)+DayL;
sr2= Dayh-(Range *0.33);
sr3= (Range *0.702)+DayL;
sr4= DayH-(Range *0.655);

style = styleLine | styleNoRescale|styleLine; 
Plot(sr1, "SR1",colorWhite ,styleDashed|styleNoRescale|styleThick);
Plot(sr2, "SR2",colorGold  ,styleDashed|styleNoRescale|styleThick);
Plot(sr3, "SR3",colorPink  , styleDashed|styleNoRescale|styleThick);
Plot(sr4, "SR4",colorOrange ,styleDashed|styleNoRescale|styleThick);

Bars_so_far_today = 1 + BarsSince( Day() != Ref(Day(), -1));
TT=  RSIa(C,60);
StartBar = ValueWhen(TimeNum() == 090000, BarIndex());
TodayVolume = Sum(TT,Bars_so_far_today);
IIf (BarIndex() >= StartBar, VWAP = Sum (C * TT, Bars_so_far_today  ) / TodayVolume,0);
Plot (VWAP,"VWAP",colorOrange,4 +8+2048 );

_SECTION_BEGIN("Volume");
Plot( Volume, _DEFAULT_NAME(), ParamColor("Color", colorBrown ), styleNoTitle | ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick | styleNoLabel, maskHistogram ), 2 );
_SECTION_END();
Plot(supres,"Swing",colorYellow,styleStaircase);

SetChartBkGradientFill( ParamColor("BgTop", colorBlack),

ParamColor("BgBottom", colorBlack),ParamColor("titleblock", colorBlack));

GraphXSpace = 5;



_SECTION_BEGIN("EMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 13);
Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") ); 
_SECTION_END();

_SECTION_BEGIN("DEMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 65, 2, 3000, 1, 10 );
Plot( DEMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorAqua ), ParamStyle("Style") ); 
_SECTION_END();

A = DEMA (H,65);
B = EMA (H,39);
G = DEMA (L,65);
I = EMA(L,39);
D = Min (G,I);
E = Max (A,B);
/* Buy or Sell Condition */
Buy =Cover= Cross(Close,E);
Sell = Short=Cross(D,Close);
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
SellPrice=ValueWhen(Sell,C,1);
BuyPrice=ValueWhen(Buy,C,1);

Filter = Buy OR Sell;
/* Exploration Parameters */
AddTextColumn( FullName(), "Company Name" );
AddColumn( Buy, "Buy", 1 );
AddColumn( Sell, "Sell", 1 );
AddColumn( C, "Close", 1.3 );
AddColumn( H, "High", 1.3 );

Title = EncodeColor(colorWhite)+ "Saihaj Arjit Rainy Rimple (SARR) Trading 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)+"","");

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);                      
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45); 
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);                      
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
_SECTION_END();
 

shivangi77

Well-Known Member
KD system






Code:
_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("short signal");
HaClose=(O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
BG2=HHV(LLV(Low,4)+ATR(4),8);
BR2=LLV(HHV(High,4)-ATR(4),8);
SetBarFillColor( IIf(O <C, colorGreen,colorRed) );
k = Optimize("K",Param("K",1.75,1,5,0.25),1,5,0.25);
Per= Optimize("atr",Param("atr",10,3,30,1),3,30,1);
j=HaClose;
nm= (H-L);
rfsctor = WMA(nm, PER);
revers = K * rfsctor;
Trend = 1;
NW[0] = 0;
for(i = 1; i < BarCount; i++)
{
if(Trend[i-1] == 1)
{
if(j[i] < NW[i-1])
{
Trend[i] = -1;
NW[i] = j[i] + Revers[i];
}
else
{
Trend[i] = 1;
if((j[i] - Revers[i]) > NW[i-1])
{
NW[i] = j[i] - Revers[i];
}
else
{
NW[i] = NW[i-1];
}
}
}
if(Trend[i-1] == -1)
{
if(j[i] > NW[i-1])
{
Trend[i] = 1;
NW[i] = j[i] - Revers[i];
}
else
{
Trend[i] = -1;
if((j[i] + Revers[i]) < NW[i-1])
{
NW[i] = j[i] + Revers[i];
}
else
{
NW[i] = NW[i-1];
}
}
}
}

Plot(NW, "", IIf(Trend == 1, 16, 4), 4);
Plot(NW, "", IIf(Trend == 1, 16, 4), 4);

_SECTION_END();_SECTION_BEGIN("Trend Lines");
p1 = Param("TL 1 Periods", 20, 5, 50, 1);
p2 = Param("TL 2 Periods", 5, 3, 25, 1);
TL1 = LinearReg(C, p1);
TL2 = EMA(TL1, p2);
Col1 = IIf(TL1 > TL2, ParamColor("TL Up Colour", colorGreen), ParamColor("TL Dn Colour", colorRed));
Plot(TL1, "TriggerLine 1", Col1, styleLine|styleThick|styleNoLabel);
Plot(TL2, "TriggerLine 2", Col1, styleLine|styleThick|styleNoLabel);
_SECTION_END();_SECTION_BEGIN("Background text");
C13=Param("fonts",20,10,30,1 );
C14=Param("left-right",2.1,1.0,5.0,0.1 );
C15=Param("up-down",12,1,20,1 );
Miny = Status("axisminy");
Maxy = Status("axismaxy");
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
pxwidth = Status("pxwidth");
pxheight = Status("pxheight");
GfxSetBkMode(transparent=1);
GfxSetOverlayMode(1);
GfxSelectFont("Tahoma", Status("pxheight")/C13 );
GfxSetTextAlign( 6 );
GfxSetTextColor( ColorRGB (217,217,213));
GfxTextOut( Name(), Status("pxwidth")/C14, Status("pxheight")/C15 );
GfxSelectFont("Tahoma", Status("pxheight")/C13*0.5 );
GfxSetTextColor( ColorRGB (103,103,103));
GfxSelectFont("Tahoma", Status("pxheight")/C13*0.5 );
GfxSetTextColor( ColorRGB (103,103,103));
GfxSelectFont("MS Sans Serif", 10, 500, False, False, 0);
_SECTION_END();
 
If You are using Technical Analysis for Decision Making in Stock Selection and Perfect Entry Exist,You Should at least once approach "Spider Software"........Everything which is essential for analysis is available in :Spider.....See Demo of it
 

prabhsingh

Well-Known Member
If You are using Technical Analysis for Decision Making in Stock Selection and Perfect Entry Exist,You Should at least once approach "Spider Software"........Everything which is essential for analysis is available in :Spider.....See Demo of it
From where can we download this software?Is it available freely?Can we construct AFL sort of things in this software as well?
 

mcxinvest

Well-Known Member
Hello,
Is der any AFl, which we can put in our systems, which shows on screen the present trade, present profit or loss ?
 

shivangi77

Well-Known Member
Stock Maniac System (so called)





Code:
SetBarsRequired(200, 0);
_SECTION_BEGIN("TA signal ");

GraphXSpace = 5;
SetChartOptions(0, chartShowArrows|chartShowDates);
k = Optimize("K", Param("A (Change To Optimise)", 1.75, 0.25, 5, 0.25), 0.25, 5, 0.25);
Per= Optimize("ATR", Param("B (Change To Optimise)", 10, 3, 20, 1), 3, 20, 1);
CloseAtEnd = ParamToggle("Close Positions EOD", "No|Yes");
ShowBands = ParamToggle("Show Trending Bands", "No|Yes");
ShowPivots = ParamToggle("Show Pivot High/Low", "No|Yes");
SetChartBkGradientFill( ParamColor("BgTop", colorDarkOliveGreen), ParamColor("BgBottom", colorRose), ParamColor("titleblock", colorRose ));
//Param_Margin = Param("Margin required (used for backtesting only)", 15, 0.001, 100, 0.001);
//Param_LotSize = Param("Lot Size (used for backtesting only)", 50, 5, 5000, 5);
//Param_NoOfLots = Param("No of lots normally traded (used for backtesting only)", 2, 1, 10000, 1);

R=(H-L);//RANGE;

FR=(H-L)/3;//THIRD OF RANGE;

S1=H-FR;//SEGMENT ONE;

S2=H-2*FR;//SEGMENT TWO;

S3=L;//SEGMENT THREE;

/*POSITION OF OPEN AND CLOSE RELATIVE TO BAR*/

P=IIf(O>S1, 1, IIf(S1>O<S2, 2, IIf(S2>O<L, 3, 0)));// POSITION OF OPENING PRICE ;

CL=IIf(C>S1, 1, IIf(S1>C<S2, 2, IIf(S2>C<L, 3, 0)));// POSITION OF CLOSING PRICE;

/*CONDITIONAL STATEMENTS */


COND_C=((P==2 OR P==3) AND CL==1) OR (P==3 AND (CL==1 OR CL==2)); //CLIMBERS(eq. 1)

COND_C=(P==2 /*OR P==3)*/ AND CL==1) OR (P==3 AND (CL==1 OR CL==2));//CLIMBERS (eq. 1a)


COND_D=(P==1 AND (CL==2 OR CL==3)) OR (P==2 AND (CL==2 OR CL==3));//DRIFTERS

COND_N=((P==CL) AND ( P==1 OR P==2 OR P==3)); //NEUTRAL BARS

DYNAMIC_COLOR=IIf(COND_C, colorDarkGreen, IIf(COND_D, colorRed, IIf(COND_N, colorBlue, colorTeal)));

PlotOHLC( Open, High, Low, Close, "Price chart ", DYNAMIC_COLOR, styleCandle, styleThick);

HACLOSE=(O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
j=Haclose;

//================================================== ================================================== ===================
//=========================Indicator================ ================================================== ============================
f=ATR(14);

rfsctor = WMA(H-L, Per);

revers = k * rfsctor;

Trend = 1;
NW[0] = 0;


for(i = 1; i < BarCount; i++)
{
if(Trend[i-1] == 1)
{
if(j[i] < NW[i-1])
{
Trend[i] = -1;
NW[i] = j[i] + Revers[i];
}
else
{
Trend[i] = 1;
if((j[i] - Revers[i]) > NW[i-1])
{
NW[i] = j[i] - Revers[i];
}
else
{
NW[i] = NW[i-1];
}
}
}
if(Trend[i-1] == -1)
{
if(j[i] > NW[i-1])
{
Trend[i] = 1;
NW[i] = j[i] - Revers[i];
}
else
{
Trend[i] = -1;
if((j[i] + Revers[i]) < NW[i-1])
{
NW[i] = j[i] + Revers[i];
}
else
{
NW[i] = NW[i-1];
}
}
}
}

activezone=ADX(14) >20 AND V> MA(V, 60);
calmzone=ADX(14) < 20 AND V < MA(V, 60);


Plot( 2, /* defines the height of the ribbon in percent of pane width
*/"ribbon", 
IIf( activezone, colorBlue, IIf( calmzone, colorYellow, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );

//===============system================

ForceCloseTradesAfter = 153000;

NextBarOutsideRTH = (Ref(TimeNum(), 1) > ForceCloseTradesAfter);
NextBarNotToday = (Ref(DateNum(), 1) > DateNum());
Buy=Cross(j, nw);
Short=Cross(nw, j);
Sell=IIf(CloseAtEnd==False, Short, Short OR NextBarOutsideRTH OR NextBarNotToday);
Cover=IIf(CloseAtEnd==False, Buy, Buy OR NextBarOutsideRTH OR NextBarNotToday);

SellPrice=ValueWhen(Short, C, 1);
BuyPrice=ValueWhen(Buy, C, 1);
Long=Flip(Buy, Sell);
Shrt=Flip(Short, Cover);

OBSetting=Param("Setting", 45, 1, 500, 1);
Bline = StochD(OBSetting);
Oversold=Bline<=5;
Overbought=Bline>=95;


PlotShapes (IIf(Oversold, shapeSmallCircle, shapeNone), colorBrightGreen, layer = 0, yposition = HaLow, offset = -8 );
PlotShapes (IIf(Overbought, shapeSmallCircle, shapeNone), colorOrange, layer = 0, yposition = HaHigh, offset = 7 );

//=================TITLE============================ ================================================== ==================

if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorBlue)+ "StockManiacs Intraday Trading System V2.0 - www.stockmaniacs.net" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorBlue) +
" - " + Date() +" - "+"n" +EncodeColor(colorLightBlue) +"Open-"+O+" "+"High-"+H+" "+"Low-"+L+" "+
"Close-"+C+" "+ "Volume= "+ WriteVal(V)+"n"+
EncodeColor(colorBlue)+
WriteIf (Buy, " GO LONG ABOVE "+H+" AND IF TRIGGERS ADD MORE LONG NEAR "+C+" - KEEP SL BELOW"+NW+" ", "")+
WriteIf (Short, " GO SHORT BELOW "+L+" AND IF TRIGGERS ADD MORE SHORT NEAR "+C+" - KEEP SL ABOVE"+NW+" ", "")+"n"+EncodeColor(colorDarkGreen)+
WriteIf(Short AND CloseAtEnd==False, "Total Profit/Loss For The Last Trade: Points - "+(C-BuyPrice)+"", "")+
WriteIf(Buy AND CloseAtEnd==False, "Total Profit/Loss For The Last Trade: Points - "+(SellPrice-C)+"", "")+
WriteIf(Long AND NOT Buy, "Current Trade : Long - Entry Price Near "+(BuyPrice), "")+
WriteIf(shrt AND NOT Sell, "Current Trade : Short - Entry Price Near "+(SellPrice), "")+"n"+
WriteIf(Long AND NOT Buy, "Current Profit/Loss "+(C-BuyPrice)+" Points - Current Trailing Stop Loss @ " + NW + "", "")+
WriteIf(shrt AND NOT Sell, "Current Profit/Loss "+(SellPrice-C)+" Points - Current Trailing Stop Loss @ " + NW + "", ""))+
WriteIf(NOT Long AND NOT Buy AND NOT shrt AND NOT Sell, "Currently Not In A Trade ", "");
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone), colorGreen, 0, Low, -15);
PlotShapes(IIf(Short, shapeHollowDownArrow, shapeNone), colorPink, 0, High, -15);
PlotShapes(IIf(Buy, shapeHollowUpArrow, shapeNone), colorLime, 0, Low, -25);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone), colorDarkRed, 0, High, -25);
PlotShapes(IIf(CloseAtEnd==True AND (NextBarOutsideRTH OR NextBarNotToday), shapeStar, shapeNone), colorGold, 0, L, Offset=-10);

//Settings for Backtester
SetOption("AllowSameBarExit", False);
SetOption("AllowPositionShrinking", False);
SetOption("FuturesMode", True);
SetOption("InterestRate", 0);
SetOption("MaxOpenPositions", 1);
//RoundLotSize = Param_LotSize;
SetOption("MinShares", RoundLotSize);
SetOption("PriceBoundChecking", False);
//SetOption("CommissionMode", 3);
//SetOption("CommissionAmount", 12.5/RoundLotSize);
//SetOption("AccountMargin", Param_Margin);
SetOption("ReverseSignalForcesExit", True);
SetOption("UsePrevBarEquityForPosSizing", True);
SetOption("GenerateReport", 1);
SetOption("MaxOpenLong", 1);
SetOption("MaxOpenShort", 1);
SetOption("RefreshWhenCompleted", True);

//PositionSize = C*RoundLotSize*Param_NoOfLots;
SetTradeDelays(0, 0, 0, 0);
BuyPrice = Close;
SellPrice = Close;
ShortPrice = Close;
CoverPrice = Close;
//End of Settings for Backtester
 

shivangi77

Well-Known Member
prabhsingh said:
Hi Shivangi,

You keep on posting so many AFL.Out of all of them kindly can you let me know which of them you use quite frequently?I am getting confused on seeing so many AFL.Kindly can you tell me which one should be given more importance?Thx
Chosing afl, depends upon your style of trading/ stock chosen/ trading days.
You have to backtest afl's for the stocks You trade. Moreover all trading days are not same. There is not a single afl which works for all types of markets,yet there success rate varies from 55% to 80%. In my knowledge there is NO afl which gives profit in more than 80% of signals generated.
 
Status
Not open for further replies.

Similar threads