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

 
CopyBuffer not found in mt4, only in mt5 Not in mt4? is there a simple buffer array numbers to get data in mt4?
 
Valeriy Yastremskiy:
CopyBuffer not found in mt4, only in mt5 No in mt4?

no

in MT4 it is iCustom()https://docs.mql4.com/ru/indicators/icustom

I checked it last year, iCustom() call from EA is cacheable, i.e. if you calliCustom() several times from EAfor different buffers or indexes on the same tick, the indicator itself will be recalculated once for this tick, i.e. there is nothing wrong with performance

ZS: why MT4 - if MT5 has already been "figured out", the productivity is more, the tester is more accurate... all in all a good thing for research, imho

 
Igor Makanu:

no

in MT4 it is iCustom()https://docs.mql4.com/ru/indicators/icustom

I checked it last year, iCustom() call from EA is cacheable, i.e. if you calliCustom() several times from EAfor different buffers or indexes on the same tick, the indicator itself will be recalculated once for this tick, i.e. there is nothing wrong with performance

ZS: why MT4 - if MT5 has already been "figured out", the productivity is more, the tester is more accurate... all in all, it's a good thing for research, imho

It is easier to work with ideas on MT4. The shell is easier))) No so no. Let's write)))) in a loop in the array the old-fashioned way I have not reached these stages yet)))) In MT5 it makes sense to scale when MT4 stops working))) and this is either too slow or too much data.

added. And when the idea is worked out to an acceptable error.
 

Good afternoon all. The grail machine is almost finished, but when I compile it I get about 50-60 warnings about return value of'OrderSend' should be checked TREND+ _V_1,1.mq4 1626 11

As far as I understand it because I write the opening of orders without any check, like this

//--- АО БАЙ--

   /*УСЛОВИЕ 1*/
   if(flag_screen1==en_vbIkl_screen1 &&flag_screen2==en_vbIkl_screen2)
   { // НАЧАЛО УСЛОВИЕ 1
   if(ao_buy!=EMPTY_VALUE && count_orders_market_buy ==0)
   {
     OrderSend(Symbol(),OP_BUY,lot,Ask,slippages,Bid-sl,Bid+tp ,comment_ao_buy); // ОТКРЫВАЕМ БАЙ ОРДЕР
   }
   } // КОНЕЦ УСЛОВИЕ1
 
DanilaMactep:

Good afternoon all. The grail machine is almost finished, but when I compile it I get about 50-60 warnings about return value of 'OrderSend' should be checked TREND+ _V_1,1.mq4 1626 11

As far as I understand it because I write the opening of orders without any check - like this

write it like this

if(OrderSend(Symbol(),OP_BUY,lot,Ask,slippages,Bid-sl,Bid+tp ,comment_ao_buy)) Print(Buy Open); // ОТКРЫВАЕМ БАЙ ОРДЕР
 
MakarFX:

write this

this line of code does not work:( 2 errors like this pop up at once:

'Buy' - undeclared identifier TREND+_1,1.mq4 860 98


'Open' - some operator expected TREND+_V_1,1.mq4 860 102

And the code itself is like this

if(OrderSend(Symbol(),OP_BUY,lot,Ask,slippages,Bid-sl,Bid+tp ,comment_ao_market_buy)) Print(Buy Open); // ОТКРЫВАЕМ БАЙ ОРДЕР


I wrote everything as advised, the only difference is that I changed the variable name for the comment to separate the comment for market and pending orders. What am I doing wrong?
 
Print("Buy Open");
 
DanilaMactep:

This line of code doesn't work:( 2 errors like this appear at once:

'Buy' - undeclared identifier TREND+_1,1.mq4 860 98


'Open' - some operator expected TREND+_V_1,1.mq4 860 102

and the code itself is like this


I wrote everything as advised, the only difference is that I changed the variable name for the comment to separate the comment for market and pending orders. What am I doing wrong?

I missed ""

Vladislav Andruschenko:

Print("Buy Open");


 
With the first start of the indicator in the OnCalculate method CopyRates does not work
                MqlRates rates[];
                if (CopyRates(_Symbol, _Period, (datetime)SeriesInfoInteger(Symbol(), Period(), SERIES_SERVER_FIRSTDATE), 1, rates) == -1)
                {
                        return(0);
                }

Ticks come it's visible on prints but it doesn't copy, as if there is no indicator in the terminal, only change of period with indicator helps, then after first start indicator works fine.

 
BillionerClub:
With the first start of the indicator in the OnCalculate method CopyRates does not work

Ticks come it is visible on prints but does not copy, as if there is no indicator in the terminal, only change of period with indicator helps, then after first start indicator works normally.

Help:CopyRates

Note

If interval of requested data is completely out of range on server, function returns -1. In case data is requested outsideTERMINAL_MAXBARS(maximal amount of bars in the chart), the function will also return -1.

When requesting data from the indicator, if the requested timeseries haven't been built yet or they need to be downloaded from a server, the function will return -1 right away, but the process of downloading/build will be initiated.

When requesting data from the Expert Advisor or a script, theloading from the server will be initiated, if the terminal does not have these data locally, or the building of the required timeseries will begin, if the data can be built from the local history, but they are not ready yet. The function will return the amount of data that will be ready by the timeout time, but the loading of history will continue, and the next similar request will return more data.

When requesting data by starting date and number of items required, only data with a date less than (before) or equal to the specified one will be returned. At the same time, the interval is specified and taken into account to the nearest second. It means that the date of opening of any bar, for which the value is returned (volume, spread, value in the indicator buffer, price Open, High, Low, Close or open time Time), is always equal to or less than the specified one.

When requesting data in the specified date range, only data falling within the requested interval will be returned, and the interval is specified and taken into account to the nearest second. This means that the opening time of any bar for which a value is returned (volume, spread, value in the indicator buffer, price Open, High, Low, Close or open time Time), is always within the requested interval.

Thus,if the current day of the week is Saturday, then when trying to copy the data on the weekly timeframe, specifyingstart_time=Last Tuesday andstop_time=Last Friday, the function will return 0, since the opening time of the weekly timeframe always falls on Sunday, but no weekly bar falls into the specified range.

If you want to get the value corresponding to the current unfinished bar, you can use the first form of the call, specifyingstart_pos=0 andcount=1.

Документация по MQL5: Доступ к таймсериям и индикаторам / CopyRates
Документация по MQL5: Доступ к таймсериям и индикаторам / CopyRates
  • www.mql5.com
CopyRates - Доступ к таймсериям и индикаторам - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5