#property indicator_separate_window #property indicator_buffers 6 #property indicator_color1 Yellow int ExtCountedBars=0; double smaseries[]; double diffCo[]; double haOpen[]; double haClose[]; double haHigh[]; double haLow[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { SetIndexStyle(0, DRAW_LINE); SetIndexDrawBegin(0,0); SetIndexBuffer(0, smaseries); SetIndexBuffer(1, diffCo); SetIndexBuffer(2, haOpen); SetIndexBuffer(3, haClose); SetIndexBuffer(4, haHigh); SetIndexBuffer(5, haLow); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start(){ string basename = "HaDiffCOIndicatorSample"; IndicatorShortName(basename); int window = WindowFind(basename); int limit; int counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); //---- the last calculated bar will be recalculated if(counted_bars > 0) counted_bars--; limit = Bars - counted_bars - 1; //limit = Bars - counted_bars; Print("Bars " + Bars + " counted_bars" + counted_bars + " Limit " + limit); bool IsBuy, IsSell, IsBuyCover, IsSellCover,IsTradable = true; bool long,short = false; for (int i = limit; i >= 0; i--) { haOpen[i]=(haOpen[i+1]+haClose[i+1])/2; haClose[i]=(Open[i]+High[i]+Low[i]+Close[i])/4; haHigh[i]=MathMax(haOpen[i],High[i]); haLow[i]=MathMin(haOpen[i],Low[i]); diffCo[i]=(haClose[i] - haOpen[i])*1000; smaseries[i]=(diffCo[i]+diffCo[i+1])/2; //Print("Date Time " + TimeToStr(Time[i]) + "diffCo " + i + " Value " + diffCo[i] + "smaseries " + i + " Value " + smaseries[i]); string name1 = "haDiffCo"+i; if(ObjectFind(name1) != -1) ObjectDelete(name1); ObjectCreate(name1, OBJ_TREND, window, Time[i], 0,Time[i], diffCo[i]); ObjectSet(name1, OBJPROP_STYLE, STYLE_SOLID); ObjectSet(name1, OBJPROP_RAY, 0); ObjectSet(name1, OBJPROP_WIDTH, 3); if (diffCo[i] >0){ ObjectSet(name1, OBJPROP_COLOR, Chartreuse); }else{ ObjectSet(name1, OBJPROP_COLOR, Red); } } return(0); }
Hello Friends
I am able to create a indicator which draws a osciallator which moves above and below zero. The oscillator is drawn when the indicator is attached to a chart for a time period.
Trend is up if above zero and Trend is down below zero.
What i want is the value of this indicator for different time period.
I get this indicator drawn in a subwindow see below
Now the below chart is drawn for PERIOD H4 now how can i get the indicator values for different periods in my main chart? IS IT POSSIBLE.
adler2:
It is possible, what you will need to do is use Timeseries access.Ie don't use High or Low use iHigh and iLow instead there you can specify the currency and the time period.
Hope this helps
Hazem
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello Friends
I am able to create a indicator which draws a osciallator which moves above and below zero. The oscillator is drawn when the indicator is attached to a chart for a time period.
Trend is up if above zero and Trend is down below zero.
What i want is the value of this indicator for different time period.
I get this indicator drawn in a subwindow see below
Now the below chart is drawn for PERIOD H4 now how can i get the indicator values for different periods in my main chart? IS IT POSSIBLE.