Need afl for AHR-ADR-AWR

#1
hi EXPERTS

we need an afl that gives AHR-average hourly range, ADR-average daily range and AWR-average weekly range for price.

What ADR does?

ADR is a tool to track breakout opportunities for trading.
if you know past 5 days ADR, you can see todays ADRTODAY AND IF RANGE IS HALF OR LESS TODAY IT MEANS-SIDWAYS MARKET IS PRESENT.
iF MARKET IS TRADING NEAR VALUE OF highest ADR for past 5 days,it means most chances are for reversal if sideways or breakout if trend sets in

at middle of day if you found today so far price moved only 30 points while ADR is 75 points for past 5 days,then you can anticipate a move for balance of ADR
HAR = HOURLY AR is range of past 20 hours
get hourly high,hourly low and compute average hourly range for past 20 data points
WE CAN KNOW WEEKLY ADRW OR WADR
this is average of adr weekly for 10 weeks.
we can know Monthly ADR ADRM OR MADR

Concept basis
ADR
take a day,find its high and its low
DH -DL = daily range

ADR10
ADR10 finds out what every days range is for past 10 days and averages it to get an average range.
it is day1 range=h1-l1 , day2 range = h2-l2, and so on for 10 days


AHR Average hourly range
This is useful for intraday traders.

ford
 

hitesh

Active Member
#2
hi EXPERTS

we need an afl that gives AHR-average hourly range, ADR-average daily range and AWR-average weekly range for price.

What ADR does?

ADR is a tool to track breakout opportunities for trading.
if you know past 5 days ADR, you can see todays ADRTODAY AND IF RANGE IS HALF OR LESS TODAY IT MEANS-SIDWAYS MARKET IS PRESENT.
iF MARKET IS TRADING NEAR VALUE OF highest ADR for past 5 days,it means most chances are for reversal if sideways or breakout if trend sets in

at middle of day if you found today so far price moved only 30 points while ADR is 75 points for past 5 days,then you can anticipate a move for balance of ADR
HAR = HOURLY AR is range of past 20 hours
get hourly high,hourly low and compute average hourly range for past 20 data points
WE CAN KNOW WEEKLY ADRW OR WADR
this is average of adr weekly for 10 weeks.
we can know Monthly ADR ADRM OR MADR

Concept basis
ADR
take a day,find its high and its low
DH -DL = daily range

ADR10
ADR10 finds out what every days range is for past 10 days and averages it to get an average range.
it is day1 range=h1-l1 , day2 range = h2-l2, and so on for 10 days


AHR Average hourly range
This is useful for intraday traders.

ford
I think ATR should serve the purpose.

http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:average_true_range_atr
 
#3
Hi

You got me wrong.
i AM TALKING ABOUT SIMPLE DAY HI AND DAY LO DIFFERENCE.
SIMPLE DIRECT VISIBLE RANGE.
I know about ATR.
iT PICKS HIGHEST OUT OF THREE RANGES AND IT IS DESIGNED WITH ANOTHER IDEA.

CHEERS
 
#4
This should work for Daily, Weekly and Monthly Timeframes

Code:
DailyRange=H-L; // Day's High - Day's Low
DailyRange10=MA(DailyRange,10);
Plot(DailyRange10,"ADR (10) = ", colorRed, styleLine | styleThick);

This can be used for hourly timeframe.

Code:
TimeFrameSet(inHourly);
HourlyRange=H-L; // Hour's High - Low
HourlyRange20=MA(HourlyRange,20);
Plot(HourlyRange20,"ADR (20) = ", colorBlue, styleLine | styleThick); 
TimeFrameRestore();
 
#5
hI FRIEND
THANKS FOR THE CODE.

please note
what i need is a price chart with two horizontal lines at range hi and rangelo

these lines come on price chart.
I am interested in range hi line and rangelo line
when price goes near range hi t can breakout rarely or it can reverse and go down to low of range.

your code cant meet this requirement.
REGARDS
 

HULK

Active Member
#6
hI FRIEND
THANKS FOR THE CODE.

please note
what i need is a price chart with two horizontal lines at range hi and rangelo

these lines come on price chart.
I am interested in range hi line and rangelo line
when price goes near range hi t can breakout rarely or it can reverse and go down to low of range.

your code cant meet this requirement.
REGARDS
FORD,

I THINK THIS IS WHAT YOU ARE LOOKING FOR

_SECTION_BEGIN("Chart Settings");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("Outer panel color ",colorBlack)); // color of outer border
SetChartBkGradientFill( ParamColor("Inner panel color upper half", colorWhite),
ParamColor("Inner panel color lower half", colorWhite)); // color of inner panel
GraphXSpace=Param("GraphXSpace",20,0,100,1);

Plot(C,"C",colorBlack,64);
HiDay = TimeFrameGetPrice("H", inDaily);
LoDay = TimeFrameGetPrice("L", inDaily);
Plot(HiDay ,"",colorGreen,styleDots | styleNoLine);
Plot(LoDay ,"",colorRed,styleDots | styleNoLine);
RangeTitle = EncodeColor(colorBlack) + "Day Range= " + EncodeColor(colorBlack) + StrToNum(NumToStr(round((HiDay - LoDay)), 4.4));
Hodcolorsheme=colorDarkBlue;
LodColorscheme=colorOrange;
Title = EncodeColor(colorDarkBlue)+ "HULK HOD-LOD" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorRed) +
" - " + Date() +" - "+"\n" +EncodeColor(colorBlack) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n" +
EncodeColor(Hodcolorsheme) + "HOD= " + EncodeColor(colorBlack) + Hiday + "\n" +
EncodeColor(LodColorscheme) + "LOD= " + EncodeColor(colorBlack) + Loday + "\n" + RangeTitle;
_SECTION_END();

HULK
 
#7
Dear HULK

thanks. you got it right.
can you fix the below code please

it displays daily and hourly summary at top left
it draws different lines for daily and hrly hi and lows

regards
ford
--------------------------
_SECTION_BEGIN("Chart Settings");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("Outer panel color ",colorPaleGreen)); // color of outer border
SetChartBkGradientFill( ParamColor("Inner panel color upper half", colorWhite),
ParamColor("Inner panel color lower half", colorWhite)); // color of inner panel
GraphXSpace=Param("GraphXSpace",20,0,100,1);

Plot(C,"C",colorBlack,64);
HiDay = TimeFrameGetPrice("H", inDaily);
LoDay = TimeFrameGetPrice("L", inDaily);
Plot(HiDay ,"",colorGreen,styleDots | styleNoLine);
Plot(LoDay ,"",colorRed,styleDots | styleNoLine);


//================================
HiHrly = TimeFrameGetPrice("H", inHourly);
LoHrly = TimeFrameGetPrice("L", inHourly);
//Plot(HiHrly ,"",colorBlue,styleDots | styleNoLine);
//Plot(LoHrly ,"",colorDarkRed,styleDots | styleNoLine);

Plot(HiHrly ,"",colorBlue,styleLine );
Plot(LoHrly ,"",colorDarkRed,styleLine );






//================================
RangeTitle = EncodeColor(colorBlack) + "Day Range= " + EncodeColor(colorBlack) + StrToNum(NumToStr(round((HiDay - LoDay)), 4.4));
Hodcolorsheme=colorDarkBlue;
LodColorscheme=colorOrange;
Title = EncodeColor(colorDarkBlue)+ "HULK HOD-LOD" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorRed) +
" - " + Date() +" - "+"\n" +EncodeColor(colorBlack) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n" +
EncodeColor(Hodcolorsheme) + "HOD= " + EncodeColor(colorBlack) + Hiday + "\n" +
EncodeColor(LodColorscheme) + "LOD= " + EncodeColor(colorBlack) + Loday + "\n" + RangeTitle;
_SECTION_END();


RangeTitle = EncodeColor(colorBlack) + "Hourly Range= " + EncodeColor(colorBlack) + StrToNum(NumToStr(round((Hihrly - Lohrly)), 4.4));

HoHcolorsheme=colorBlue;
LoHColorscheme=colorRed;

EncodeColor(HoHcolorsheme) + "HOH= " + EncodeColor(colorBlack) + HiHrly + "\n" +
EncodeColor(LoHColorscheme) + "LOH= " + EncodeColor(colorBlack) + LoHrly + "\n" + RangeTitle;
_SECTION_END();
 
Last edited:

HULK

Active Member
#8
FORD

chek this out

_SECTION_BEGIN("Chart Settings");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("Outer panel color ",colorBlack)); // color of outer border
SetChartBkGradientFill( ParamColor("Inner panel color upper half", colorWhite),
ParamColor("Inner panel color lower half", colorWhite)); // color of inner panel
GraphXSpace=Param("GraphXSpace",10,0,100,1);

Plot(C,"C",colorBlack,64);

HiDay = TimeFrameGetPrice("H", inDaily);
LoDay = TimeFrameGetPrice("L", inDaily);

Plot(HiDay ,"",colorGreen,styleDots | styleNoLine);
Plot(LoDay ,"",colorRed,styleDots | styleNoLine);

//Intraday Hrl HI LO //

HiHrly = TimeFrameGetPrice("H", inHourly);
LoHrly = TimeFrameGetPrice("L", inHourly);

Plot(HiHrly ,"",colorBlue, styleLine );
Plot(LoHrly ,"",colorDarkRed,styleLine);


//Previous Days HI LO //

DayH = TimeFrameGetPrice("H", inDaily, -1); DayHI = LastValue (DayH,1);// yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1); DayLI = LastValue (DayL,1);// yesterdays low


numbars = LastValue(Cum(Status("barvisible")));
hts = -33.5;

YHL = ParamToggle("Yesterday HI LO","Show|Hide",1);
if(YHL==0) {
Plot(DayL,"YL",colorDarkRed,styleLine|styleNoRescale|styleNoTitle);
Plot(DayH,"YH",colorDarkGreen,styleLine|styleNoRescale|styleNoTitle);
PlotText(" YH " , LastValue(BarIndex())-(numbars/Hts), DayHI, colorDarkRed);
PlotText(" YL " , LastValue(BarIndex())-(numbars/Hts), DayLI, colorDarkGreen);
}


RangeTitle = EncodeColor(colorBlack) + "TODay Range= " + EncodeColor(colorBlack) + StrToNum(NumToStr(round((HiDay - LoDay)), 4.4));
YSDAYRangeTitle = EncodeColor(colorBlack) + "YSDay Range= " + EncodeColor(colorBlack) + StrToNum(NumToStr(round((DayH - DayL)), 5.4));
Hodcolorsheme=colorDarkBlue;
LodColorscheme=colorOrange;
Title = EncodeColor(colorDarkBlue)+ "HULK HOD-LOD" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorRed) +
" - " + Date() +" - "+"\n" +EncodeColor(colorBlack) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n" +
EncodeColor(Hodcolorsheme) + "HiHrly= " + EncodeColor(colorBlack) + HiHrly + "\n" +
EncodeColor(LodColorscheme) + "LowHrly= " + EncodeColor(colorBlack) + LoHrly + "\n" +
EncodeColor(Hodcolorsheme) + "HOD= " + EncodeColor(colorBlack) + Hiday + "\n" +
EncodeColor(LodColorscheme) + "LOD= " + EncodeColor(colorBlack) + Loday + "\n" + RangeTitle +"\n" +
EncodeColor(Hodcolorsheme) + "YsdayHi= " + EncodeColor(colorBlack) + DayH+ "\n" +
EncodeColor(LodColorscheme) + "YsdayLow= " + EncodeColor(colorBlack) + DayL + "\n" + YSDAYRangeTitle;
_SECTION_END();

In above code I added Todya Hi / low + Hourly Hi /low as well as Yesterday Hi/Low also with range.

When u plot chart by default u cans see 4 lines on chart i.e Hrly hi / low lines , Daily hi / low Doted lines

Now if u go to parameter windows you can see option call, Ysday hi low = Hide (by default), if u change to show then you can see a Ysday hi/low lines also on chart


Enjoy :)


HULK
 

HULK

Active Member
#9
Now in case if want weekly high / low change ysday code to

TimeFrameGetPrice( "H", inWeekly, -1 ) // gives you weekly High price weeks ago

TimeFrameGetPrice( "L", inWeekly, -1) // gives you weekly Low price weeks ago

enjoy

HULK
 
#10
dEAR HULK

thank you for the code looks good
I will test and feed you back soon

point1

whenever the range goes on decreasing, just wait -it will expand soon that brings nice trading opportunities.
a limited few traders use price at bottom of range as support.
point2
some people trade only breakouts up or down and avoid trades while the range is holding steady and narrow-this is choppy zone that eats traders funds. these traders call the area between range hi and range low as NTZ -No mans Land-No Trade Zone-or Novice Traders Playground.

some people trade from hi of range to lo of range and from lo to high-subject to the condition that the range has minimum requirement of x units.
one has to find x value by testing. generally they look for x above 25 or some use 50


supposing if thew hourly range of a scrip is 1.25 rupees.ifd the trader is not clever he will begin trading right away.
the clever one thinks,if range itself is 1.25,i cant easily grab more than 30% of range,ie i can make easily just 40 paise on one share-is this worth? no i am not so stupid or dumb- i came long ago from there-he prefers to look for another scrip

for scrip SBIN,
HOURLY RANGE ON A 12 MINUTE CHART IS 5 rupees while daily range is 34 rupees as of 8october.

For CAIRN ENERGY scrip hourly range on 12min chart is 2.1 rupees(is 70 paisa ok for you as profit?are you such a miser in thinking ?) its daily range is
12 rupees.(a guy trading on eod charts can easily try for 4 rupees per share,if he is real smart he can pull out gain of 6 to 9 rupees per share)

trades can bounce back stoploss must -reentry brings money lost also back as trend begins

How can I recognise chop?
and avoid trading then?
when hourly range is less than 5 (or 10)
price is not going anywhere.
do you always like to board a train which is stooped for rest-maintenance and has no guard or driver?
CAUTION
If you are that trader who has no patience to test even 50 trades with a new method,then you are ready to cut your own throat with the new gift knife instead cutting apples.dont do that.
regards
ford
 

Similar threads