code to access the indicator buffer - help me please
-
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
Messages Editor - dam mro: I want to add a pointer to an EANo such thing. You read the buffer(s) with iCustom.
Your indicator only has two parameters, not three. It has only one buffer (buf had better be zero.)// extern double Gamma = 0.85; extern int Price = 0; double lag[];
res = iCustom (NULL, 0, "LaGuerre", MODE_SMA, Price, Gamma, buf, pos);
Detailed explanation of iCustom - MQL4 programming forum #33 2017.05.23
Please only post in English on the forum.
I have edited your post and used the site's translation tool this time.
You will say that you will learn but
-
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
Messages Editor
you have not edited your first post.
Hello and sorry for my english. I want to add a pointer to an EA and I need to add code to access the pointer buffer. I include the indicator below
//+------------------------------------------------------------------
//|
//+------------------------------------------------------------------
#property copyright "mladen"
#property link "www.forex-tsd.com"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 PaleVioletRed
#property indicator_width1 2
//
extern double Gamma = 0.85;
extern int Price = 0;
//
double lag[];
//+------------------------------------------------------------------
//|
//+------------------------------------------------------------------
//
int init()
{
SetIndexBuffer(0,lag);
string shortName = "LaguerreMA";
IndicatorShortName (shortName);
return(0);
}
int deinit() { return(0); }
//+------------------------------------------------------------------
//|
//+------------------------------------------------------------------
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars - counted_bars,Bars-1);
//
for(int i = limit; i >= 0 ; i--) lag[i] = LaGuerre(iMA(NULL,0,1,0,MODE_SMA,Price,i),Gamma,i,0);
return(0);
}
//+------------------------------------------------------------------
//|
//+------------------------------------------------------------------
//
double workLag[][4];
double LaGuerre(double price, double gamma, int i, int instanceNo=0)
{
if (ArrayRange(workLag,0)!=Bars) ArrayResize(workLag,Bars); i=Bars-i-1; instanceNo*=4;
//
workLag[i][instanceNo+0] = (1.0 - gamma)*price + gamma*workLag[i-1][instanceNo+0];
workLag[i][instanceNo+1] = -gamma*workLag[i][instanceNo+0] + workLag[i-1][instanceNo+0] + gamma*workLag[i-1][instanceNo+1];
workLag[i][instanceNo+2] = -gamma*workLag[i][instanceNo+1] + workLag[i-1][instanceNo+1] + gamma*workLag[i-1][instanceNo+2];
workLag[i][instanceNo+3] = -gamma*workLag[i][instanceNo+2] + workLag[i-1][instanceNo+2] + gamma*workLag[i-1][instanceNo+3];
//
return((workLag[i][instanceNo+0]+2.0*workLag[i][instanceNo+1]+2.0*workLag[i][instanceNo+2]+workLag[i][instanceNo+3])/6.0);
}
Please let me know where to look for this information in this code? I added such a path but EA does not read the data and the results are 0
res = iCustom (NULL, 0, "LaGuerre", MODE_SMA, Price, Gamma, buf, pos);
Where can I learn how to read the path to the buffer code in pointers?
I am grateful for any help.