Simple ADTR indicator

 

Hi all,

Thought I would make a simple contribution here for newbies.

This is a simple average daily trading range pip indicator (mq4 attached) that displays todays pips so far and the last X days average total of pips moved. X being definable by the user.

It's nothing spectacular but I thought new people trying to learn to code would find it maybe of use to mess around with.

BTW my ADTR goes from highest to lowest and not just the candle body. I use the wicks too.

Maxvre

---------------------------------------------------------------------

#property indicator_chart_window

extern int X.Offset=0;

extern int Y.Offset=0;

extern int DAYS = 20;

extern int Font_Size = 10;

extern color TODAY_Title_Color = DeepSkyBlue;

extern color ADTR_Title_Color = DeepSkyBlue;

extern color TODAY_Value_Color = White;

extern color ADTR_Value_Color = White;

double ATR_Day_0;

double ATR_Total;

string ATR_String;

double PIP;

double MPP_Double;

string MPP_Total;

string prefix = "ADTR_Example_";

string name;

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

//---- indicators

//----

Sleep(1000);

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//----

//----

Sleep(1000);

return(0);

}

//+------------------------------------------------------------------+

//| Custom indicator iteration function |

//+------------------------------------------------------------------+

int start()

{

//--------------------------------------------------------------------

// TODAYS PIP TRADING RANGE AND AVERAGE PIP TRADING RANGE FOR LAST MONTH (19 WORKING DAYS)

ATR_Day_0=(iHigh(Symbol(),1440,0) - iLow(Symbol(),1440,0));

ATR_Total=0;

int i;

PIP=MarketInfo(Symbol(), MODE_TICKVALUE);

for (i=1;i<DAYS;i++)

{

ATR_Total=ATR_Total+(iHigh(Symbol(),1440,i) - iLow(Symbol(),1440,i));

}

ATR_Total = ATR_Total/(DAYS-1);

ATR_String=DoubleToStr(ATR_Total/Point,0);

MPP_Double=StrToDouble(ATR_String);

MPP_Double=MPP_Double*PIP;

MPP_Total=DoubleToStr(MPP_Double,0);

name = prefix +"Todays_Pips_Title";

ObjectCreate(name, OBJ_LABEL, 0, 0, 0);

ObjectSetText(name,"Today",Font_Size, "Arial Bold", TODAY_Title_Color);

ObjectSet(name, OBJPROP_CORNER, 0);

ObjectSet(name, OBJPROP_XDISTANCE, 0+X.Offset);

ObjectSet(name, OBJPROP_YDISTANCE, 0+Y.Offset);

name = prefix +"Todays_Pips_Value";

ObjectCreate(name, OBJ_LABEL, 0, 0, 0);

ObjectSetText(name,DoubleToStr(ATR_Day_0/Point,0)+" Pips",Font_Size, "Arial Bold", TODAY_Value_Color);

ObjectSet(name, OBJPROP_CORNER, 0);

ObjectSet(name, OBJPROP_XDISTANCE, 55+X.Offset);

ObjectSet(name, OBJPROP_YDISTANCE, 0+Y.Offset);

//------------------------------------------------------------------------------------------------

//THE AVERAGE TRADING RANGE FOR ALL 19 DAYS

name = prefix +"ATDR_Title";

ObjectCreate(name, OBJ_LABEL, 0, 0, 0);

ObjectSetText(name,"ADTR",Font_Size, "Arial Bold", ADTR_Title_Color);

ObjectSet(name, OBJPROP_CORNER, 0);

ObjectSet(name, OBJPROP_XDISTANCE, 150+X.Offset);

ObjectSet(name, OBJPROP_YDISTANCE, 0+Y.Offset);

name = prefix +"ADTR_Value";

ObjectCreate(name, OBJ_LABEL, 0, 0, 0);

ObjectSetText(name,DoubleToStr(ATR_Total/Point,0)+" Pips",Font_Size, "Arial Bold", ADTR_Value_Color);

ObjectSet(name, OBJPROP_CORNER, 0);

ObjectSet(name, OBJPROP_XDISTANCE, 200+X.Offset);

ObjectSet(name, OBJPROP_YDISTANCE, 0+Y.Offset);

//-----------------------------------------------------------------------------------------------

Sleep(1000);

return(0);

}

