moneyy99

Showing posts with label AFL. Show all posts
Showing posts with label AFL. Show all posts

Thursday, 21 January 2016

Pinout explore afl for amibroker with supportive excel sheet



Above image of Pinout explore afl 

This afl you can download from given link , and after installation use it for  analysis mode - explore in amibroker. 


दिए गए लिंक द्वारा आप अमिब्रोकर की AFL और साथ मे एक्सेल फाइल भी डाउनलोड हो जायेगी| इस के साथ आप  supportive excel फाइल किस तरह से इस्तमाल कर सकते हो ये जानकारी नीच स्पस्टीकरण मे दी गयी है| 



१) Amibroker explore डाटा कॉपी करे|

२) Then open excel sheet and click paste button.
आप ने Excel Sheet खोल ने के बाद Paste बटन पर क्लिक करे  इस से explore का डाटा कॉपी हो जायेगा|


 This tools you can use for intraday or eod basis analysis for only next day.  Any query please comments. More details watch video 



Saturday, 18 October 2014

Advanced Trend Lines Afl for amibroker

Image of Afl
Explore Image 







Wednesday, 24 September 2014

RSI Cloud afl for amibroker

               






RSI Cloud afl for amibroker


Relative Strength Index
The Relative Strength Index (RSI) was developed by J. Welles Wilder in the 1970′s. It is a very useful and popular momentum oscillator that compares the magnitude of a stock’s recent gains to the magnitude of its recent losses

Friday, 12 September 2014

Jobbing Trading System for amibroker

Jobbing Trading System Backtest Result


The results from January 1995 to August 2014 :
  • Stock Name -                     Nifty spot
  • Time frame -                       Daily
  • Trade size -                       100 Share
  • Commission ;                     100 Rs per trade
  • Average Annual Return:     16.50 % p.a.
  • Maximum Draw-down:     - 29 % p.a.
  • Win Percentage:                67.83 % p.a.
  • Amount of Trades:             115
  • Ending Capital:              Rs. 19,26,251



















Tuesday, 9 September 2014

Trend Detection Afl -2 for amibroker

Trend Detection Afl -2 for amibroker




