I'm just wondering why a bar that has never been traded, i.e. whether it needs to be counted in a numerical series at all.
as well as the months I didn't trade, in calculating profits
The difference is that if we consider all bars independent of changes occurring in them, the essence of calculation from a coding point of view comes to simple addition in a loop and division by number of iterations of the loop (very simple, simple and fast), while if we bother considering bars which haven't changed, we should add to the loop the check of absence of changes and one more variable storing the number of bars where those changes have happened. In short - for pioneers who like difficulties (for those who stand in a hammock to improve demographic situation...)
zero is the absence of change, not change equal to zero.
I consider the average of existing existing changes, i.e. changes that are
There's no one to ban and nothing to do, I'll just go along with the mathematicians opinion. Zero is the same change, and the same measurement, as well as others. To single it out is voluntarism.
granit77: There's no one to ban and nothing to do, I'll just go along with the mathematicians' point of view. Zero is the same change, and the same measurement, as well as others. To single it out is voluntarism.
It really depends on the task, there's nothing to argue about. If the aim is to calculate "the average of the last five positive changes", then zeros, of course, should not be taken. If "the average of the last five non-negative changes" you must take zero. That's it.
if (STATE==0)
{
bool cantrade=true;
if(TimeHour(TimeCurrent())==LastTradeTime) cantrade=false;//запрещаем торговать пока не наступит новый час после последней //открытой сделки (чтобы избежать множественных открываний сделок на одном и том же часовом баре) if (Hour()>=StartH && Hour()<=FinishH)
if(OrdersTotalMagic(magic)>=active_trades) cantrade=false;// проверяем на допустимое количество открытых ордеровif (OrdCon(OP_BUY,magic)>=1 || OrdCon(OP_SELL,magic)>=1) SimpleTrailing();
if(cantrade) // если не было ни одного запрета на открытие сделок, то переходим к ожиданию сигналов системы на открытие ордеров
STATE=1;
}
how do you think there are errors in this code? as the meta-editor shows - 0 (no), but when you put brackets after the line if (Hour()>=StartH && Hour()<=FinishH) { } - like this :
if (STATE==0)
{
bool cantrade=true;
if(TimeHour(TimeCurrent())==LastTradeTime) cantrade=false;//запрещаем торговать пока не наступит новый час после последней //открытой сделки (чтобы избежать множественных открываний сделок на одном и том же часовом баре) if (Hour()>=StartH && Hour()<=FinishH) {
if(OrdersTotalMagic(magic)>=active_trades) cantrade=false;// проверяем на допустимое количество открытых ордеровif (OrdCon(OP_BUY,magic)>=1 || OrdCon(OP_SELL,magic)>=1) SimpleTrailing();
if(cantrade) // если не было ни одного запрета на открытие сделок, то переходим к ожиданию сигналов системы на открытие ордеров
STATE=1;}
}
it doesn't open trades and doesn't work! does anyone know what the reason might be?
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 do not understand the question) I consider the average change
I do not understand the question) I am counting average changes
In that case, counting all bars is mandatory regardless of changes occurring on individual bars.
Leave it till tomorrow. It's better in the morning...
If there are no changes to the bar, there is nothing to count, I am counting the average of the existing changes)
I'm just wondering why a bar that has never been traded, i.e. whether it needs to be counted in a numerical series at all.
as well as the months I didn't trade, in calculating profits
and how did you get out of that situation?
zero is the absence of change, not change equal to zero.
I consider the average of existing existing changes, i.e. changes that are
There's no one to ban and nothing to do, I'll just go along with the mathematicians' point of view. Zero is the same change, and the same measurement, as well as others. To single it out is voluntarism.
I have why the tester does not optimise the bot
how do you think there are errors in this code? as the meta-editor shows - 0 (no), but when you put brackets after the line if (Hour()>=StartH && Hour()<=FinishH) { } - like this :
it doesn't open trades and doesn't work! does anyone know what the reason might be?