- Can't get the right information from copy buffer
- Buy/Sell Pressure Indicator
- Ayuda para obtener datos de indicador para hacer un EA en MT4
Hello people,
Hello Dominik, thanks for your response. Can you point me to any source? Because the implementation doesn't seem so obvious.
Again the representation makes me doubt:
#property indicator_chart_window #property indicator_buffers 4 #property indicator_plots 3 #property indicator_label1 "MAFast" #property indicator_type1 DRAW_LINE #property indicator_color1 clrTomato #property indicator_style1 STYLE_SOLID #property indicator_width1 3 #property indicator_label2 "MASlow" #property indicator_type2 DRAW_LINE #property indicator_color2 clrDodgerBlue #property indicator_style2 STYLE_SOLID #property indicator_width2 5 #property indicator_label3 "Filling" #property indicator_type3 DRAW_FILLING #property indicator_color3 clrYellow; clrIndianRed //double RibFast[], RibSlow[]; input int MASlowper = 40; input int MASlowshft = 0; input ENUM_MA_METHOD MASlowmode = MODE_SMA; input ENUM_APPLIED_PRICE MASlowtype = PRICE_CLOSE; double MASlow[]; input int MAFastper = 10; input int MAFastshft = 0; input ENUM_MA_METHOD MAFastmode = MODE_SMA; input ENUM_APPLIED_PRICE MAFasttype = PRICE_CLOSE; double MAFast[]; int handle_signal, handle_trend; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0, MAFast, INDICATOR_DATA); SetIndexBuffer(1, MASlow, INDICATOR_DATA); SetIndexBuffer(2, MAFast, INDICATOR_DATA); SetIndexBuffer(3, MASlow, INDICATOR_DATA); ArraySetAsSeries(MAFast, true); ArraySetAsSeries(MASlow, true); //ArraySetAsSeries(RibFast, true); //ArraySetAsSeries(RibSlow, true); ArrayInitialize(MAFast, EMPTY_VALUE); ArrayInitialize(MASlow, EMPTY_VALUE); //ArrayInitialize(RibFast, EMPTY_VALUE); //ArrayInitialize(RibSlow, EMPTY_VALUE); PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, EMPTY_VALUE); PlotIndexSetDouble(1, PLOT_EMPTY_VALUE, EMPTY_VALUE); PlotIndexSetDouble(2, PLOT_EMPTY_VALUE, EMPTY_VALUE); PlotIndexSetDouble(3, PLOT_EMPTY_VALUE, EMPTY_VALUE); handle_signal = iMA(_Symbol, _Period, MAFastper, MAFastshft, MAFastmode, MAFasttype); handle_trend = iMA(_Symbol, _Period, MASlowper, MASlowshft, MASlowmode, MASlowtype); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| 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[]) { //--- int hhb1 = 0, llb1 = 0, hhb2 = 0, llb2 = 0, count = 0, start = 0; int limit = (prev_calculated == rates_total) ? (prev_calculated - 1) : (prev_calculated - rates_total); int to_copy = (prev_calculated == rates_total) ? 1 : (rates_total); ArraySetAsSeries(high, true); ArraySetAsSeries(low, true); CopyBuffer(handle_signal, 0, 0, to_copy, MAFast); CopyBuffer(handle_trend, 0, 0, to_copy, MASlow); /* for(int i=0;i<to_copy;i++) { RibFast[i]=MAFast[i]; RibSlow[i]=MASlow[i]; } */ //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+
Chart looks okay at first:
But then in Debugger only the filling showed and not the 2 lines:
And after that the drawing had changed:
It shows only one line now. I am wondering if it is not plotting right because the rest looks okay. But this is not the problem that I opened this thread for.
Edit: It went back to normal later.
Hello Dominik, thanks for your response. Can you point me to any source? Because the implementation doesn't seem so obvious.
Again the representation makes me doubt:
Chart looks okay at first:
But then in Debugger only the filling showed and not the 2 lines:
And after that the drawing had changed:
It shows only one line now. I am wondering if it is not plotting right because the rest looks okay. But this is not the problem that I opened this thread for.
Edit: It went back to normal later.
Okay thanks.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use