_SECTION_BEGIN("ENTER");
/*The Saturation Indicator D_sat, by Dimitris Tsokakis, Dec 2002*/
P=30;
CMO30=100*((Sum(IIf(C>Ref(C,-1),(C-Ref(C,-1)),0),P))-(Sum(IIf(CRef(C,-1),(C-Ref(C,-1)),0),P)+(Sum(IIf(C

C1=DEMA(CMO30,30);
D_sat10=RSIa(C1,10);
D_sat5=RSIa(C1,5);
Plot(D_sat10,"D_sat10",1,1);Plot(D_sat5,"TREND",5,1);Plot(D_sat5-D_sat10,"DIRECTION
difference",9,2);

// Rribbon Code starts here

up =Cross(d_sat5,d_sat10)OR d_sat5 > d_sat10;
down =Cross(d_sat10,d_sat5)OR d_sat10 > d_sat5;

//Plot( Close, "Price", colorBlue, styleCandle );
Plot( 100,   /* defines the height of the ribbon in percent of pane
width */
"Ribbon",IIf( up, colorGreen, IIf( down, colorRed, 0 )), /* choose color
*/
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
_SECTION_END();

Sunday, 7 September 2014

Trend Detection Afl - 1 for amibroker

Trend Detection Afl - 1 for amibroker




"TrendChart";

//Coding by rmike
p=Param("RSI Periods", 14, 2, 100,1);

A=EMA(C,9);
A1=WMA(C,45);
B=EMA(RSI(p),9);
B1=WMA(RSI(p),45);

TU=A>A1 AND B>B1;
TD=A<=A1 AND B<=B1;
TSU=A>A1 AND B<=B1;
TSD=A<=A1 AND B>B1;

_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 ) ) )
+ EncodeColor(colorYellow) + "\nTrend Interpretation - " + EncodeColor(colorGreen) + WriteIf(TU,"TREND UP","") + EncodeColor(colorRed) + WriteIf(TD,"TREND DOWN","" )
+ EncodeColor(colorPaleGreen) + WriteIf(TSU,"TREND SIDEWAYS TO UP","" ) + EncodeColor(colorPink) + WriteIf(TSD,"TREND SIDEWAYS TO DOWN","" ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

if( ParamToggle("Chart Type", "Trend Bacground|Trend Ribbon" ) ) 
 Plot( 2, "", IIf( TU, colorGreen, IIf( TD, colorRed, IIf(TSU, colorLime, IIf(TSD, colorPink, Null )))), styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
else 
 Plot( 1, "", IIf( TU, colorGreen, IIf( TD, colorRed, IIf(TSU, colorLime, IIf(TSD, colorPink, Null )))), styleOwnScale|styleArea|styleNoLabel, 0, 1 );
}



CrossB=Cross(EMA(C,5),EMA(O,6));
CrossS=Cross(EMA(O,6),EMA(C,5));
shape = CrossB * shapeUpArrow + CrossS * shapeDownArrow;

_SECTION_BEGIN("tboly varázs afl");
SetChartOptions(0, chartShowArrows | chartShowDates);
// ****************  INITIAL CONDITIONS:
bi = BarIndex() - 1;
//  ************************************** ADAPTIVE PERIODS ***********************
// ****************  BASE PERIODS
tf = Param("tf", 1, 1, 500, 1);
bp = tf * Param("bp", 4, 2, 500, 1);
// ************************************************************
HiHi = HHV(H, bp);
HiRH = Ref(HiHi,  - 1);
LoLw = LLV(L, bp);
LoRL = Ref(LoLw,  - 1); // long exit
//Plot(  HiHi, "H",  colorCustom12  , 1);
//Plot(  LoLw, "L",  colorCustom9 , 1);
//Plot(  Lorl, "L",  colorBlue , 32);
//Plot(  Hirh, "H",  colorRed  , 32);
bs = BarsSince(H == HiHi); // Promt 
bl = BarsSince(L == LoLw); // Promt
LtHL = ValueWhen(bs > bl, HiHi);
StLH = ValueWhen(bs < bl, LoLw);
BarLthl = BarsSince(bs < bl AND Hirh == Lthl);
BarStLH = BarsSince(bs > bl AND Lorl == Stlh);
PlotShapes(IIf(bs > bl AND Ref(bs,  - 1) < Ref(bl,  - 1), shapeSmallDownTriangle, 0), colorRed, layer = 0, yposition = H, offset =  - 10);
PlotShapes(IIf(bs < bl AND Ref(bs,  - 1) > Ref(bl,  - 1), shapeSmallUpTriangle, 0), colorBlue, layer = 0, yposition = L, offset =  - 10);
BarloSl = IIf(BarStLH > BarLthl, BarLthl + 1, 0);
BarshSl = IIf(BarStLH < BarLthl, Barstlh + 1, 0);
LoLL = LLV(L, bl + 1);
//Plot( IIf(  bl > 0 , LoLL,  Null) ,  "",  colorBlue,  1 );
LoH = HHV(H, bl + 1);
Plot(IIf(bl > 0, LoH, Null), "", colorCustom9, 1); // Range sign
ShHH = HHV(H, bs + 1);
//Plot( IIf(  bs > 0 , ShHH,  Null) ,  "",  colorRed,   1); 
ShL = LLV(L, bs + 1);
Plot(IIf(bs > 0, ShL, Null), "", colorCustom12, 1); // Range sign
// ************************ NOISE   ********************************
//Noise= MA( HHV(H,bp/6)-LLV(L,bp/6) ,bp);
// ********************** NOISE HL1 *******************************
np = Param("np", 2, 2, 500, 1);
NoHL = H - L;
NoHLMa = MA(Nohl, np);
mpHL1 = NoHL / NoHLMa;
// ********************** NOISE HL2 *******************************
Noise = HHV(H, 2 *tf) - LLV(L, 2 *tf);
NoiseMa = MA(Noise, np);
momHL = NoHL / NoiseMa;
momLo = momHL >= 1 AND C > O;
momSh = momHL >= 1 AND C < O;
momlb = 1100; //Param("momlb",100,2,2500,1);
momst = Sum(IIf(momHL >= 1, 1, 0), momlb) / momlb * 100;
//PlotShapes(IIf(momlo,shapeSmallCircle,0),colorBlue, layer = 0, yposition= H, offset =  15 );
//PlotShapes(IIf(momsh,shapeSmallCircle,0),colorRed, layer = 0, yposition =L, offset = - 15 );
mpnma = Noise / NoiseMa;
mpn = Param("mpnoise", 0.85, 0, 3, 0.025);
HLVlsl2 = LLV(L + noisema * mpn *(1+log10(bs + 1)), bs + 1);
Plot(IIf(bs > 0, Ref(Min(Hlvlsl2, shhh),  - 1), Null), "Sh", colorBlue, 1); // Range sign + noise
//Plot(  Ref(Min(Hlvlsl2,shhh),-1) ,  "Sh",  colorBlue,  1); // Range sign + noise
Plot(IIf(bs > 0, (Ref(Min(Hlvlsl2, shhh),  - 1) + shl) / 2, Null), "Shf", colorBlue, 32);
HLVlsl = HHV(H - noisema * mpn *(1+log10(bl + 1)), bl + 1);
Plot(IIf(bl > 0, Ref(Max(HLvlsl, Loll),  - 1), Null), "Lo", colorRed, 1); // Range sign-noise
//Plot(  Ref(Max(HLvlsl,Loll),-1)   ,  "Lo",  colorRed,  1); // Range sign-noise
Plot(IIf(bl > 0, (Ref(Max(HLvlsl, Loll),  - 1) + Loh) / 2, Null), "Lo", colorRed, 32);
//  ********************  HL2 NOISE BASE LG  ****************************************
RHAb = (ShHH - LoLL);
//Plot( (H+L)/2+Ref(MA(H-L,bp),-1)/2,"",colorBlack,1);
//Plot( (H+L)/2-Ref(MA(H-L,bp),-1)/2,"",colorBlack,1);
dHLNoise = IIf((bs > 0 AND Ref(Hlvlsl2,  - 1) < Ref(shhh,  - 1))AND(bl > 0 AND Ref(HLvlsl,  - 1) > Ref(Loll,  - 1)), 
(Ref(Min(Hlvlsl2, shhh),  - 1) - Ref(Max(HLvlsl, Loll),  - 1)) / (noisema *mpn), 0);
//  **********************************************************************************************************
//   ****************************  BUY/SELL CONDITIONS ******************************************************
/*
Buy =   bl>0 AND L< Ref(Max(HLvlsl,Loll),-1) AND H >Ref(Max(HLvlsl,Loll),-1)  ;
//BuyPrice= LFLong  ;
Sell=  bs>0 AND  H> Ref(Min(Hlvlsl2,shhh),-1) AND L< Ref(Min(Hlvlsl2,shhh),-1)    ;
//SellPrice= LFShort ;
// ****************  FLIP CONDITIONS
//Buy = ExRem(Buy,Sell);                                                        
//Sell = ExRem(Sell,Buy);
PlotShapes(IIf(Buy,shapeUpArrow,0),colorBlue, layer = 0, yposition= Low, offset = - 10 );
//PlotShapes(IIf(Sell,shapeHollowDownArrow,0),colorRed, layer = 0, yposition =High, offset = - 25 );
//   ****************************  SHORT/SELL CONDITIONS ******************************************************
Short=Sell;
Cover=Buy;
PlotShapes(IIf(Short,shapeDownArrow,0),colorRed, layer = 0, yposition =High, offset = - 10 );
//PlotShapes(IIf(Cover ,shapeHollowUpArrow,0),colorBlue, layer = 0, yposition= Low, offset = - 25 );
 */
//  ************************** PLOT CANDLE ***********************
/*
Plot( Close, "",
IIf( (L > LFLong  AND  LFLongL  < LFLongS)   , colorBlue,
IIf( (H < LFShort AND !LFShortL < LFShortS)   , colorRed,
//IIf(    LFLongL   < LFLongS  AND !LFShortL < LFShortS , colorBlack,
//AND LFShortL < LFShortS AND !LFLongL < LFLongS
colorBlack)) , styleCandle );
//OR (LFShort> LFLong  AND L>LFShort)
//OR (LFShort> LFLong  AND H
 */
//  ************************** PLOT RIBBON
Plot(1, "", 
IIf(bl < bs, colorRed, 
IIf(bl > bs, colorBlue, 
54)), 
styleOwnScale | styleArea | styleNoLabel,  - 0.5, 100);
/*
Plot( 2,  "",
IIf(   bl > 0    , colorBlue,
//IIf(   bl > bs AND L< Ref(Max(HLvlsl,Loll),-1) AND H
54), 
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
 */
// ***************************  TITLE ****************************
Title = 
StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", 
O, H, L, C, SelectedValue(ROC(C, 1)))
 + " \\c29 \np = \\c-1" + WriteVal(bp, 1) + " \\c29 Barindex = \\c-1" + WriteVal(bi, 1)
 + " \\c32 \nMom = \\c-1" + WriteVal(MomHL, 1.2) + " \\c32 Mom% = \\c-1" + WriteVal(Momst, 1.2)
 + " \\c32 \nNoise = \\c-1" + WriteVal(noise, 1.4) + " \\c32 Noisema = \\c-1" + WriteVal(noisema, 1.4)
 + " \\c32 mpNoise = \\c-1" + WriteVal(mpnma, 1.2)
 + " \\c29 \nNoiHL = \\c-1" + WriteVal(noHL, 1.4) + " \\c29 NoiHLma = \\c-1" + WriteVal(noHLma, 1.4)
 + " \\c29 mpNoiHL = \\c-1" + WriteVal(mpHL1, 1.2)
 + " \\c29 \nL = \\c-1" + WriteVal(bl, 1) + " \\c29 Lbp = \\c-1" + WriteVal(bl / bp, 1.1)
 + " \\c32 \nS = \\c-1" + WriteVal(bs, 1) + " \\c32 Sbp = \\c-1" + WriteVal(bs / bp, 1.1)
 + " \\c29 \nBarlong = \\c-1" + WriteVal(barlthl, 1.0) + " \\c32 BarShort = \\c-1" + WriteVal(barstlh, 1.0)
 + " \\c32 BarTrRange = \\c-1" + WriteVal(bl - bs, 1.0)
 + " \\c32 \nRHAb = \\c-1" + WriteVal(RHAb, 1.2) + " \\c32 R%Top = \\c-1" + WriteVal( - RHAb / ShHH * 100, 1.2)
 + " \\c29 R%Bot = \\c-1" + WriteVal(RHAb / LoLL * 100, 1.2) + " \\c29 \nRelLoH = \\c-1" + WriteVal(IIf(bl > 0, (H / Ref(L,  - bl) *100-100) / (bl + 1), H / L * 100-100), 1.2)
//+  " \\c29 RelLoL = \\c-1" +  WriteVal(IIf( bl>0, (L/Ref(L,-bl)*100-100)/(bl+1),0 ) ,1.2) +  " \\c29 Lbase = \\c-1"+WriteVal( slg,1.2)
 + " \\c29 RelLoRew = \\c-1" + WriteVal(IIf(bl > 0, ((L / Ref(L,  - bl) *100-100) / (bl + 1)) / ((H / Ref(L,  - bl) *100-100) / (bl + 1)) *100-100, 0), 1.2)
 + " \\c32 \nRelShH = \\c-1" + WriteVal(IIf(bs > 0, (L / Ref(H,  - bs) *100-100) / (bs + 1), L / H * 100-100), 1.2)
 + " \\c32 RelShH = \\c-1" + WriteVal(IIf(bs > 0, (H / Ref(H,  - bs) *100-100) / (bs + 1), 0), 1.2)
 + " \\c32 RelShRew = \\c-1" + WriteVal(IIf(bs > 0, ((H / Ref(H,  - bs) *100-100) / (bs + 1)) / ((L / Ref(H,  - bs) *100-100) / (bs + 1)) *100-100, 0), 1.2)
;
_SECTION_END();





Plot(6, "", IIf(PDI(7) > MDI(7) AND PDI(7) > 25,colorGreen,IIf (MDI(7) > PDI(7) AND MDI(7) > 25,colorRed,colorYellow)), styleOwnScale| styleArea|styleNoLabel,-0.5,100);

_SECTION_BEGIN("Fibo for all bars");

TimeFrameSet( in15Minute*2 ); 
DH=Ref(H,-1); 
DL=Ref(L,-1);
DC=Ref(C,-1);


pd = (O+ DH+ DL + DC )/4;
sd1 = (2*pd)-DH;
sd2 = pd -(DH - DL);
sd3 = Sd1 - (DH-DL); 
rd1 = (2*pd)-DL;
rd2 = pd +(DH -DL);
rd3 = rd1 +(DH-DL);



//Plot (pd,"Pivot",colorBlue,styleDots);
//Plot (rd1," R1 ",35,styleDots);
//Plot (rd2," R2 ",35,styleDots);
//Plot (rd3," R3 ",35,styleDots);

//Plot (sd1," S1 ",4,styleDots);
//Plot (Sd2," S2 ",4,styleDots);
//Plot (Sd3," S3 ",4,8+16);
/*
style = IIf(ParamList("Chart style", "styleCandle|styleBar")=="styleCandle",64,128+4);
Plot (C,Date ()+" close",1,style); //ENABLE THIS TO HAVE CANDLES AS WELL
*/
TimeFrameRestore();


Title = EncodeColor(colorWhite)+ "" + " - " +  Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
 "  - " + Date() +" - "
//+ WriteIf(Col_action==colorGreen, EncodeColor(colorGreen)+"stay LONG","")+ WriteIf(Col_action==colorRed, EncodeColor(colorRed)+"stay SHORT","")+  WriteIf(Col_action==colorBlack, EncodeColor(colorYellow)+"No Trend","")+"\n"
+ "Vol= "+ WriteVal(V) +WriteIf ( V > MA(V,26) ,EncodeColor(colorGreen)+"  UP "+ (V/MA(V,26))*100 + " %", EncodeColor(colorRed)+"  DOWN "+ (V/MA(V,26))*100 + " %")
+ EncodeColor(colorGreen)+   "\n R3 : "+ EncodeColor(colorWhite)+RD3
+ EncodeColor(colorGreen)+   "\n R2 : "+ EncodeColor(colorWhite)+RD2
+ EncodeColor(colorGreen)+   "\n R1 : "+ EncodeColor(colorWhite)+RD1+ EncodeColor(colorGreen)+   "`            Hi: "+ EncodeColor(colorWhite)+H
+ EncodeColor(colorBlue)+   "\n Pivot : "+ EncodeColor(colorWhite)+pd + EncodeColor(colorYellow)+   "`   Op: "+ EncodeColor(colorWhite)+O+ EncodeColor(colorAqua)+   "Cl: "+ EncodeColor(colorBrightGreen)+C
+ EncodeColor(colorRed)+   "\n S1 : "+ EncodeColor(colorWhite)+SD1+ EncodeColor(colorRed)+   "`            Lo: "+ EncodeColor(colorWhite)+L
+ EncodeColor(colorRed)+   "\n S2 : "+ EncodeColor(colorWhite)+SD2
+ EncodeColor(colorRed)+   "\n S3 : "+ EncodeColor(colorWhite)+SD3
;

_SECTION_END();

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);

Plot( C, "Close", IIf(MACD(3,34) > Signal(3,34,9),colorGreen, colorRed), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

_SECTION_BEGIN("Fibo for all bars");

TimeFrameSet( in15Minute*2 ); 
DH=Ref(H,-1); 
DL=Ref(L,-1);
DC=Ref(C,-1);


pd = (O+ DH+ DL + DC )/4;
sd1 = (2*pd)-DH;
sd2 = pd -(DH - DL);
sd3 = Sd1 - (DH-DL); 
rd1 = (2*pd)-DL;
rd2 = pd +(DH -DL);
rd3 = rd1 +(DH-DL);



//Plot (pd,"Pivot",colorBlue,styleDots);
//Plot (rd1," R1 ",35,styleDots);
//Plot (rd2," R2 ",35,styleDots);
//Plot (rd3," R3 ",35,styleDots);

//Plot (sd1," S1 ",4,styleDots);
//Plot (Sd2," S2 ",4,styleDots);
//Plot (Sd3," S3 ",4,8+16);
/*
style = IIf(ParamList("Chart style", "styleCandle|styleBar")=="styleCandle",64,128+4);
Plot (C,Date ()+" close",1,style); //ENABLE THIS TO HAVE CANDLES AS WELL
*/
TimeFrameRestore();


Title = EncodeColor(colorWhite)+ "" + " - " +  Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
 "  - " + Date() +" - "
//+ WriteIf(Col_action==colorGreen, EncodeColor(colorGreen)+"stay LONG","")+ WriteIf(Col_action==colorRed, EncodeColor(colorRed)+"stay SHORT","")+  WriteIf(Col_action==colorBlack, EncodeColor(colorYellow)+"No Trend","")+"\n"
+ "Vol= "+ WriteVal(V) +WriteIf ( V > MA(V,26) ,EncodeColor(colorGreen)+"  UP "+ (V/MA(V,26))*100 + " %", EncodeColor(colorRed)+"  DOWN "+ (V/MA(V,26))*100 + " %")
+ EncodeColor(colorGreen)+   "\n R3 : "+ EncodeColor(colorWhite)+RD3
+ EncodeColor(colorGreen)+   "\n R2 : "+ EncodeColor(colorWhite)+RD2
+ EncodeColor(colorGreen)+   "\n R1 : "+ EncodeColor(colorWhite)+RD1+ EncodeColor(colorGreen)+   "`            Hi: "+ EncodeColor(colorWhite)+H
+ EncodeColor(colorBlue)+   "\n Pivot : "+ EncodeColor(colorWhite)+pd + EncodeColor(colorYellow)+   "`   Op: "+ EncodeColor(colorWhite)+O+ EncodeColor(colorAqua)+   "Cl: "+ EncodeColor(colorBrightGreen)+C
+ EncodeColor(colorRed)+   "\n S1 : "+ EncodeColor(colorWhite)+SD1+ EncodeColor(colorRed)+   "`            Lo: "+ EncodeColor(colorWhite)+L
+ EncodeColor(colorRed)+   "\n S2 : "+ EncodeColor(colorWhite)+SD2
+ EncodeColor(colorRed)+   "\n S3 : "+ EncodeColor(colorWhite)+SD3
;

_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", colorBlack ), styleCandle
| ParamStyle("Style") | GetPriceStyle() ); 
// Paste the code below to your price chart somewhere and green ribbon means both
// both MACD and ADX trending up so if the red ribbon shows up the MACD and the ADX 
// are both trending down.

_SECTION_BEGIN("trending ribbon");
uptrend=PDI()>MDI()AND Signal()
downtrend=MDI()>PDI()AND Signal()>MACD();


Plot( 2, /* defines the height of the ribbon in percent of pane width */"ribbon",
IIf( uptrend, colorGreen, IIf( downtrend, colorRed, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );

_SECTION_END();

_SECTION_END();

_SECTION_BEGIN("LEMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 20, 2, 200, 1, 10 );
lema = EMA (Close,Periods)+ EMA((Close-EMA(Close,Periods)),Periods);
Plot( lEMA, _DEFAULT_NAME(), ParamColor( "Color", colorCycle ),
ParamStyle("Style") );
_SECTION_END();
Title = EncodeColor(colorPink)+ "Trend Detection " + " - " +  Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
 "  - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+"  "+"Hi-"+H+"  "+"Lo-"+L+"  "+
"Cl-"+C+"  "+ "Vol= "+ WriteVal(V)+"\n";

Sunday, 31 August 2014

ATR Volatility trading system for Amibroker

ATR VOLATILITY SYSTEM  

                                    is  Developed By :   Tudor Marcelin - Art Invest




today i have modified this system for daily base( time frame daily )  for index spot NSENIFTY. This system work on amibroker platform. I have modified and added new condition here and checkout its  backtest results since jan -2005 to aug -2014. Details are given below,



Download here :

//------------------------------------------------------------------------------
//
//  Formula Name:    ATR Volatility System
//  Author/Uploader: Marcelin 
//  E-mail:          marcelint@xnet.ro
//  Developed By :   Tudor Marcelin - Art Invest
//
//------------------------------------------------------------------------------
//
//  ATR trading system for short terms tradings. You can use it with Absolute
//  Strength Index for confirmation of signals.
//
//------------------------------------------------------------------------------

_SECTION_BEGIN("ATR Volatility Revised Edition");


GraphXSpace = 15;

SetChartOptions(0,chartShowArrows|chartShowDates);

SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0, 0)));

GfxSetBkMode(0); 

GfxSetOverlayMode(1);

SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color", colorGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey)));

Plot(C,"\nPrice",IIf(C>O,ParamColor("Wick UP Color", colorDarkGreen),IIf(C<=O,ParamColor("Wick Down Color", colorDarkRed),colorLightGrey)),64,0,0,0,0);

R = RSI(9);
SK = StochK(10, 3);
SD = StochD(10, 3, 3);
MH = MACD(12, 26) - Signal(12, 26, 9);

//Conditions for Buying
//rB1=Param("RB1",50,1,100,1);

Cond1 = ValueWhen(C,O
Cond2 = R > 53;

Cond3 = SD < 100 AND SD > Ref(SD, -1);
Cond4 = MH > 0 OR (MH < 0 AND MH > Ref(MH, -1));

//Conditions for Selling

Cond5 = ValueWhen(C,O>C);

Cond6 = R < 40;

Cond7 = SD > 20 AND SD < Ref(SD, -1);
Cond8 = MH < 0 OR (MH > 0 AND MH < Ref(MH, -1));

Buy1 = Cover= Cond1 AND Cond2 AND Cond3 AND Cond4 ;
Sell1 = Short=  Cond5 AND Cond6 AND Cond7 AND Cond8 ;



  
   n=Param( "period", 15, 5 , 20, 1 );
   k=Param( "factor", 0.9, 0.5 , 2.5, 0.1 );

  f=ATR(n);
    
/*R Resistance */
    R[0] = C[0]; 
/*S Support  */ 
    S[0] = C[0];
  
for( i = n+1; i < BarCount; i++ ) 

    R[i]=R[i-1];
    S[i]=S[i-1];
    if (( S[i-1]<=C[i-1]) AND (C[i-1] <=R[i-1] ) AND (C[i-1]+k*f[i-1])<=RV)

        R[i] = C[i-1]+k*f[i-1];
   
     if (( S[i-1]<=C[i-1]) AND (C[i-1]<=R[i-1] ) AND  (C[i-1]-k*f[i-1])>=SV)

        S[i]= C[i-1]-k*f[i-1];
  


  


    if ( C[i-1] >R[i-1] )
{
       R[i] = C[i-1]+k*f[i-1];
       S[i]= C[i-1]-k*f[i-1];
       RV=R[i];
       SV=S[i]; 
}   
    if ( C[i-1]
{

       R[i] = C[i-1]+k*f[i-1];
       S[i]= C[i-1]-k*f[i-1];
       RV=R[i];
       SV=S[i]; 



 Buy=Close>R AND Buy1;
 Sell=Close

Cump=IIf(Close>R,1,0);
Vanz=IIf(Close
}

Buy = ExRem( Buy, Sell ); 
Sell = ExRem( Sell, Buy );

iBuy = Flip( Buy, Sell ); 
iSell =Flip( Sell, Buy );



//Plot(IIf(iSell,R,Null), "Rez:",colorRed,styleDots|styleNoLine);
//Plot(IIf(iBuy,S,Null), "Sup:",colorGreen,styleDots|styleNoLine);

Short=Sell;

Cover=Buy;

Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy);  
Short=ExRem(Short,Cover); Cover=ExRem(Cover,Short);  
//SetOption("InitialEquity", 100000);
SetOption("AllowSameBarExit", False);
SetOption("AllowPositionShrinking", True);
SetOption("FuturesMode", True);
SetOption("InterestRate",0);
SetOption("MaxOpenPositions",1);
RoundLotSize= 2;
SetOption("MinShares",RoundLotSize);
SetOption("PriceBoundChecking",False);
//SetOption("CommissionMode",3);
//SetOption("CommissionAmount",12.5/RoundLotSize);
SetOption("AccountMargin",True);
SetOption("ReverseSignalForcesExit",False);
SetOption("UsePrevBarEquityForPosSizing",True);
SetOption("GenerateReport",1);
SetOption("MaxOpenLong",1);
SetOption("MaxOpenShort",1);
PositionSize = C*RoundLotSize*50.5;


SetOption("RefreshWhenCompleted",True);


//End of Settings for Backtester




BuyPrice=ValueWhen(Buy,C);

SellPrice=ValueWhen(Sell,C);

ShortPrice=ValueWhen(Short,C);

CoverPrice=ValueWhen(Cover,C);





Title = EncodeColor(colorWhite)+ "ATR Volatility 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(colorYellow)+

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(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);

PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);                      

PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);

//Magfied Market Price

FS=Param("Font Size",30,11,100,1);

GfxSelectFont("Times New Roman", FS, 700, True ); 

GfxSetBkMode( colorWhite );  

GfxSetTextColor( ParamColor("Color",colorGreen) ); 

Hor=Param("Horizontal Position",940,1,1200,1);

Ver=Param("Vertical Position",12,1,830,1); 

GfxTextOut(""+C, Hor , Ver );

YC=TimeFrameGetPrice("C",inDaily,-1);

DD=Prec(C-YC,2);

xx=Prec((DD/YC)*100,2);

GfxSelectFont("Times New Roman", 11, 700, True ); 

GfxSetBkMode( colorBlack );  

GfxSetTextColor(ParamColor("Color",colorYellow) ); 

GfxTextOut(""+DD+"  ("+xx+"%)", Hor , Ver+45 );




_SECTION_END();

© Copyright 2015 Moneyy99. Designed by Parag Patil