Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

ATR Exit for Amibroker (AFL)
sweetncu
about 13 years ago
Amibroker (AFL)

Rating:
3 / 5 (Votes 5)
Tags:
amibroker, stop loss

Another atr trading formula. hope u will like it with good improvement.

Screenshots

Similar Indicators / Formulas

NRTR WATR
Submitted by allexiss over 12 years ago
DODA BAND BUY SELL
Submitted by saas almost 11 years ago
JMA Stoploss
Submitted by kuzukapama over 12 years ago
TSL & HL & New
Submitted by morgen almost 12 years ago
Stop Loss Indicator
Submitted by nabcha almost 14 years ago
ABKP Benchmark Bar
Submitted by amitabh almost 14 years ago

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("ATRtrading");
SetChartBkColor( colorBlack ) ;
period = Param("Period", 13, 1, 240, 1);
mult = Param("Multiplier", 1.7, 1, 240, 0.1);
 
f=ATR(period);

VS[0] = Close[0];
trend[0] = 0;
HighC[0]=0;
Lowc[0]=0;

for( i = period+1; i < BarCount; i++ )
{

vs[i] = vs[i-1];
trend[i] = trend[i-1];
highC[i] = HighC[i-1];
lowc[i] = lowc[i-1];

if ((trend[i]>=0) && ( C[i] <VS[i] ))
{
trend[i] =-1;
HighC[i] = C[i];
lowc[i] = C[i];
}

if ((trend[i]<=0) && (C[i] >VS[i]))
{
trend[i]=1;
HighC[i] = C[i];
lowc[i] = C[i];
}

if (trend[i]==-1)
{
if (C[i]<lowc[i]) lowc[i] = C[i];
VS[i]= lowc[i]+ (mult*f[i]);
}


if (trend[i]==1)
{
if (C[i]>HighC[i]) HighC[i] = C[i];
VS[i]= HighC[i]-(mult*f[i]);
}

}


Buy=Cross(Trend,0);
Sell=Cross(0, Trend);

Plot(Close,"Close",colorBlue,styleCandle);
Plot(VS, "Vol Stop",IIf(trend==1,10,11 ),styleThick);

mkol = IIf( Trend==1, 10, 11);
Plot(5, "ribbon", mkol, styleOwnScale|styleArea|styleNoLabel, 0, -5); // Weekly trend

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low-f, High+f));
_SECTION_END();

//========================fib levels=========================


StartBar=SelectedValue(BarIndex());
FinishBar = EndValue( BarIndex() );
i = startbar;
period = FinishBar - StartBar;

Lo =LLV(L,period);
Hi = HHV(H,period);
Line0 = 0;
Line1 = 0;
Line2 = 0;
Line3 = 0;
Line4= 0;
Line100 = 0;

for( i = startbar; i < finishbar; i++ )
{
if(EndValue(C)<SelectedValue(C))
{
Line0  = EndValue(Lo);
Line100 = EndValue(Hi);
Line1 = Line0 + abs(Line100-Line0)*0.236;
Line2 = Line0 + abs(Line100-Line0)*0.382;
Line3 = Line0 + abs(Line100-Line0)*0.5;
Line4 = Line0 + abs(Line100-Line0)*0.618;
}
else
{
Line100  = EndValue(Lo);
Line0 = EndValue(Hi);
Line1 =Line0 - abs(Line100-Line0)*0.236;
Line2 = Line0 - abs(Line100-Line0)*0.382;
Line3 = Line0 - abs(Line100-Line0)*0.5;
Line4 = Line0 - abs(Line100-Line0)*0.618;
}
}

//external fib lines begining fom selecetdbarindex()
fib0= LineArray(startbar, Line0, finishbar, Line0, 0, 1);
fib100 = LineArray(startbar, Line100, finishbar, Line100, 0, 1);
// depth of middle lines
n= round((finishbar-startbar)/2);

// middle lines
fib1= LineArray((finishbar-n), Line1, finishbar, Line1, 0, 1);
fib2= LineArray((finishbar-n), Line2, finishbar, Line2, 0, 1);
fib3= LineArray((finishbar-n), Line3, finishbar, Line3, 0, 1);
fib4= LineArray((finishbar-n), Line4, finishbar, Line4, 0, 1);
Plot(fib0,"", colorGreen);
Plot(fib100,"", colorRed);
//Plot(fib1,"", colorYellow);
Plot(fib2,"", colorPink);
//Plot(fib3,"", colorOrange);
Plot(fib4,"", colorLightBlue);
_SECTION_END();

1 comments

1. WolfofBist

It seems that the formula references FUTURE quotes.
If you backtest this system you may receive outstanding results
that CAN NOT be reproduced in real trading

Leave Comment

Please login here to leave a comment.

Back