Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Could be your indicator is not loading at all.
int handle; int OnInit() { OnIntIND(_Symbol, handle,PERIOD_M5); if(handle==INVALID_HANDLE) { Print("Error loading indicator!"); return INIT_FAILED; } EventSetTimer(20); return(INIT_SUCCEEDED); }
Your code flow is not logical. As you replace myBuff again and again...
int OnInit() { OnIntIND(_Symbol, handle,PERIOD_M5); EventSetTimer(20); return(INIT_SUCCEEDED); }20 seconds is too much to update.
Thanks for the reply, but what I'm looking for is the value of the buy sell arrows baffer, not the value of the RSI
SergioTForex #: Thanks for the reply, but what I'm looking for is the value of the buy sell arrows baffer, not the value of the RSI
As declared in the Indicator code,the arrows are in buffer 0 (buy/long) and buffer 1 (sell/short).
//--- plot Arrow to up #property indicator_label1 "Long signal" #property indicator_type1 DRAW_ARROW #property indicator_color1 clrBlue #property indicator_style1 STYLE_SOLID #property indicator_width1 1 //--- plot Arrow to down #property indicator_label2 "Short signal" #property indicator_type2 DRAW_ARROW #property indicator_color2 clrRed #property indicator_style2 STYLE_SOLID #property indicator_width2 1
When no "arrow" is displayed, then the buffer's value will be EMPTY_VALUE
EMPTY_VALUE
Empty value in an indicator buffer
DBL_MAX
int handle; int OnInit() { OnIntIND(_Symbol, handle,PERIOD_M5); return(INIT_SUCCEEDED); } void OnTick() { double Rsi; IND( Rsi); Comment(TimeCurrent(),"\n"," RsiConv ",Rsi); } void OnIntIND(string sy, int& handleRsi,ENUM_TIMEFRAMES TF) { uint InpPeriod = 14; // Period ENUM_APPLIED_PRICE InpAppliedPrice = PRICE_CLOSE; // Applied price double InpOverbought = 60; // Overbought double InpOversold = 40; // Oversold color InpColorBullish = clrBlue; // Bullish color color InpColorBearish = clrRed; // Bearish color handleRsi=iCustom(sy,TF,"RSI_Divergence.ex5",InpPeriod,InpAppliedPrice,InpOverbought,InpColorBullish,InpColorBearish);//CopyBuffer(InDicDef1,1,0,2,InDicArray1) cambia colore } void IND(double& Rsi) { double myBaff[]; uchar shift=0; ArraySetAsSeries(myBaff,true); CopyBuffer(handle,0,shift,shift+1,myBaff);//baff 0=EMPTY_VALUE baff 1= =EMPTY_VALUE baff 2= =EMPTY_VALUE blu baff 5>> 1 buy>>> 2 sell if(myBaff[0]!=EMPTY_VALUE)Print("ARROW BUY*************** ",myBaff[0]); ArraySetAsSeries(myBaff,true); CopyBuffer(handle,1,shift,shift+1,myBaff);//baff 0=EMPTY_VALUE baff 1= =EMPTY_VALUE baff 2= =EMPTY_VALUE blu baff 5>> 1 buy>>> 2 sell if(myBaff[0]!=EMPTY_VALUE)Print("ARROW SELL*************** ",myBaff[0]); Rsi= myBaff[0]; }
I further clean up the EA code.
The problem is that the value of buffer 0 and buffer 1 is always empty value
The values of buffer zero and one can be non empty only if you see an arrow in the current bar of indicator. This is a rare thing and you won't see that unless you spend quite a lot of time watching your screen.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I'm trying to have buffers printed in an EA to signal when a sell or buy arrow is created but they always return emptyvalues from the RSI divergence indicator.
Below is the code EA and indicator