I am stuck Please Help
-
Hello Everyone,
I am trying to close the cycle when EA makes required profit.
This is a sample project need to add loop to open more positions.Here I want to close all trades when 1% growth reached.
For example
our Initial balance 1000$ and we want $10 profit.
Each position opens and close after hitting take profit.
Suppose we closed 15 trades with 1$ profit each and we are waiting for either our floating goes below -5$ to settle the complete cycle at profit of $10 (1%) or EA to close more profitable trades.
https://fxdreema.com/shared/Nj9jiQHhc -
Not sure I fully understand. If I understand it correctly all open trades should be closed if overall profit is $10, no matter is some are in profit and other in loss, right? I don't get the last part where you want to close the 'more profitable' trades only.
-
@l-andorrà
First of all thank you to spend time on topic.
Let me explain it again.
Suppose account size 1000$ and I want to add 10$ in my equity as final result after all trades closed each time.Let start.
For example EA takes a Buy and Sell on each time when condition met with take profit 10 pips for both.Let say EA closed 15 trades of 0.01 size and few negative trades are still open with unrealised profit of -6$.
So we are short on closing one more positive trade or wait to get unrealised profit decrease to -5$ from current -6$ to get $10 added to equity from intial equity before opening of first trade.So as soon this situation reached all running trades should get closed,.
-
But that makes no sense. If you are planning to get a global profit of $10, why are you looking for closing all trades at $-5 when you are at $-6 right now. Shouldn't you wait for more trades to be open until hitting $10?
-
@l-andorrà I mean I have booked $15 profit already buy I am still away from target 1% to reach that is $10.
I booked $15 and remaining running profit is -6$ so in equity I have added 9$ yet. . Multiple trades keep working to get $10 added to equity.
.I just want to know the calculation in variables I am doing wrong.
-
Please accept my apologies, but I simply don't get it. You cannot be 1% away from $15 if you are $10 right now. That means you are 33% away instead. When you say you 'added' $9 do you mean you opened more trades maybe?
-
Sorry, I might be failing to explain it correctly. Let me try once again.
We have no trade open, Our target will be adding $10 to the equity each time when cycle to trades get closed completely..
Let's Begin
Initial Equity - $1000
EA opening buys/sells and closing it on 10 pips profit of 0.01 lot size each.
So after closing many trades either buys and sells if we have booked $15 in our balance and few of trades are still open waiting to hit profit which showing -5$ as unrealised profit.
So latest status is
Equity - $1010
Balance - $1015
Unrealised P/L - (-5$)
So as we achieve our target of 10$ in equity in current running cycle of trades so here we need to close the all running trades with Unrealised P/L - (-5$).I hope this will be easy now to understand.
-
Best would be to trail by pips, other wise close profitable trades by money.
-
@jstap Thank you for entering into the thread.
There is take profit target assigned to each trade, so most of the trades already get closed and remaining need to close when target achived as per my previous comment.If I use close profitable trades blocks or use tp does it make any difference ?
I try to use variables for getting initial equity, sum of money of closed trades, difference between closed trades and unrealised profit should be our target profit at moment all trades need to be closed.
https://fxdreema.com/shared/Nj9jiQHhc -
On trade tab trade closed by TP-close all trades
-
And what changes I need to make to current state of project variables ?
-
Nothing I put requires variables