Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 45

 
Vitalie Postolache:
What's the big deal? It's always been like that.
I don't know, I haven't done them before. If I take a random bot from codebase and run it through the same segments, it will do something, but this bot just dies on startup, although I can see that the code works and I fixed the previous error, there is nothing to complain about and compiler does not swear. But it's annoying to kill the terminal via Task Manager, and there's no sense in it. It's easier to find a bug and fix it.
 

trader781:
Ну не знаю, я раньше ими не занимался.  Если брать случайного бота из кодебазы и прогнать по тем же отрезкам, то он что - то будет делать, этот же просто дохнет при запуске, хотя смотришь - вроде код рабочий и прошлую ошибку я поправил, придраться особо не к чему и компилятор не ругается. Но убивать терминал через диспетчер задач надоедает, да и смысла нет. Проще найти косяк и исправить.

What does the log from the Experts tab say? Or the tester log?
 
Vitalie Postolache:
What do Expert Advisors tab logs say? Or the tester's log?

nothing suspicious there either (except for the above)

ran it on a demo, let it work, if I can't fix it I'll let you know the reason

The take parameter is still completely ignored

If it is not equal to zero, it should either show an error or be set
 
trader781:

nothing suspicious there either (except for the above)

ran it on a demo, let it work, if I can't fix it I'll let you know the reason

so far the take parameter is completely ignored

If it is not equal to zero, it should either fail or be set.
Does the tester open orders? Does it open at least one? Is there no error in the log? You should print the error code and calculation parameters passed to trading functions, it makes it much easier to catch logic errors.
 
Vitalie Postolache:
Does it open orders in the tester? Does it open even one? Is the log without errors? You should print the error code and calculation parameters passed to trading functions, it makes logical errors much easier to catch.
i got a error when i tried to open one order in the Strategy Tester, but after the second one, the CPU load is 29% and keeps growing until it hangs up.
 
trader781:
In the tester, opens one then the second and hangs, in the demo as well, after opening the second CPU load 29% and growing until it hangs
Where are the logs? Miracles do not happen.
 
Vitalie Postolache:
Where is the log? There is no miracle.
2016.12.22 22 22:16:32.249 '14041396': order #161405291 sell 0.01 AUDUSD at 0.72067 sl: 0.00000 tp: 0.00000 closed at price 0.72116
2016.12.22 22 22:16:32.162 '14041396': close order #161405291 sell 0.01 AUDUSD at 0.72067 sl: 0.00000 tp: 0.00000 at price 0.72116
2016.12.22 22 22:16:31.507 '14041396': order #161415692 sell 0.02 AUDUSD at 0.72086 sl: 0.00000 tp: 0.00000 closed at price 0.72115
2016.12.22 22 22:16:31.278 '14041396': close order #161415692 sell 0.02 AUDUSD at 0.72086 sl: 0.00000 tp: 0.00000 at price 0.72115
2016.12.22 22:16:17.002 Expert count AUDUSD,M5: removed

2016.12.22 22 22:16:32.249 '14041396': order #161405291 sell 0.01 AUDUSD at 0.72067 sl: 0.00000 tp: 0.00000 closed at price 0.72116

2016.12.22 22 22:16:32.162 '14041396': close order #161405291 sell 0.01 AUDUSD at 0.72067 sl: 0.00000 tp: 0.00000 at price 0.72116

2016.12.22 22 22:16:31.507 '14041396': order #161415692 sell 0.02 AUDUSD at 0.72086 sl: 0.00000 tp: 0.00000 closed at price 0.72115

2016.12.22 22 22:16:31.278 '14041396': close order #161415692 sell 0.02 AUDUSD at 0.72086 sl: 0.00000 tp: 0.00000 at price 0.72115

2016.12.22 22:16:17.002 Expert count AUDUSD,M5: removed


(deleted via terminal stop, existing orders wiped by hand, one log second expert tab)


 
mila.com:

Need indicator values, on the first closed bar H1.

So, get the usual.
 
trader781:

(deleted via terminal shutdown, the existing orders were covered manually, one log second expert tab)

I have taken the last variant known to me and fixed the most glaring bugs, but the order opens only one and that's it. In general, I do not understand the logic of this EA, it is all written in a weird way.

In general, I hope the next step is clear. I have to fill the code with prints for everything that can and cannot be found and catch logic errors, and there may be more than one. A lot more.

Files:
count.mq4  17 kb
 
Vitalie Postolache:


Thank you, it's pretty clear what to do

And the point is simple.

- open an order

- set take profit

- If the price goes down, open a second one after the step with a refill at the average price

- set take out

- If a single take has triggered, close all of them.

I just ran that you threw away so it's true) almost all the code is ignored