How do I access the latest 500 values?
paulgriffiths: If I access the buffer from my EA with iCustom how can I access the series order correctly?
|
|
|
Thanks with the copyBuffer. How do I know it' size when it comes to reading it? The link you suggested for copyBuffer is from indicator to indicator, an EA has no rates_total or prev_calculated.
The example shown is:
MA_handle=iCustom(NULL,0,"Examples\\Custom Moving Average",
MA_Period,
MA_Shift,
MA_Method,
PRICE_CLOSE // using the close prices
);
Print("MA_handle = ",MA_handle," error = ",GetLastError());
...
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[])
{
//--- Copy the values of the indicator Custom Moving Average to our indicator buffer
int copy=CopyBuffer(MA_handle,0,0,rates_total,Label1Buffer);
Print("copy = ",copy," rates_total = ",rates_total);
//--- If our attempt has failed - Report this
if(copy<=0)
Print("An attempt to get the values if Custom Moving Average has failed");
//--- return value of prev_calculated for next call
return(rates_total);
}
I have in my indicator:
This is the buffer I wish to copy into my EA.
Thanks with the copyBuffer. How do I know it' size when it comes to reading it? The link you suggested for copyBuffer is from indicator to indicator, an EA has no rates_total or prev_calculated.
The example shown is:
MA_handle=iCustom(NULL,0,"Examples\\Custom Moving Average",
MA_Period,
MA_Shift,
MA_Method,
PRICE_CLOSE // using the close prices
);
Print("MA_handle = ",MA_handle," error = ",GetLastError());
...
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[])
{
//--- Copy the values of the indicator Custom Moving Average to our indicator buffer
int copy=CopyBuffer(MA_handle,0,0,rates_total,Label1Buffer);
Print("copy = ",copy," rates_total = ",rates_total);
//--- If our attempt has failed - Report this
if(copy<=0)
Print("An attempt to get the values if Custom Moving Average has failed");
//--- return value of prev_calculated for next call
return(rates_total);
}
I have in my indicator:
This is the buffer I wish to copy into my EA.
Why do you want to copy ALL data of a buffer in an EA ? Copy just what you need :
Why do you want to copy ALL data of a buffer in an EA ? Copy just what you need :
I see, 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
In my indicator I'm using ArraySetAsSeries(Buffer,true); for series access.
If I access the buffer from my EA with iCustom how can I access the series order correctly?
Thanks.