Friday, 10 October 2014

Earth AFL for amibroker







SetChartBkGradientFill( colorDarkTeal,colorDarkTeal) ;
SetChartOptions(2,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 )) ));

var1=Close>Ref(Close,-1) AND Close>Ref(Close,-2);
var2=Ref(var1,-1) AND Close<=Ref(Close,-1) AND Close>=Ref(Close,-2);
var3=Ref(var2,-1) AND Close>=Ref(Close,-1) AND Close<=Ref(Close,-2);
var4=Ref(var3,-1) AND Close<=Ref(Close,-1) AND Close>=Ref(Close,-2);
var5=Ref(var4,-1) AND Close>=Ref(Close,-1) AND Close<=Ref(Close,-2);
var6=Ref(var5,-1) AND Close<=Ref(Close,-1) AND Close>=Ref(Close,-2);
var7=Ref(var6,-1) AND Close>=Ref(Close,-1) AND Close<=Ref(Close,-2);
var8=Ref(var7,-1) AND Close<=Ref(Close,-1) AND Close>=Ref(Close,-2);
var9=Ref(var8,-1) AND Close>=Ref(Close,-1) AND Close<=Ref(Close,-2);
varA=Ref(var9,-1) AND Close<=Ref(Close,-1) AND Close>=Ref(Close,-2);
varB=Ref(varA,-1) AND Close>=Ref(Close,-1) AND Close<=Ref(Close,-2);
varC=Ref(varB,-1) AND Close<=Ref(Close,-1) AND Close>=Ref(Close,-2);
varD=Close
varE= Ref(varD,-1)  AND Close>=Ref(Close,-1) AND Close<=Ref(Close,-2);
varF= Ref(varE,-1)  AND Close<=Ref(Close,-1) AND Close>=Ref(Close,-2);
var10=Ref(varF,-1)  AND Close>=Ref(Close,-1) AND Close<=Ref(Close,-2);
var11=Ref(var10,-1) AND Close<=Ref(Close,-1) AND Close>=Ref(Close,-2);
var12=Ref(var11,-1) AND Close>=Ref(Close,-1) AND Close<=Ref(Close,-2);
var13=Ref(var12,-1) AND Close<=Ref(Close,-1) AND Close>=Ref(Close,-2);
var14=Ref(var13,-1) AND Close>=Ref(Close,-1) AND Close<=Ref(Close,-2);
var15=Ref(var14,-1) AND Close<=Ref(Close,-1) AND Close>=Ref(Close,-2);
var16=Ref(var15,-1) AND Close>=Ref(Close,-1) AND Close<=Ref(Close,-2);
var17=Ref(var16,-1) AND Close<=Ref(Close,-1) AND Close>=Ref(Close,-2);
var18=Ref(var17,-1) AND Close>=Ref(Close,-1) AND Close<=Ref(Close,-2);
down=varD OR varE OR varF OR var10 OR var11 OR var12 OR var13 OR var14 
     OR var15 OR var16 OR var17 OR var18;

var19=Ref(varD OR varE OR varF OR var10 OR var11 OR var12 OR var13 OR 
     var14 OR var15 OR var16 OR var17 OR var18,-1) AND var1;

var1A=Ref(var1 OR var2 OR var3 OR var4 OR var5 OR var6 OR var7 OR 
     var8 OR var9 OR varA OR varB OR varC,-1) AND varD;

up=IIf(var1 OR var2 OR var3 OR var4 OR var5 OR var6 OR var7 OR var8 OR var9 OR varA OR varB OR varC,1,0);
top=Max(Close,Ref(Close,-1));
bot=Min(Close,Ref(Close,-1));

barcolor =IIf(up, ParamColor("Up candlestick", colorBrightGreen ), ParamColor("Down candlestick", colorRed ));
SetBarFillColor( IIf( C > O, colorDarkTeal,colorDarkTeal));

PlotOHLC( bot,top,bot,top, "Close", barColor);

Buy = Cover = Close > Ref(Close, -1) AND Ref(Close, -1) > Ref(Close, -2) AND Ref(Close, -1) < Ref(Close, -3) AND IIf(Ref(Close, -3) < Ref(Close, -4), 1, IIf(Ref(Close, -4) < Ref(Close, -5),Ref(Close, -1) < Ref(Close, -4) OR( Ref(Close, -2) < Ref(Close, -4) AND Ref(Close, -3) >= Ref(Close, -5) ),IIf(Ref(Close, -5) < Ref(Close, -6), 1,Ref(Close, -6) < Ref(Close, -7))));
Sell = Short = Close < Ref(Close, -1) AND Ref(Close, -1) < Ref(Close, -2) AND Ref(Close, -1) > Ref(Close, -3) AND IIf(Ref(Close, -3) > Ref(Close, -4), 1, IIf(Ref(Close, -4) > Ref(Close, -5),Ref(Close, -1) > Ref(Close, -4) OR( Ref(Close, -2) > Ref(Close, -4) AND Ref(Close, -3) <= Ref(Close, -5) ),IIf(Ref(Close, -5) > Ref(Close, -6), 1,Ref(Close, -6) > Ref(Close, -7))));
PlotShapes( IIf( Buy, shapeHollowUpArrow, shapeNone ), 10, layer = 0, yposition = bot, offset = -15  ); 
PlotShapes( IIf( Sell, shapeHollowDownArrow, shapeNone ), 13, layer = 0, yposition = top, offset = -15  );


MaxGraph = 12;

BuyOffSet = 18;//Optimize("BuyOffSet",-18,-15,-20,-1);
SellOffset = BuyOffSet;//Optimize("SellOffset",-2,-2,-14,-2);
RegLength = 5;//Optimize("RegLength",5, 2,-11,-2);
BuyATRPeriod = 2;//Optimize("BuyATRPeriod",-2,-2,5,-1);
SellATRPeriod = BuyATRPeriod;//Optimize("SellATRPeriod",4,-2,-11,-2);
ATRMultiplier = 0.5;//Optimize("ATRMultiplier",-1,0.7,-1.25,.05);

Graph8 = HHV(H-ATRMultiplier*ATR(BuyATRPeriod),BuyOffset);
Graph9 = LLV(L+ATRMultiplier*ATR(SellATRPeriod),SellOffset); 
ave=(Graph8+Graph9)/2;

Graph8Style=Graph9Style = 1;
Graph9Color=  7;
Graph8Color = 6;


_SECTION_BEGIN("Volume1");
Plot( Volume, _DEFAULT_NAME(), ParamColor("Color", colorBlueGrey ), ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick, maskHistogram  ), 2 );
_SECTION_END();

_SECTION_BEGIN("Exploration");
pfrom = Param("Price From", 0, 0, 1000, 0.5 );
pto = Param("Price To", 1000, 0, 1000, 0.5 );
Minv = Param("Minimum Volume (K)", 500, 0, 1000, 50);
dd = Param("Decimal Digits", 1.2, 1, 1.7, 0.1 );

Filter = (Buy OR Sell) AND C>pfrom AND C1000*Minv;
Color = IIf(Close>Open, colorGreen, colorRed);
bcolor = IIf(Buy, colorGreen, 1);
scolor = IIf(Sell, colorRed, 1);

AddColumn(Buy , "Buy" , 1.1, bcolor);
AddColumn(Sell , "Sell", 1.1, scolor);
AddColumn(O, "Open", dd, textColor = Color);
AddColumn(C, "Close", dd, textColor = Color);
AddColumn(Graph9, "Support", dd, textColor = Color);
AddColumn(Graph8, "Resistance", dd, textColor = Color);
AddColumn(V, "Volume", 1, textColor = Color);
AddTextColumn(FullName(),"Name");
_SECTION_END();



SetChartBkColor( colorDarkTeal ) ;
VAR2=(High+Low+(Close)*(2))/(4);
B = ((EMA((VAR2-LLV(VAR2,15))/(HHV(Low,15)-LLV(VAR2,15)),2))*(38));
Plot(b, "", 4, 1);
bot1 = ((((-1))*(EMA((VAR2-LLV(VAR2,15))/(HHV(Low,15)-LLV(VAR2,15)),2))+0.01)*(38));
Plot(bot1, "", 4, 1);
VAR22=((Close-LLV(Low,10))/(HHV(High,10)-LLV(Low,10)))*(100);
VAR33=EMA(VAR22,10);
VAR44=EMA(VAR33,10);
VAR55=(3)*(VAR33)-(2)*(VAR44);
VAR66=EMA(VAR55,5);
BridgeT = (EMA(VAR66,1));
Plot(bridget, "", 7, 1+4);
Plot(-bridget, "", 7, 1+4);
trend = (5)*(EMA(((Close-LLV(Low,27))/(HHV(High,27)-LLV(Low,27)))*(100),5))-
    (3)*(EMA(EMA(((Close-LLV(Low,27))/(HHV(High,27)-LLV(Low,27)))*(100),5),3))-
    EMA(EMA(EMA(((Close-LLV(Low,27))/(HHV(High,27)-LLV(Low,27)))*(100),5),3),2);
Buy1 = Cross(trend,5);
PlotShapes( IIf( Buy1, shapeSmallSquare, shapeNone ), 8, layer = 0, yposition = 0, offset = 3  ); 
PlotShapes( IIf( Buy1, shapeSmallSquare, shapeNone ), 8, layer = 0, yposition = 0, offset = -4  ); 

VARA1=((Close>=Ref(Close,-1)) AND (Ref(Close,-1)>=Ref(Close,-2)) AND (Ref(Close,-1)<=Ref(Close,-3)) 
       AND (Ref(Close,-2)<=Ref(Close,-3)) AND ((Ref(Close,-4)>Ref(Close,-2)) OR (Ref(Close,-4)<=Ref(Close,-2)) 
       AND (Ref(Close,-5)>=Ref(Close,-3))) OR (Close>=Ref(Close,-1)) AND (Ref(Close,-1)<=Ref(Close,-2)) 
       AND (Close>=Ref(Close,-2)) AND ((Ref(Close,-3)>Ref(Close,-1)) OR (Ref(Close,-3)<=Ref(Close,-1)) 
       AND (Ref(Close,-4)>=Ref(Close,-2))));
VARA2=LLV(Low,5);
VARA3=HHV(High,5);
VARA4=EMA(((Close-VARA2)/(VARA3-VARA2))*(100),4);
VARA5=EMA((0.66699999)*(Ref(VARA4,-1))+(0.333)*(VARA4),2);
VARA6=(VARA5<24 and="" lose="" p="" pen="">

Buy2 =IIf(VARA1 AND (VARA6),30,0);
Plot(Buy2, "BUY", 8,2+4);
Plot(-Buy2, "", 8,2+4);

_SECTION_BEGIN("Exploration");
pfrom = Param("Price From", 0, 0, 1000, 0.5 );
pto = Param("Price To", 1000, 0, 1000, 0.5 );
Minv = Param("Minimum Volume (K)", 500, 0, 1000, 50);
dd = Param("Decimal Digits", 1.2, 1, 1.7, 0.1 );

Buy = Buy1 OR Buy2;
Filter = Buy AND C>pfrom AND C1000*Minv;
Color = IIf(Close>Open, colorGreen, colorRed);
bcolor = IIf(Buy1 OR Buy2, colorGreen, 1);

AddColumn(Buy, "Buy" , 1.1, bcolor);
AddColumn(O, "Open", dd, textColor = Color);
AddColumn(C, "Close", dd, textColor = Color);
AddColumn(V, "Volume", 1, textColor = Color);
AddTextColumn(FullName(),"Name");
_SECTION_END();


_SECTION_BEGIN("Earth");
//Copyright 9Trading.com
SetChartBkColor( colorDarkTeal ) ;
n = Param("Periods", 14, 5, 25, 1 );

var6=(2*Close+High+Low)/4;
var7=LLV(L,n);
var8=HHV(H,n);
var9=EMA((var6-var7)/(var8-var7)*100,5);
varA=EMA(0.333*Ref(var9,-1)+0.667*var9,3);
UP=Var9; 
DOWN=Vara; 
Oo=IIf(up
Hh=Oo;
Ll=IIf(up
Cc=Ll;
barcolor2=
IIf( (Ref(up,-1)>Ref(down,-1) AND Ref(up,-1)>up AND up>down ) 
  OR (Ref(up,-1)
  , colorDarkTeal,
  IIf(up>down,colorBrightGreen,colorRed));
SetBarFillColor( IIf( C > O, colorDarkTeal,colorDarkTeal));

PlotOHLC( Oo,hh,ll,Cc, "", barcolor2, styleCandle );

n=3;
var3=(C-LLV(L,14))/(HHV(H,14)-LLV(L,14))*100;
var4=WMA(var3,9);
var5=WMA(var4,3);
j=3*var4-2*var5;
a2=EMA(var4,n);
a3=EMA(a2,n);
a4=EMA(a3,n);
a5=EMA(a4,n);
aa=EMA(a5,n);
Midbot=LLV(j,aa);
Plot(midbot,"Support",colorBlue,1);

res=HHV(j,45);
Plot(res,"Resistance",colorRed,1);
b1=(H+L+C)/3;
b2=HHV(b1,15);
b3=LLV(b1,15);
b4=b2-b3;
b5=MA((b1-b3)/b4,3)*100;
Plot(b5,"Position",7,4);
_SECTION_END();





About

Parag Patil is a technical analyst and trading system designer with stock excel programmer. I hope the articles and live chart of nse future and mcx on this Website will be as helpful and profitable to you . I try to update and post new articles tips everyday. My motto is to encourage the traders, so that they should able to understand the technique views behind the moment of stocks. I have deeply analyzed with many technical indicator with parameter and added to my amibroker afl. And even taken backtest report which is never being implemented. Any of the analyst expect me. Seeing all this you may understand that my views is more technical than commercial. If you are profited by my views I fill happy.

Dear Friends,
Sorry to say that you are suffered for the chart initially available, now they are restored and you can very well see the chart on money99.org similar to money99.in.
And all of you are intimated that we are going to develop more and more in money99.org to facilitate your dreamy demands.

Latest updates tips : Follow

© Copyright 2015 Money99. Designed by Parag Patil