Does anyone have this AFL ?

pratapvb

Well-Known Member
#32
Hey guys,
Just wondering if any one has a code which displays the ATR of last 50 bars on a chart ?

Thx

Isa
that is there standard in ami....check under indicators section
 
#33
hi isabella


ATR IS powerful indicator but needs to be seen in a separate chart.
Trading is to done when prices change more and more between Low and HIGH or HIGH AND LOW THE GAP WIDENING,more ATR,more the supply-demand gap widening.
ATR(50) in simple terms,plots (high-low) of past 50 bars and adds it then divides by 50-to get you average range over past 50 bars.
If you pick stock or index that has ATR(50) at 1 or 2 units,
it means the instrument doesn,t really move and Nobody is interested in it-Nobody wants to buy or sell.

Instead, if you found an instrument-a stock THAT HAS ATR(50)=5 OR 10, it means there is volatility-OR MOVEMENT in the instrument and you can trade it.
THUMB RULE1 DONT TRADE INSTRUMENTS WIH LOW ATR VALUES.
THUMB RULE2 YOU CAN TAKE A PROFIT OF HALF OF ATR(50).

Look for ATR AVERAGE TRUE RANGE
under indicators

or just paste this code
in formula space
-------------
//GET ATR50 PLOTTED IN A CHART

Plot(ATR(50),"ATR(50)",colorRed,styleThick);//USE ON A SEPARATE CHART

===================================================
USE THE CODE BELOW FOR ATR BASED ENTRIES
BUY AFTER BLUE CANDLE APPEARS & CROSSES PREVIOUS CANDLE CLOSE AND EXIT BLUE CANDLE CLOSE BELOW PREVIOUS TWO BARSLOW,OR ON COLOR CHANGE OR ON STOPLOSS GETTING HIT.
//======================
//SIMPLE ENTRY AND STOPLOSS
LongTrailStop = HHV( C - 2 * ATR(10), 15 );
Plot( LongTrailStop, "Long Trailing stop", colorBrown, styleThick | styleLine );
EntrySignal = C > ( LLV( L, 20 ) + 2 * ATR( 10 ) );
ExitSignal = C < ( HHV( H, 20 ) - 2 * ATR( 10 ) );
Color = IIf( EntrySignal, colorBlue, IIf( ExitSignal, colorOrange, colorGrey50 ));

Plot(C,"CLOSE",COLOR,styleCandle);
----------------------------------------------------
PS
IF CANDLES ARE not SHOWING BLUE AND ORANGE COLORS,
GO TO Preferences-charting-candlesticks-choose option saying " use distinct color for body outline online only".then click apply-ok
 
Last edited:

dell

Well-Known Member
#34
hi isabella


ATR IS powerful indicator but needs to be seen in a separate chart.
Trading is to done when prices change more and more between Low and HIGH or HIGH AND LOW THE GAP WIDENING,more ATR,more the supply-demand gap widening.
ATR(50) in simple terms,plots (high-low) of past 50 bars and adds it then divides by 50-to get you average range over past 50 bars.
If you pick stock or index that has ATR(50) at 1 or 2 units,
it means the instrument doesn,t really move and Nobody is interested in it-Nobody wants to buy or sell.

Instead, if you found an instrument-a stock THAT HAS ATR(50)=5 OR 10, it means there is volatility-OR MOVEMENT in the instrument and you can trade it.
THUMB RULE1 DONT TRADE INSTRUMENTS WIH LOW ATR VALUES.
THUMB RULE2 YOU CAN TAKE A PROFIT OF HALF OF ATR(50).

Look for ATR AVERAGE TRUE RANGE
under indicators

or just paste this code
in formula space
-------------
//GET ATR50 PLOTTED IN A CHART

Plot(ATR(50),"ATR(50)",colorRed,styleThick);//USE ON A SEPARATE CHART

===================================================
USE THE CODE BELOW FOR ATR BASED ENTRIES
BUY AFTER BLUE CANDLE APPEARS & CROSSES PREVIOUS CANDLE CLOSE AND EXIT BLUE CANDLE CLOSE BELOW PREVIOUS TWO BARSLOW,OR ON COLOR CHANGE OR ON STOPLOSS GETTING HIT.
//======================
//SIMPLE ENTRY AND STOPLOSS
LongTrailStop = HHV( C - 2 * ATR(10), 15 );
Plot( LongTrailStop, "Long Trailing stop", colorBrown, styleThick | styleLine );
EntrySignal = C > ( LLV( L, 20 ) + 2 * ATR( 10 ) );
ExitSignal = C < ( HHV( H, 20 ) - 2 * ATR( 10 ) );
Color = IIf( EntrySignal, colorBlue, IIf( ExitSignal, colorOrange, colorGrey50 ));

Plot(C,"CLOSE",COLOR,styleCandle);
----------------------------------------------------
PS
IF CANDLES ARE not SHOWING BLUE AND ORANGE COLORS,
GO TO Preferences-charting-candlesticks-choose option saying " use distinct color for body outline online only".then click apply-ok
thanx ,ford7k for atr code , can u plz mention some profit booking points in this code .......as when to book profit ,when to stand with trend etc ......some inputs from u will be a great help ...........

p.s.; is it same code that u earlier mention as complete trading system ?
 
#35
Hi Ford,
:thumb:Thank you for the code as well the trading strategy. However I was hoping for a AFL code that would display the ATR where the title is in the basic price chart itself.

Thx again,


ISA
 

pratapvb

Well-Known Member
#36
Hi Ford,
:thumb:Thank you for the code as well the trading strategy. However I was hoping for a AFL code that would display the ATR where the title is in the basic price chart itself.

Thx again,


ISA
ATRp = Param("Period", 50, 1, 1000, 1) ;

ATRv = ATR(ATRp) ;
Title = Title + " ATR ("+NumToStr(ATRp, 1.0)+") " + NumToStr(ATRv, 1.1) ;
 

Similar threads