[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 581

 
artmedia70 >>:
Друзья! Подскажите как определить что цена пересекла определённый уровень снизу-вверх, либо сверху-вниз, дабы при происшествии сего факта открыться ? Используя именно цену, а не индикаторы. Спасибо, кто откликнется...


How about this?

price2 = price1; // сохраним предыдущее значение цены
 price1 = Ask; 
 if ((price1 =>controlprice)&&( price2<controlprice)) Alert("Цена = ", price 1," пробой снизу!!!");
 if ((price1 <= controlprice)&&( price 2> controlprice)) Alert("Цена = ", price1," пробой сверху!!!");
 
artmedia70 писал(а) >>
How can you tell if the price has crossed a certain level upwards or downwards, in order to open when it has happened? I use the price, not the indicators. Thanks for the reply...

Then the problem may be rephrased as "did the second line (bar) cross the first one (level)". Then we can define the direction of the line by the line coordinates and calculate the crossing by the equation of lines.
 
Help, please! We need to find the intersection of the indicators...
Files:
lastlast_1.mq4  15 kb
 
PLUT >>:

Здрасти ...

Can you tell me the code that writes multiple variables to a file?
 
IgorM >>:


может так?

Interesting approach... Thank you, I will reflect...
 
Has anyone already made a function that can determine that the last open pose is at a loss by N-number of points set programmatically by me? I've tried different kim's functions, but they turn out too cumbersome, taking into account further conditions and calculations... I would like to do it more elegantly, with one function.
Maybe someone has an idea?
Thank you.
 
DDFedor >>:

если представить, что "уровень" - прямая, а пересекает ее не цена( точка, по сути), а бар, то можно представить бар в виде второй прямой. тогда можно перефразировать задачу в вид "пересекла ли вторая прямая(бар) первую прямую(уровень)". тогда можно задать направление прямой по координатам прямой, а расчитать пересечение - по уравнению прямых.
Thanks, but I think IgorM's example above would be more interesting for my particular case, but thanks for the fresh idea... :)
 
artmedia70 >>:
Кто-нибудь делал уже функцию, которая может определить, что последняя открытая поза находится в убытке на N-нное кол-во пунктов, задаваемых программно мною? Чёт ковырял кимовские функции разные, слишком громоздкими получаются конструкции с учётом дальнейших условий и расчётов... Хотелось бы как-то поизящнее, одной функцией.
Иль может мысль какая у кого есть?
Спасибо.

OrderProfit() is called

 
And here's one last thing and a follow-up:
Igor Kim has a library of functions called b-Lots.mqh. It's used in some of the codes listed here on this resource. I always thought I had all Igor's libraries, but no... it's the one I'm completely missing. And the worst thing is that I can't find it anywhere. Even a search didn't help me and his personal site...
If anyone knows where this miracle of elusiveness can be found, I'd be very grateful... :)
 
denis_orlov >>:

OrderProfit() называется

Yes, of course, that's exactly what it's called... How could I have overlooked it, when I used it myself as recently as two or three days ago in another strategy by the same expert...
You need more sleep and rest... :)
Reason: