Can you tell me why iBarShift in the indicator keeps returning 0?
It all started when the indicator would periodically stop drawing. Decided to find out the reason why this happens and came across that iBarShift always returns 0.
A piece of code:
int shift = getShift(PERIOD_D1, 1);
datetime dt = iTime( Symbol(), PERIOD_D1, shift); //----- время всегда возвращает правильно
int a = iBarShift( Symbol(), PERIOD_H1, dt, false); //----- а тут всегда 0
//--------
int getShift(int timeframe, int shift)
{
return(iBarShift(NULL, timeframe, Time[shift]));
}
string symbol, int timeframe, datetime time, bool exact=false)
Search for bar by time. The function returns the offset of the bar to which the specified time belongs. If there is no bar for the specified time (a "gap" in the history), the function, depending on the exact parameter, returns -1 or the shift of the nearest bar.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
extern double Lot = 0.01;
extern double LotFactor = 0.01;
SendOrder(0,Lot,Ask,1,stop.loss,take.profit.0);
Lot=NormalizeDouble(buy.last.lot+LotFactor,DG);
SendOrder(0,Lot,buy.last-step[buy]*Pp,1,stop.loss,0);
Can you use functions?
I think I know a little bit about custom functions.
I wrote it a little wrong, I've fixed it.
Is that a script or something?
is this a script or what?
This is a piece of code from my EA which increases order lots as they are placed.
Send the EA itself to me on my mailbox if you can. I'll take a look at it.
Send the EA yourself if you can. I'll take a look at it.
You've got an advisor on a pause.
Can you tell me why iBarShift in the indicator keeps returning 0?
It all started when the indicator would periodically stop drawing. Decided to find out the reason why this happens and came across that iBarShift always returns 0.
A piece of code:
I think so, check...
Hello. Do you know if there is a built-in function that allows you to determine the candlestick number from the time?