How can I collect the latest open positions in the event of a trend change?
-
How can I collect the latest open positions in the event of a trend change?
In this example every time a trend changes, there are several intersections.
Some crosses have three purchase orders, while others cross one.
The problem here at the end of the trend is the trend buying and there are six buy and eight sell.
The trend will be at a loss.
I want every time an intersection occurs and there is a buy or sell, the number of open positions is collected and only one is increased in the current direction

n this example, in each intersection, only one is increased, regardless of the number of short positions when buying, and vice versa -
@khalids222 Very hard to get your problem. Do you want a seperate sequence per buys and sells?
Like Buy 0.10, 0.20, ...
Sell 0.10, 0.20, ... ?? -
No, I did not mean that, what I specifically want, when placing One per bar under the condition every time it occurs in the condition it will buy or sell, and here there may be three sale and one purchase or vice versa .
Suppose an example
1- sell 0.10 then 0.20 then 0.30
Three sell- occurred in this direction, after which the trend changed and became buy and one long position was opened
2- buy 0.40
So the total becomes sell =0.60 and buy = 0.40
In this case, even if the direction is correct, there will be a loss.
I want before opening the buy in this example.
It collects open total sales and only adds one buy to become 0.70 and sell 0.60
This is what I mean. -
@trader-philipps I MEAN THIS

-
@khalids222 I haven't tested it, but I'd do the following on the onTrade tab (regular use not after EA restart):

Have 2 variables and loop through all Buy and Sell trades and increase thevariable value by the lot size of the trade in the loop.
Once you have stored them, you may use the sell variable value + your increment (eg. 0.01) for buy trades and vice versa.If you restart your terminal you may need to let the calculation run as well somewhere if there are already open positions.
-
@trader-philipps
Please put it on the project directly, I couldn't . -
@trader-philipps WHAT IS THE VALUE CALCULATE TOTAL LOT SIZE ? PLEASE
-
@trader-philipps there any update please
-
@trader-philipps Unfortunately, it did not work.
-
@khalids222 Can you share your project, please? I don't have an example around as martingale/averaging style is not what I usually build.
-
-
@khalids222 Be more careful when creating your projects! Sample would have worked if you'd do what I did and write variables without spaces. Keep in mind that peopke help here voluntarily!
-
@trader-philipps Sure, I thank you for your efforts and appreciate your help.
I will try it -
@trader-philipps
With great regret, the same as the previous nothing has changed

-
@khalids222 Check this. It's closer but probably still not what you want.
0_1578175676774_CONSULTNANT FX.mq4
What happens if there are several sells and several buys?

This sequence is
Sell
Buy
Buy
Sell
Sell
Buy
SellWhich lot size each step should have?
-
@trader-philipps STANDARD LOT 0.01 I BUT 0.1 FOR TEST ONLY.
-
@trader-philipps said in How can I collect the latest open positions in the event of a trend change?:
Check this. It's closer but probably still not what you want.
What happens if there are several sells and several buys?
I PUTED ONE PER BAR BELOW CONDITION NOT ABOVE -
@khalids222 Could you please answer my question with concrete values? Otherwise I'm out of this thread!
-
@trader-philipps the value 0.01 .
-
@trader-philipps
First: I apologize for any behavior that has bothered you.
You and several people @roar @l-andorrà @ambrogio @ in this forum we follow with interest and learn from them.
In addition, your fingerprints are very impressive.
So we benefit from your experiences and opinions.
Second: I add a lot of modifications to the project every time.
In this project I want lot 0.01.
I appreciate your help and time