Close trade when take profit is higher then sell price
-
I tried to create a simple ea which should keep checking take profit, when ever take profit is set higher then selling price or below then buying price, it should close that specific trade immediately on current market price.
I used if trade balloon on tick then conected codition to it and then used close trade ballon. But this is not working, there are trades on the pair i started it on which has take profit greater then selling price, but it is not closing them, keep saying working. Please some one help me out??
-
@wakalz99 Don't understand what you try to do. Do you have a project started that you may share?
-
I already have a EA which create order as market moves. It open orders like this
Sell
.01
.02
.03
.05 etc
And recalculate and reassign take profit upon opening any order.
So i was trying to create an ea that can close an order when its TP is set higher then sell or lower then buy by the EA i am already using.
This is to stop carrying losses as market keep moving opposite to my direction. -
@wakalz99 If you are using an existing EA and try to modify the TPs / SLs of the trades it created, you should first check if when you manually change a SL or TP, the EA re-sets it again. In that case it wouldn't be possible by adjusting the SL/TP.
The only way would be to close when a certain point in time or loss or profit is reached. -
Are you working on a project doing that? Could you please share it for us to take a look?
-
As i described earlier my EA lets call it Boss, Boss opens trade and set take profit value for it.when price move against Boss's position, boss place more orders and re adjust Take profit value for all by modifying all open trades for that pairs. I want to create an EA here which keep checking open prices for Selling/Buying of trades and check if Take Profit is Greater/Lower then Selling/Buying, if it Found that it close trade immediately at current market price.
Check If Selling Open Price is <= Take profit, Close this Trade Immediately
or
Check Take Profit Value if >= Sell open price Close this Trade ImmediatelyCheck if Buying open price is >= Take Profit, Close this Trade Immediately
orCheck Take Profit Value if <= Buy Open Price, Close this Trade Immediately
Selling Price is 1.05, TP is set 1.06 Close this Trade Immediately
Buying Price is 1.10 TP is set 1.09 Close this Trade ImmediatelyI believe now you understand it clearly.
-
@wakalz99 Okay, I understood that you have some marti-grid EA - some call it averaging EA and it keeps openeing positions against the market. It has a steaddy profit it needs to reach - some kind of a "virtual take profit" when the complete basket of trades will be in profit.
What you want to do now is to close positions, whose open price is lower than this "virtual take profit" as they will be in loss anyway, right? -
@trader-philipps yes exactly, and i cant do it by connecting ballons, you have any idea which ballons i need and in which order.
-
@wakalz99 Just a rough try how I would start. This one is for buy orders on the symbol the EA is attached to. You maybe need to set same magic number as you boss EA has.

-
@trader-philipps I forgot to mention that it's on the on trade tab!
-
Thank You @trader-philipps it worked like magic. i want doing a bit different and second mistake was doing in on tick and on init.

Thank You again
-
Can please help me to do this same thing if no of orders are greater then certain number ?
Count total number of sell orders if > 10 Check if Buying open price >= Take Profit, Close this Trade Immediately. -
-
fxdreema does not support entry price? as for open price it is considering maybe candle start price or something else, but for sure not Buying/Selling price. any idea?
-
@wakalz99 Open Price is the price that will appear in your terminal and is the open price of the order!
-
it keep closing all orders, order xauusd 1501.90 tp was 1499, it closed it when market price was 1501.96.
same for buy orders -
@wakalz99 Can you share your project? It's hard to tell as my crystal ball is in repair

-
trust me the thing is wrote above is the EA i am trying to create just that simple. for your further research, search vzlomishk in google and download that ea. that is the one i am using and want to use this ea along with vzlomishk to control my losses.
-
@wakalz99 said in Close trade when take profit is higher then sell price:
vzlomishk
Sorry, but I'm not interested in marti grid EAs. Just wanted to help you out. If EA doesn't do what you intend to do, we need to have a look at. Otherwise we can't help.
-

this is the total thing i am trying to create and its not working as it should. also i tried all 3 take profit modes, price level fraction and pips.
