- Errors, bugs, questions
- set time frame when attach script or EA or indicator
- indicators and backtest
SetIndexStyle(0, DRAW_HISTOGRAM); SetIndexStyle(1, DRAW_ARROW); SetIndexArrow(1, 251);The value of ExtNesbatBuffer is so small that it looks like a dotted line on the screen.
The value of ExtNesbatBuffer is so small that it looks like a dotted line on the screen.
thanks, its ok, but now i test the program in tester it work but it dont work in demo acount , why?
thanks, its ok, but now i test the program in tester it work but it dont work in demo acount , why?
I don't know. I have confirmed that it works fine on my real account.
p.s.
You should add the following, because you may get an "array out of range" error.
if(prev_calculated == 0) limit = rates_total - 2;
Why are you using 'iOpen', 'iClose' ...? After all, you ALREADY have this data - OnCalculate gives you all this data.
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[])
I don't know. I have confirmed that it works fine on my real account.
p.s.
You should add the following, because you may get an "array out of range" error.
Code:
//+------------------------------------------------------------------+ //| Indicator 1.mq5 | //| Copyright © 2021, Vladimir Karputov | //+------------------------------------------------------------------+ #property copyright "Copyright © 2021, Vladimir Karputov" #property version "1.000" #property indicator_separate_window #property indicator_buffers 2 #property indicator_plots 2 //#property indicator_minimum -0.2 //#property indicator_maximum 0.2 //--- plot Nesbat #property indicator_label1 "Nesbat" #property indicator_type1 DRAW_HISTOGRAM #property indicator_color1 clrSilver #property indicator_style1 STYLE_SOLID #property indicator_width1 1 //--- plot Tanasob #property indicator_label2 "Tanasob" #property indicator_type2 DRAW_ARROW #property indicator_color2 clrRed #property indicator_style2 STYLE_SOLID #property indicator_width2 1 //--- input parameters input int Input1=9; //--- indicator buffers double NesbatBuffer[]; double TanasobBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,NesbatBuffer,INDICATOR_DATA); SetIndexBuffer(1,TanasobBuffer,INDICATOR_DATA); //--- define the symbol code for drawing in PLOT_ARROW PlotIndexSetInteger(1,PLOT_ARROW,159); //--- set the vertical shift of arrows in pixels PlotIndexSetInteger(1,PLOT_ARROW_SHIFT,5); //--- set as an empty value 0 PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,EMPTY_VALUE); //--- 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[]) { if(rates_total<10) return(0); //--- int limit=prev_calculated-1; if(prev_calculated==0) { NesbatBuffer[0]=0.0; TanasobBuffer[0]=EMPTY_VALUE; limit=1; } for(int i=limit; i<rates_total; i++) { NesbatBuffer[i]=0.0; TanasobBuffer[i]=EMPTY_VALUE; if(tick_volume[i]-tick_volume[i-1]!=0.0) { //--- historgamm double fabs_temp=MathAbs(close[i]-open[i])/(tick_volume[i]-tick_volume[i-1]); if(fabs_temp>0.2) NesbatBuffer[i]=0.2; else if(fabs_temp<-0.2) NesbatBuffer[i]=-0.2; //--- arrow double tick_temp=(tick_volume[i]/tick_volume[i-1]-1.0)/3.0; if(tick_temp>0.2) TanasobBuffer[i]=0.2; else if(tick_temp<-0.2) TanasobBuffer[i]=-0.2; } } //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+
I don't know. I have confirmed that it works fine on my real account.
p.s.
You should add the following, because you may get an "array out of range" error.
Code:
thanks but it didnt work
it seems rate_total don't increase in after run candles
What does that mean?
thanks but it didnt work
What do you mean "it doesn't work"? Please describe the exact problem.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use