[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 179

 
kakbutak:

Hello. Please help me solve problem number 3 shown in the picture. If problem number 4 arises, then that too. Please explain as a dummie.


Maybe so " If TR. and Ask< iClose("USDCHF",PERIOD_H1,i) then Lot=0.0.

 
MQL414:

Can " If TP. and Ask< iClose("USDCHF",PERIOD_H1,i) then Lot=0.0.


Thanks but not suitable.The condition is fulfilled at the beginning of every hour if Open is below( on the sell) the trend line, and candlesticks can be any.This restriction can lead to the fact that the first trade will not open either.

I have an option. For example, if today after a Sell trade the balance has risen by TP, then prohibit a Sell trade today, if Buy trade, then prohibit a Buy trade. But I don't know how to code it.

 
deyron:
Thank you sir, I have done this and more - many times in different variations. When I try to use iCustom indicator, it works fine in the same way, when I change TF it is drawn ... If I remove it from clipboard, it will be drawn in a different folder in iCustom ... If I try to put in a comment in iCustom, it will be drawn in a different folder in iCustom. I will try to change it in the same way it is drawn in the code. I will be glad to hear any other suggestions)).

Option)))... Saved template of the same name as the EA with this indicator... then, no?

.... Treatment))) Remove the template .

 

Thank you! It's cleared up a bit. With the buffer.

And here...

IndicatorCounted( )
The function returns the number of bars unchanged since the last indicator call. How? I have attached it to the chart once, and the number of bars will be the same? It cannot be, it may be counting the number after every tick. Bars where? Probably, on the visible part of the chart? It's really written in such a way that one can only guess! Sorry for the Ukrainian layout, my brother changed the Windows, I can't change it!
 if(counted_bars>0) counted_bars--; limit=Bars-counted_bars;
Why is it so hard to write? And anyway, more bar, less bar? Okay, I'll keep reading the code, maybe I'll figure it out.

 

Is it possible to be so complicated? And anyway, bar more, bar less? OK, I'll keep reading the code and see if I can figure it out.

If the calculation is rather complicated, then unnecessary recalculation of thousands of unchanged bars is a great waste of time. I need to get there before the next tick, and it may take 250 milliseconds (on my server)
 
Heroix:
Korinf, read about OrderCloseBy().

As far as I understood it closes two orders. I.e. +1 on the first order and -2 on the second it will close both of them with -1 total profit. I need it to close +1 and -1 and the balance is the number of lots which gives -1. That is, all of the first + part of the second to leave a balance.

Can you give me a hint?
All day I can not find the function trawl points. I.e. I found a lot of trails, but they all use candlesticks or fractals or something else.
If my profit turned +1, I should trawl by several points. For example, I set a trailing edge by 10 pips. The price moved 10 points in my direction - the SL has moved closer by n points. It moved 10 points further and the SL moved closer.
I think this should have been implemented a long time ago!
 
Is there a function which calculates where a bunch of orders will breakeven?

For example, I have two sell orders and one buy order (even if they are the same). I want to draw a line where the breakeven level of these positions will be if the price goes down.
 

korinf:
Есть ли функция которая считает где будет безубыток у кучи ордеров?

У меня есть к примеру два ордера sell и один buy(пусть одинаковые). Хочу чтобы рисовалась линия где будет уровень безубытка по этим позициям если цена идет вниз.

https://www.mql5.com/ru/code/9703

https://www.mql5.com/ru/code/9375

https://www.mql5.com/ru/code/10007

 
korinf:

As far as I understood it closes two orders. I.e. the first +1 on the second -2 it will close both with a total profit of -1. And I need it to close +1 and -1 and left that kolichuvto lots, which gives -1. I.e. all of the first + part of the second to leave a balance.



And so it will be. Only the overlapped part of the orders will be closed, but the balance will get its Ticket. It will look like a new order, but it will be opened at the price of the order the volume of which was larger.
 

OK!) All the overlapping has been sorted out!

Can you give me a hint?
I've been trying to find the item-by-item trall function for the whole day. I.e. I found a lot of tralls, but they all use candlesticks or fractals.
If my profit turned +1, I should trawl by several points. For example, I set a trailing edge by 10 pips. The price moved 10 points in my direction - the SL has moved closer by n points. It moved 10 points further and the SL moved closer.
I think this should have been implemented a long time ago!