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

 

Do you guys have any tips for this feature. I want the EA to shut down not on Take Profit, but on the balance, which I give him no need to remove it how to do? I think there is a block to close the deal, we need to specify the amount whether more or less at which the deal will close or not?

 

Let us run the following code.

if(OrderType()==OP_BUY) // If there is a Buy order

{

orderBuy=1;

if(CrossPositionClose()==1) // Close the order if it satisfies

{ // condition CrossPositionClose()=1

price=MarketInfo(Symbol(),MODE_BID);

OrderClose(OrderTicket(),OrderLots(),price,slippage,CLR_NONE);

how do I specify that for example at 0.30 cents it would just close itself and that's it?

 
what to express to close the order on reaching a profit of $0.20
 
Pyxlik2009:

Let us run the following code.

if(OrderType()==OP_BUY) // If there is a Buy order

{

orderBuy=1;

if(CrossPositionClose()==1) // Close the order if it satisfies

{ // condition CrossPositionClose()=1

price=MarketInfo(Symbol(),MODE_BID);

OrderClose(OrderTicket(),OrderLots(),price,slippage,CLR_NONE);

how do I specify that for example at 0.30 cents it would just close itself and that's it?

if(OrderProfit()>0.2 0){OrderClose(OrderTicket(),OrderLots(),price,slippage,CLR_NONE);}
 
rensbit:

Thanks. Let's give it a try)))
 
something does not work ((((
 
What could be the problem?
 
Pyxlik2009:

Do you guys have any tips for this feature. I want the EA to shut down not on Take Profit, but on the balance, which I give him no need to remove it how to do? I think there is a block to close the deal, we need to specify the amount whether more or less at which the deal will close or not?


https://www.mql5.com/ru/code/9683 - here is an EA which closes orders on change of equity (you specify in the currency of the deposit), maybe it will suit...
 
valenok2003:

https://www.mql5.com/ru/code/9683 - here's an advisor, closes orders on change of equity (specify in depot currency), might be suitable...
Thanks, I will look into it now )))))
 
gince:

Help me make the indicator draw arrows. This is a buy pattern. Only last condition changes for sell.(l0 < l1).


Please help. If the first candle's low is higher than the second one and the first candle's high is lower than the second one's high,

then

- If on the zero candlestick the low has fallen below the low on the first candlestick , then we draw an arrow downwards,

- If on the zero candlestick the high has risen above the high on the first candlestick, then draw the up arrow.

The picture is shown on 583 stranice