[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 1104

 
Danil93:
Where to look for a solution to the following problem: buy position, no loss. If the price went down by 20 points, the loss is set at the opening price, if the price went further, and reached -40 points, the loss is set: the opening price - 20. like this? if not difficult how would the code look like?
You don't need to set a loss but a take profit.
 
artmedia70:

Maybe it's because I'm sleepy, but I don't understand the conditions...

A Buy trade, its profit is equal to 10 pips OrderStopLoss() is equal to 0. When the price falls 20 points, the position's profit will be -10 points (we do not take the spread into account). At the same time, we cannot place StopLoss, because a stop order can be placed at a distance of at least the opening price minus the StopLoss level.

Your conditions are somehow wrong - always the stop position is higher than the Ask price while the open price is even higher.
To put it this way:
open price = 100, Ask price = 110 - no stop on position,
price has fallen by 20 pips: Ask = 90, stop should be set at open price = 100, but the stop level is already higher than the current price, which is at 90...
... and so on - you try to keep the stop not below but above the current price...

What's the point?

maybe i should also work before going to bed? yes, you're right, that's my fault. the trick in the system is to make the close price go down when the price moves the wrong way.

So now it's like this:

Buy T/P +10, S/L 0, price went down 20, T/P price opened

 
Danil93:

Maybe I should also work before going to bed? yes, you're right, that's my fault. the trick with the system is to make the closing price go down when the price moves the wrong way.

So now it goes like this:

Buy T/P +10, S/L 0, price went down 20, T/P price opened

In such a situation, when you close the position at take profit, you will have a negative profit equal to the spread.
 
artmedia70:
In such a situation, when you close a position at take, you will have a negative profit equal to the spread.
Why would you say that? close price equals open price. what's the spread?
 
Do you guys have a request, the indicator draws a box, but the problem is that it is stretched only by candle peaks, and I want it to be like a Piba and stretch both up and down to the levels that I want, and from the point from which I indicate on the chart. Or just re-do it like this
(The value of the upper layer is the value of the lower layer, and that's it.
Here's a similar tool can do something with it

_http://zalil.ru/30279246 thank you so much in advance

I want it to look like this


 

Wow. They used to show pictures like this on TV, only more colourful.

 
bool OrderModify( int ticket, double price, double stoploss, double takeprofit, datetime expiration, color arrow_color=CLR_NONE)

If unchanged values are passed as parameters to a function, an error 1 (ERR_NO_RESULT) will be generated.

Please explain what this means, it's not clear in which particular case this function generates error 1?

I mean, I'm trying to implement a trawl, I checked - exactly, the new SL level is exactly different from the previous one, I don't pass the TA, the other values remain unchanged and still this error is displayed. Why would...

 
Mepkypuu:

Please explain what this means, it is not clear in which specific case this function gives error 1?

I.e. I try to implement trawl, I checked - exactly, new SL level is exactly different from previous one, I don't pass TP, other values remain unchanged and still this error is displayed. Why would...


Look here - last fiie at the end of page - everything is described - your trawl seems to be similar - do by analogy - https://book.mql4.com/ru/build/trading.
 
Roman.:

Look here - the last fiie at the end of the page - it's all explained - your trawl seems to be similar - do it by analogy - https://book.mql4.com/ru/build/trading

Help me add a dynamic lot to this EA, if you could post a corrected one here?
Files:
 
sammi61:

Help me add a dynamic lot to this EA, if you can fix it, can you post it here?

Specifically define the concept of dynamic lot. I'll post a function as similar as possible here, you can insert it yourself...
Reason: