The tester has suddenly stopped working, scratching out no historical data.
What should I do with it?
for your information: the archive of quotes was downloaded
It helped me to restart the terminal and delete the downloaded quotes beforehand in the folder: C:\Program Files\MetaTrader - Alpari\history\Alpari-Micro2
Noterday: Can you please tell me the function that calculates the maximum possible order opening volume?
Let me give you a rod... :) The function below has all the data you need to calculate the parameters you need. I'm so lazy, I can't even bang on the keys...
You can find what you need and modify it yourself... The code itself is so simple and accessible that no one will have any trouble redoing it...
// ==========================================================================// ------------ Функция рассчёта величины лота для открытия позиции ---------// Если лот превышает возможный для открытия позы, то он корректируется // ==========================================================================double CorrectLots(double lt, double divider=4.0) // lt = проверяемый лот, divider = на сколько разделить
{ // свободные средстваdouble ltcorr;
double pnt = MarketInfo(Symbol(),MODE_POINT);
double mspr = MarketInfo(Symbol(),MODE_SPREAD);
double dig = MarketInfo(Symbol(),MODE_DIGITS);
double MaxLot = MarketInfo(Symbol(),MODE_MAXLOT);
double MinLot = MarketInfo(Symbol(),MODE_MINLOT);
double StpLot = MarketInfo(Symbol(),MODE_LOTSTEP);
double OneLot = MarketInfo(Symbol(),MODE_MARGINREQUIRED);
double TradeMrg = NormalizeDouble(AccountFreeMargin()/divider,dig); // Свободные средства, разрешенные к торговле
lt=MathAbs(lt);
ltcorr=lt; // Зададим начальное значением ltcorr равным значению ltif (lt>=MaxLot) ltcorr=MaxLot; // Проверим превышение допустимых ...if (lt<=MinLot) ltcorr=MinLot; // ... значений лотаdouble Money=lt*OneLot+mspr*pnt; // Вычисляем стоимость открываемой позыif (Money<TradeMrg) // Если свободных средств больше, чем цена позиции -
{
return(ltcorr); // ... возвращаем неизменённый лот
}
elseif (Money>=TradeMrg) // Если цена позиции равна или больше, чем есть свободных средств, то ...
{
ltcorr=MathAbs(MathFloor(TradeMrg/OneLot/StpLot)*StpLot); // ... рассчитаем допустимый лотdouble MoneyCorr=ltcorr*OneLot+mspr*pnt;
Print("Func CorrectLots: лот ",lt," скорректирован до ",ltcorr,
" Стоимость позы до корректировки = ",Money,
" Стоимость позы после корректировки = ",MoneyCorr
);
return(ltcorr); // ... и вернём его значение
}
Print("Func CorrectLots: лот вернули без изменений");
return(ltcorr); // Возврат изначального лота в непредусмотренных случаях с сообщением
}
One question...
Why do you need a trade like Hitler's at the end of the war... He recruited kids into the Hitler Youth, so to speak, the meat for one shot of the Faust cartridge...
artmedia70: Let me give you a rod... :) The function below has all the data to calculate the parameters you need. I'm so lazy, I'm too lazy to even bang on the keys...
You can find what you need and modify it yourself... The code itself is so simple and accessible that no one will have any trouble redoing it...
One question...
Why do you need a trade like Hitler's at the end of the war... He recruited children into the Hitler Youth, so to speak, the meat for one shot of the Faust cartridge...
Doesn't ring any bells?????
IMHO, of course...
Thanks!
Not going to open with maximum volume, just need to calculate it based on Depot size, for further mathematical operations =))
Can you suggest a code or a branch on how to memorise indicator line crossings with the price. i've seen it somewhere, but can't find it. I saw it somewhere but i can't find it.
I don't know if i'm interested, but i'm more interested in something like this:
int start()
{
double LineX = iCustom ("EURUSD", Period_H1, "Indicator",0,0);
double lineY = iCustom ("EURUSD", Period_H1, "Indicator",1,0);
double priceA = Ask;
double priceB = Bid;
double intersectionX = (LineX == priceA) ;
double intersectionY = (LineY == priceB) ;
// а так же еще определить, какое пересечение последнее, а какое предпоследние // intersectionX = последнее пересечение и на оборот// intersectionY = предпоследние пересечение и на оборот// то есть я понимаю логику, а вот связать в коде не могу.//произошло intersectionX, то intersectionFirst = intersectionX; intersectionSecond = intersectionY;// произошло intersectionY, то intersectionFirst = intersectionY; intersectionSecond = intersectionX;
}
Can you suggest a code or a branch on how to memorise indicator line crossings with the price. i've seen it somewhere, but can't find it. I saw it somewhere but i can't find it.
i want to know if the indicator line has crossed the price, but i'm more interested in this:
any crossover is best considered as a difference between the price (Ask/Bid) and the indicator line, i.e.
if (Ask-iCustom ("EURUSD", Period_H1, "Indicator",0,0) > 0) Comment("Price above the indicator"); else Comment("Price below the indicator");
If you compare the difference of these values, you don't need to normalize them for a proper comparison
particularly to your question - a crossing of the indicator line by the price is that moment when the Ask- -iCustom() difference was below zero during the previous calculation and then got higher, or vice versa
how you calculate this moment is your own business - maybe on the previous bar, or every tick, but such combinations:
You will be led into the maze of discrete mathematics faster than you can get the result you want - the bracketed expression will be either 0 or 1, which corresponds to the numerical representation of false and true
If you compare the difference of these values, you don't need to normalize them for a proper comparison
particularly to your question - a crossing of the indicator line by the price is that moment when the Ask- -iCustom() difference was below zero during the previous calculation and then got higher, or vice versa
How you calculate this moment is your own business - may it be on the previous bar, or every tick, but such combinations:
You will be led into the maze of discrete mathematics faster than you can get the result you want - the bracketed expression will be either 0 or 1, which corresponds to the numerical representation of false and true
That is, if I understand correctly, I can do this:
и я потом смогу intersectionY использовать только тогда когда оно TRUE, если FALSE, то такой код (intersectionY > Ask) не сработает, правильно я понимаю!?
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.
I see.
By the way, is there a timer in MQL4 or only in MQL5?
Probably just these functions:
https://www.mql5.com/ru/search?utm_campaign=MQL4.community
https://www.mql5.com/ru/search?utm_campaign=MQL4.communityQuestion for the aksakals
The tester has suddenly stopped working, scratching out no historical data.
What should I do with it?
for your information: the archive of quotes was downloaded
It helped me to restart the terminal and delete the downloaded quotes beforehand in the folder: C:\Program Files\MetaTrader - Alpari\history\Alpari-Micro2
then re-downloaded the quote archive
Can you please tell me the function that calculates the maximum possible order opening volume?
The function below has all the data you need to calculate the parameters you need. I'm so lazy, I can't even bang on the keys...
You can find what you need and modify it yourself... The code itself is so simple and accessible that no one will have any trouble redoing it...
One question...
Why do you need a trade like Hitler's at the end of the war... He recruited kids into the Hitler Youth, so to speak, the meat for one shot of the Faust cartridge...
Doesn't ring any bells?????
IMHO, of course...
Let me give you a rod... :)
The function below has all the data to calculate the parameters you need. I'm so lazy, I'm too lazy to even bang on the keys...
You can find what you need and modify it yourself... The code itself is so simple and accessible that no one will have any trouble redoing it...
One question...
Why do you need a trade like Hitler's at the end of the war... He recruited children into the Hitler Youth, so to speak, the meat for one shot of the Faust cartridge...
Doesn't ring any bells?????
IMHO, of course...
Thanks!
Not going to open with maximum volume, just need to calculate it based on Depot size, for further mathematical operations =))
Thank you!
I'm not going to open with maximum volume, I just need to calculate it based on the Depo's size for further mathematical operations =))
for BUY:
NormalizeDouble(AccountFreeMargin()-AccountFreeMarginCheck(Symbol(),OP_BUY,lot),2)
For SELL:
NormalizeDouble(AccountFreeMargin()-AccountFreeMarginCheck(Symbol(),OP_SELL,lot),2);
lot - the variable holding the order volume
calculation result should be checked for >0
https://www.mql5.com/ru/search
for BUY:
NormalizeDouble(AccountFreeMargin()-AccountFreeMarginCheck(Symbol(),OP_BUY,lot),2);
For SELL:
NormalizeDouble(AccountFreeMargin()-AccountFreeMarginCheck(Symbol(),OP_SELL,lot),2);
lot - variable with the order volume
https://www.mql5.com/ru/search
... Well, Igor, you're in a hurry... :)
Before I had time to put my fingers to the keyboard, you'd already written back... :)
Hi!
Can you suggest a code or a branch on how to memorise indicator line crossings with the price. i've seen it somewhere, but can't find it. I saw it somewhere but i can't find it.
I don't know if i'm interested, but i'm more interested in something like this:
Hi!
Can you suggest a code or a branch on how to memorise indicator line crossings with the price. i've seen it somewhere, but can't find it. I saw it somewhere but i can't find it.
i want to know if the indicator line has crossed the price, but i'm more interested in this:
any crossover is best considered as a difference between the price (Ask/Bid) and the indicator line, i.e.
if (Ask-iCustom ("EURUSD", Period_H1, "Indicator",0,0) > 0) Comment("Price above the indicator"); else Comment("Price below the indicator");
If you compare the difference of these values, you don't need to normalize them for a proper comparison
particularly to your question - a crossing of the indicator line by the price is that moment when the Ask- -iCustom() difference was below zero during the previous calculation and then got higher, or vice versa
how you calculate this moment is your own business - maybe on the previous bar, or every tick, but such combinations:
You will be led into the maze of discrete mathematics faster than you can get the result you want - the bracketed expression will be either 0 or 1, which corresponds to the numerical representation of false and trueany crossing is optimally considered as the difference of price (Ask/Bid) and the indicator line, i.e.
if (Ask-iCustom ("EURUSD", Period_H1, "Indicator",0,0) > 0) Comment("Price above indicator"); else Comment("Price below indicator");
If you compare the difference of these values, you don't need to normalize them for a proper comparison
particularly to your question - a crossing of the indicator line by the price is that moment when the Ask- -iCustom() difference was below zero during the previous calculation and then got higher, or vice versa
How you calculate this moment is your own business - may it be on the previous bar, or every tick, but such combinations:
You will be led into the maze of discrete mathematics faster than you can get the result you want - the bracketed expression will be either 0 or 1, which corresponds to the numerical representation of false and trueThat is, if I understand correctly, I can do this: