Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 432

 
You can do it
Yerik888:
We cannot set the price at which a pending order will be deleted when it reaches this price. Essentially, it is just a manual deletion of all pending orders. When opening a pending order in metatrader, you can specify the time upon which, if the pending order has not triggered, it will be automatically deleted. Is there a feature that allows you to delete a specific pending order when a certain price level is reached? Example: I place a buy-stop at the breakout of the maximum of a 4h candle, and if the price breaks the minimum of the same candle, I need to delete the order. How can you do this automatically, writing a specific quote of the candlestick's low in a function (script), so as not to be constantly present in the terminal. Thank you in advance)

Well it is of course necessary to sketch out a small EA.

It is easier to mark levels by drawing a pair of lines on a chart with a predefined name. Accordingly, when the price touches one of the lines, the unnecessary pendants will be deleted.

The task itself is rather a small order in the work section.

 
vadynik:
Question on the Sleep() function owl does not fall asleep for some reason, I understand that the print wake up I need to see in an hour, the condition is met, and the prints go without a gap

you will sleep until you get out of the loss
 

Yeah, in the tester does not work Sleep in the demo is fine

What a beard, how to test the owl, only obstacles to mullions do

 
vadynik:

Yeah, in the tester does not work Sleep in the demo is fine

What is the beard, how to test the owl, all obstacles to mullions do

There is an article on this subject Features and limitations of testing trading strategies in MetaTrader 4

And if you need to sleep for N test/emulated seconds - use TimeCurrent().

 
Mr.Profit:

There is an article on this subject Features and limitations of testing trading strategies in MetaTrader 4

And if you need to fall asleep for N test/emulated seconds - use TimeCurrent().


Yes, I've already read it, I can use TimeCurrent() * for the time I need, will it work?
 
vadynik:

Yes I have read already, can TimeCurrent() * by the time I want, will it work?


You can do it like this:

- when the EA decides to sleep, it assigns datetime myStartSleepTime = TimeCurrent();

- After that check if (TimeCurrent() >(myStartSleepTime + sleepTimeInSec)) {take off sleep}

 
Mr.Profit:


You can do this:

- when the EA decides to sleep, it assigns datetime myStartSleepTime = TimeCurrent();

- after that check if (TimeCurrent() >(myStartSleepTime + sleepTimeInSec)) {take off sleep}


I can't beat the tester, I can only stop it xD but I can't get it to sleep)
 
vadynik:

I can't beat the tester, I can only stop it xD but I can't make it sleep)

What do you mean - make the tester go to sleep? No, you can't do that - the tester (by itself) will run until it finishes.

I meant that the tester can emulate Sleep(), i.e. when the EA stops and does nothing for some time. In testing, it means that the tester will be working all the time, the Expert Advisor will just work for emulated time interval H1-H2 will not do anything.

 
Mr.Profit:

What do you mean - make the tester go to sleep? No, you can't do that - the tester (by itself) will run until it finishes.

It means that the tester can emulate Sleep(), i.e., the Expert Advisor stops and does nothing for some time. In testing, it means that the tester will be working all the time, just the Expert Advisor for emulated time interval H1-H2 will not do anything.


Well, yes, I meant the owl is awake, watching when it's not needed) Such an important function, and the tester ignores it
 
vadynik:

Well, yes, I meant the owl is awake, watching when it's not needed) Such an important function, and the tester ignores it.
Well, without the source code, it's hard to tell what's wrong.