Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1353

 
Vladimir Karputov:

Reference:CopyRates

When requesting data from indicator, if requested timeseries haven't been built or should be uploaded from server, function will return -1 at once, but loading/construction process will be initiated

Thanks, that solved it, took only the really necessary data and the error cascade disappeared at once, and there were memory leaks and crashes ))

 
BillionerClub:

Thank you, it solved the problem, I took only the really needed data and the error cascade disappeared at once, and there were memory leaks and crashes))

But the question remains: "Why use CopyRates for the current symbol and timeframe in the INDICATOR, if the indicator already supplies arrays of OHLC in OnCalculate"?

 
Vladimir Karputov:

But the question remains: "Why use CopyRates for the current symbol and timeframe in the INDICATOR, if the indicator already provides arrays of OHLC in OnCalculate"?

In OnCalculate" there is OHLC, but there may be no bar, when it may lead to array exit, in any case you should use Ibarshift with parameter true.

 
BillionerClub:

OnCalculate" contains OHLC, but there may not be any bar, as it may cause an array exit, in any case you must use Ibarshift with parameter true.

No. OnCalculate contains all OHLC for the current symbol and current timeframe. But if you like to shoot both legs of horse at full tilt, then yes, you can use CopyXXXX function in the OTC symbol and timeframe INDICATOR.

 
Vladimir Karputov:

...at full gallop to shoot both legs of a horse...

I wonder what kind of horse is it that rides on two legs?

Or do you mean both right legs, or both hind legs?

 
Vladimir Karputov:

No. OnCalculate contains all OHLC by current symbol and current timeframe. But if you like to shoot both legs of the horse at full gallop - then yes, you can use CopyXXXX function in the current symbol and timeframe INDICATOR.

I didn't explain it well, I apologise. Thanks for the replies. Checked you're right, the bar just got lost, suddenly popped out where I wasn't expecting. But I have a problem, like loading data from another terminal, which may not match and for lack or presence in both terminals. I couldn't find a better solution than barhift.


 

Hello! ... it's been a while since I've been here)

Why does the function

PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,begin);

has no effect on getting

handle = iCustom(_Symbol,PERIOD_CURRENT,"Market indices");
if(handle != INVALID_HANDLE)
   {
    Alert("RT - ",rates_total);
    Alert("BC - ",BarsCalculated(handle));
   };


The problem is that RT and BC are the same.


That is, is there any way to know from the handle whichPLOT_DRAW_BEGIN the indicator has?

... I plan to make requests through iCustom for some variables with different periods and it is important to know on what bar all requested variables are calculated

 
Why is it so fast, isn't it expensive to search an array?
iBarShift
 
BillionerClub:
Why is it so fast, isn't it expensive to search an array?
Most likely the search is not done with a loop, but with simple mathematics
 

Hello, I have a problem.

I have hieroglyphs instead of Russian letters.I tried changing the regional settings, but it didn't help. Do you know any working methods?

Reason: