Please edit your post and
use the code button (Alt+S) when pasting code
Jesus Victor Lerga Bezunartea: i cannot to get data for my indicator handle with period daily (Copied data is -1).
RatesTotal is the number of bars of the current timeframe chart. You don't have that many on the D1 chart.
William Roeder:
RatesTotal is the number of bars of the current timeframe chart. You don't have that many on the D1 chart.
Yes, i know.
I've tried also with other number in "count" parameter , based in Bars function or fixed number (i.e 2, 1...)
But in any case copied =-1
int barras= Bars(NULL,PERIOD_D1); int barrasM= Bars(NULL,PERIOD_CURRENT);
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 have a problem to obtain data buffers using iCustom function
My indicator use another iCustom indicator in 2 different timeframes:
- first iCustom in the PERIOD_CURRENT,
- second in period daily.
I dont have problem to obtain indicator handle, but when i try to obtain buffer into OnCaculate(), using CopyBuffer, i cannot to get data for my indicator handle with period daily (Copied data is -1).
Below you can see my code.
Somebody can help me to solve my problem.?
Note: this problem doesn't happend when i use the indicator in other EA. In this case, it is possible to compare Bars of the different indicators/TimeFrames, in order to get appropriate data.
OnInit() { /*................*/ if((indReg =iCustom(NULL,PERIOD_CURRENT,"REGRES.ex5", nBar))==INVALID_HANDLE)) { printf("Error creating ICUSTOM-REGRES indicator"); return(false); } if((indRegDay =iCustom(NULL,PERIOD_D1,"REGRES.ex5", 5)) { printf("Error creating ICUSTOM-REG-DAY indicator"); return(false); } /*******..........................*********/ } 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[]) { Copied= CopyBuffer(indReg,0,0,rates_total,BReg); Copied= CopyBuffer(indRegDay,0,0,rates_total,BRegDay); /*************...............................*******************/ }