Questions from Beginners MQL5 MT5 MetaTrader 5 - page 494
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Until yesterday, my EA has only opened one order each and the next one will not open until I place an order. Now, how to make my EA open orders when the previous bar has opened above (below) the channel?
If you analyze this code fragment, then, according to this code, if theCountTrades() functionreturns zero, the condition if (CountTrades()==0) CheckForOpen()will be executed, and the functionCheckForOpen() will be called.On the next tick, if the order has been opened, theCountTrades()functionshould return 1, and then the else condition is fulf illed
If it appears that CountTrades()<max_trades, theCheckForOpen() function will be executed once again.According to the code, value of max_tradesvariable equals 3. Thus, you will have 4 orders open.
If the EA does not open orders correctly, then check the logic, in which you define the conditions under which positions are to be opened in the function CheckForOpen(). And also check the time conditions if (CurrTime < EaStartTime || CurrTime >= EaEndTime). If I were you, I would use the function if (TimeHour(TimeCurrent()) = start hour && TimeMinute(TimeCurrent()) = start minutes ). The hour and minutes are set in variables of int or uint types.
If Open Bar Number 1 is above/below channel.
Thus, you will have 4 orders open.
If the EA does not open orders correctly, then check the logic, where you specify the conditions under which positions must be opened in the function CheckForOpen(). And also check the time conditions if (CurrTime < EaStartTime || CurrTime >= EaEndTime). If I were you, I would use the function if (TimeHour(TimeCurrent()) = start hour && TimeMinute(TimeCurrent()) = start minutes ). The hour and minute are set in variables of int or uint types.
I wanted to open 3 orders but this was not what I intended; I wanted up to three, but one order per each new bar.
There is no problem with time, it works in a strictly specified period of time.
I wanted up to three orders, but one order for each new bar. There are times when several bars in a row give positive signals.
There is no problem with time, it works in a strictly specified period of time.
2016.01.13_05:14AM. Hello Mr. Karputov! I wrote in MQL4
.mq4 file, got the .ex4 file. But it does not work in the strategy tester. Final
was to write an EA for MT4. In MQL5, I got .mq5 and
.ex5 files. And .ex5 file opened trades. The fourth version is different from
The fourth version has some differences from the fifth one, and I'm not a good MQL programmer yet, that's why I got bad results.
I have not understood what is wrong now, the log file of the tester has been saved. Я
I will try to translate it. In the meantime I'm asking you to tell me
what's wrong with the program code? While you're answering, I'll try
to figure it out.
I was surprised to find in my fourth version of the editor a variant of writing
I was about to write it. But I didn't write it. I am attaching
tester log files and a screenshot. 05:30 MSC.
2016.01.13_05:14AM MOSCOW TIME. Hello Mr Karputov! I have written in MQL4
.mq4 file, got an .ex4 file. But it doesn't work in the strategy tester.
Where can I find error descriptions?
I don't understand what the compiler doesn't like, why it warns me?
check operator precedence for possible error; use parentheses to clarify precedence
if(Low[X]>PriceBuy && High[X]>PriceBuy ||
Low[X]<PriceBuy && High[X]<PriceBuy)
calcBarX++;
and here
expression has no effect
for(calc_day;calc_day>0; calc_day--)
{
if(iLow(Symbol(),TF_3Day,calc_day)<iLow(Symbol(),TF_3Day,calc_day+1)) calc_day_OK++;
else break;
}
Where can I find error descriptions?
I don't understand what the compiler doesn't like, why does it warn me?
Actually, apart from the error text, the compiler also reports the number of the code line where the error is found and its position in the line.