//+------------------------------------------------------------------+

Files:
 

ADTR example

does somebody tried already to do ATR (or Range) of (by) sessions?

don't know, ES, see, ATR somewhat deceiving thing

Files:
adtr.gif  24 kb
 

I do not know how to communicate what I need. I am going to try.

It is not enough to just identify pip range as an average. Because it does not identify trend power. It could be a choppy environment and a high value may not help a trader in a decision he is using the indication for.

I need to find a deviation of direction and assign a range to that...

Do not ask me to explain...because I cannot.

Does anybody know what I mean?...cause' I sure the hell do not...

I think its called ADR....Average Directional Range?

ES

 
fxbs:
ADTR example

does somebody tried already to do ATR (or Range) of (by) sessions?

don't know, ES, see, ATR somewhat deceiving thing

You mean something like this?

 

Pip Power Indicator?

Is it possible to measure the movement of pips per candle for the day?

In other words, on a 5m chart you would have 288 candles for the day.

So, the question is can the movement of pips(positive or negative) be measured ?

for example the range would be 280 pips/day but Pip Power would be 1000-1200 pips for the day. Is this possible?

I think the range is a good indicator for volatility, but this suggestion above would greatly enhance ability to gauge volatily of any pair.

 

That's the ticket...thats what I want... It was all a blur...

BLUR71:
Is it possible to measure the movement of pips per candle for the day?

In other words, on a 5m chart you would have 288 candles for the day.

So, the question is can the movement of pips(positive or negative) be measured ?

for example the range would be 280 pips/day but Pip Power would be 1000-1200 pips for the day. Is this possible?

I think the range is a good indicator for volatility, but this suggestion above would greatly enhance ability to gauge volatily of any pair.
 

I've been looking for an indicator like that for the longest while...

Until now I thought I was the only one with this concept

I guess great minds think alike

Now..., if I only knew how to write the code...

 

w/o volumes would be like Absolute Strength set to 1:

Files:
as_dhs.gif  21 kb
 

could work; more like hourly - sessions....

may be some kind of like that?

that's how Wa did

https://www.mql5.com/en/forum/177438/page2

if (iClose(Symbol(),DataFromTF,i)>iClose(Symbol(),DataFromTF,i+1))

{

P1 = P1+(iVolume(Symbol(),DataFromTF,i));

just take volume off ....

his indi a bit heavy - but works just fine

i modifyed original a bit - put user defined TFDatafeed

Files:
 

Pip Power Indicator?

Hi fxbs,

those indi are nice, but not exactly what I was hoping for..

Do you think its possible to measure the movement of the pips as stated above? In a numeric display like average daily range?

For example:

1st candle moved market price down 7 pips,

next candle down 12 pips,

next candle down 5 pips,

next candle up 20 pips

that would make total (Pip Power) movement be 44 pips over four candles.

So you would add all movement together, negative or positive , in a total movement index.

I hope that explanation is clear

 

sorry, Blur, i'm not a progammer, but i believe programmers can do it

something could be here:

MaxRange.mq4 |

//| Gives the maximim and minimum values for given number of bars. |

//| You can set a limit value so that if the (absolute) value is |

//| below this limit then histogram bars are red, otherwise green. |

//| |

//| GreenLimit: Limit for green bars in histogram |

//| NumbOfBars: Number of bars starding from the current bar and |

//| including the current bar. |

//| OnlyMax: If true, then only maximimum value for the current |

//| bar is shown. |

//| OnlyMin: If true, then only minimum value for the current |

//| bar is shown.

MaxRange - MQL4 Code Base