log in     sign up for free
 
To be a money master, you must first be a self-master.
J. P. Morgan
 
 
Home
systems (285)
 
 
Special offer: buy MetaStock (try for free)   |   Reuters QuoteCenter Real-Time Data (get a free month)   |   EOD Data
Formula Library
 
AmiBroker
MetaTrader
MetaStock
TradeStation
Wealth-Lab
NinjaTrader
 
add your formula
System Library
 
 
Account login
Your email:
Password:
 
Log in
New to s4t? Sign up.
If you forgot your password click here.
Search the Web
 
Custom Search

Avg Daily Range

Formula for: MetaTrader

mql4 indicator

 

 

Views:  2705

Added: February 04, 2007
 
Rate this code:  Rate: 1 Rate: 2 Rate: 3 Rate: 4 Rate: 5
This formula has not been rated yet
 

email this link

 
 
Tags: MetaTrader, mql4 indicator
 




Code:

//+------------------------------------------------------------------+
//| Avg Daily Range.mq4 |
//| Copyright © 2005, tageiger aka fxid10t@yahoo.com |
//| http://www.metatrader.org |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, tageiger aka fxid10t@yahoo.com"
#property link "http://www.metatrader.org"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 SpringGreen
#property indicator_color3 Tomato
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];

double rng,sum.rng,avg.rng;

int init() {
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,ExtMapBuffer3);
//----
return(0);}

int deinit() {return(0);}

int start() {
int counted_bars=IndicatorCounted();
rng=0;sum.rng=0;avg.rng=0;

for(int i=0;i<Bars;i++) {
rng=(iHigh(Symbol(),Period(),i)-iLow(Symbol(),Period(),i));
sum.rng+=rng;
}

int db=iBars(Symbol(),Period());
avg.rng=sum.rng/db;

// for(int t=0;t<db;t++) {
for(int s=0;s<Bars;s++) {

ExtMapBuffer2[s]=(iOpen(Symbol(),Period(),s)+(avg.rng/2));
ExtMapBuffer3[s]=(iOpen(Symbol(),Period(),s)-(avg.rng/2));
}// }
Comment("Last Tick: ",TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS),"n",
"Sum of Period Ranges:",sum.rng,"n",
"Average Range:",avg.rng,"n",
"Total Bars:",i+1);


return(0);}
//+------------------------------------------------------------------+


 





Code to difficult? Find somebody to help you with coding here.

 



Author: tageiger aka fxid10t (at) yahoo.com
Source: http://www.forex-tsd.com

 

View similar (mql4 indicator for MetaTrader):

Super-Signals
5dayBreakout
3 Line Break
Inside or Outside Bars
DS_Stochastic
ATR Levels
ATR
5_34_5
ATR Channels
ATR Ratio
...
 
 
all formulas for MetaTrader
all formulas

 

 

Email to friend

Top

 

     
However we try to maintain hiqhest possible level of service - most formulas, oscillators, indicators
and systems are submitted by anonymous users.
Therefore S4T™ does not take any responsibility for it's quality.
If you use any of this information, use it at your own risk. You are responsible for your own trading decisions.
Be sure to verify that any information you see on these pages is correct, and is applicable to your particular trade.
In no case will S4T™ be responsible for your trading gains or losses.
PayPalSecure payments by PayPal S4T™ is a part of TAURO EDUCATION NETWORK
 
Privacy note | (c) copyrights systems4trading.com 2006-2009