double EquationDirect(double x1, double y1, double x2, double y2, double x)
{
if (x2==x1) return(y1); // Если х2 равно х1, то вычислять ничего не нужно, а просто вернуть значение y1
return((y2-y1)/(x2-x1)*(x-x1)+y1); // а тут вычисления нужны (х2 не равно х1), вычисляем значение по формуле уравнения прямой и возвращаем его
}
y1 is returned if x1=x2, i.e. there is only one point. If there are two points and x1 is not equal to x2, then the calculation is done.
The function is fine, I separately tested it outside the loop - it works correctly
Give me again the indicator code fragment where you want to put it all. But... You don't need to increase the buffer - you need to shift the pointer to the buffer cell where you want to put the value.
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.
Deal at a certain time
How do I write an EA which opens a deal at a certain second?
I can't think of anything but start, but it only opens when price changes, and I need it in a second
And what if in this second there is a momentary lapse of connection? And this phenomenon is very common in all brokers.
if(TimeHour(prevtime)==1 && TimeMinute(prevtime)==1 && TimeSeconds(prevtime)==1)
{
order open function
}
prevtime=TimeCurrent();
You have to loop the whole start:
int start()
{
while(!IsStopped())
{
RefreshRates();
all operations
}
}
...Ctrl+Alt+M used to paste code, but it's not working. SRC can't find it, sorry, please.
How to design a post, insert programme code, image, video
demlin i.e. will the second condition be met in any case?
You are tryingto return one value first
y1 is returned if x1=x2, i.e. there is only one point. If there are two points and x1 is not equal to x2, then the calculation is done.
The function is fine, I separately tested it outside the loop - it works correctly.
What don't you understand? Don't confuse the man:
Is that clearer?
y1 is returned if x1=x2, i.e. there is only one point. If there are two points and x1 is not equal to x2, then the calculation is done.
The function is fine, I separately tested it outside the loop - it works correctly
Give me again the indicator code fragment where you want to put it all. But... You don't need to increase the buffer - you need to shift the pointer to the buffer cell where you want to put the value.