//+------------------------------------------------------------------+
//| CurrentATR.mq5 |
//| rnd |
//| |
//+------------------------------------------------------------------+
#property copyright "rnd"
#property link ""
#property version "1.00"
#property indicator_chart_window
//--- input parameters
input int number=20,x=20,y=50;
input color inputcolor=WhiteSmoke;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int a=5;
double High[];
double iHigh(string symbol,ENUM_TIMEFRAMES timeframe,int index)
{
double high=0;
ArraySetAsSeries(High,true);
int copied=CopyHigh(symbol,timeframe,0,Bars(symbol,timeframe),High);
if(copied>0 && index<copied) high=High[index];
return(high);
}
void CreateLabel(long chart_id,
string name,
int chart_corner,
string text_label,
int x_ord,
int y_ord)
{
//---
ObjectCreate(chart_id,name,OBJ_LABEL,0,0,0);
ResetLastError();
if(!ObjectSetInteger(chart_id,name,OBJPROP_CORNER,chart_corner))
Print("Unable to set the angle to bind the object",
name,", error code ",GetLastError());
ObjectSetInteger(chart_id,name,OBJPROP_XDISTANCE,x);
ObjectSetInteger(chart_id,name,OBJPROP_YDISTANCE,y);
ObjectSetInteger(0,name,OBJPROP_COLOR,inputcolor);
double atrstring = iATR(Symbol(), PERIOD_CURRENT , number);
double oscstring = iMACD(Symbol(),ChartPeriod(),13,34,20,PRICE_CLOSE);
Alert(High[0] + " "+ High[1]);
ObjectSetString(chart_id,name,OBJPROP_TEXT, "Current ATR : " + " "+ DoubleToString(atrstring) + DoubleToString(oscstring));
}
int OnInit()
{
//--- indicator buffers mapping
//---
{
//---
int height=ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS,0);
int width=ChartGetInteger(0,CHART_WIDTH_IN_PIXELS,0);
string arrows[4]={"LEFT_UPPER","RIGHT_UPPER","RIGHT_LOWER","LEFT_LOWER"};
CreateLabel(0,arrows[0],CORNER_LEFT_UPPER,"0",50,50);
}
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime& time[],
const double& open[],
const double& high[],
const double& low[],
const double& close[],
const long& tick_volume[],
const long& volume[],
const int& spread[])
{
a=a+1;
int height=ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS,0);
int width=ChartGetInteger(0,CHART_WIDTH_IN_PIXELS,0);
string arrows[4]={"LEFT_UPPER","RIGHT_UPPER","RIGHT_LOWER","LEFT_LOWER"};
CreateLabel(0,arrows[0],CORNER_LEFT_UPPER,"0",50,50);
ChartRedraw();
//---
//--- return value of prev_calculated for next call
return(rates_total);
}
//+-------------------------------
here is the ful code btw
its a bit messy but its not finished and i need High[x] to work
- 2009.11.23
- Андрей
- www.mql5.com
- 2010.02.25
- MetaQuotes Software Corp.
- www.mql5.com
You can try this, good luck.
double iHigh(string symbol,ENUM_TIMEFRAMES timeframe,int index) { if(index>-1) { double high[]; if(CopyHigh(symbol,timeframe,index,1,high)>0) return(high[0]); } return(-1); }

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
double High[];
double iHigh(string symbol,ENUM_TIMEFRAMES timeframe,int index)
{
double high=0;
ArraySetAsSeries(High,true);
int copied=CopyHigh(symbol,timeframe,0,Bars(symbol,timeframe),High);
if(copied>0 && index<copied) high=High[index];
return(high);
}
This doesnt work
It crashes my MT5
Why are the old iHigh functions removed anyway
Doesnt make sense at all