Idea: close profitable trades with opposite loss trade (antimartingale enabled)

Avatar
  • updated
  • Completed

Hello Community!

The EA is called: Close Minus by Plus. You can find it in the mql5.com store (I don't know if it is allowed to add links to other EAs) Exp5 Close Minus by Plus for MT5.ex5. This EA is in charge of managing open orders, closing 1 order with higher negative amount, for several orders that have higher positive amount.

That is, if you make purchases and sales in both directions, and there is a strong trend, the EA closes orders after several orders in positive for an order with a greater negative amount, regardless of whether they are purchases or sales. On reversals, it still closes the order with the largest negative amount for several positive orders.

Unfortunately, with CP I have tried to implement it, but without success. CP comes close to what the EA does, but when there are reversals (entries with Anti-MartinGala), CP closes them. That's why I wanted to expose my idea and evaluate it.

This is my .set: CP MT5 - Fixed lot 0.01.set  <<--- For CENT account. You will see that for example: In a downtrend where there are MartinGale entries (BUYS), when the price starts to make a reversal, CP opens Anti-MartinGale orders (SALES), but the CommunityPoweb closes them to me, and I don't want that to happen, I have tried a thousand ways, but it always closes them. The idea is to keep them open, so that if the price goes down again, there are already those SELL orders open, to keep closing the BUY orders that go with negative amounts.

I hope the idea is understood.

Avatar
1
Michel
Quote from Andrey Khatimlianskyi

Thanks for the update. I've checked your set.

1) TrailingStop closes 1st trade very fast, so it can't reach enough profit to close opposite lose.
Antimartingale doesn't work either because of TS.

2) Lot is minimal (0.01), so "Min part of losing order to close (%)" can't help (only full loss order can be closed, but it's lot the same as opposite lot so it's loss always bigger than opposite profit)

3) "Allow close both ways" disabled, so Partial close works only if profitable trades number < loss trades number.

4) You also use "Global Account TrailingStop" that closes all trades in some cases.

You made very complicated set and I'm not sure you understand how it works ))

If you disable Trailing and enable "Allow close both ways", it starts to close hedge partially, but in very strange manner.

But I don't understand how do you want it to work, so I'm not sure that this is wrong behavior.

Please, try to enable "Allow close both ways" and tell me what do you want to fix (how it works and how it have to work).

It closes hedge orders partially even with all other settings like in your set.

OKey!!

1- TrailingStop I put it just to test. But for me it is irrelevant to use it. I also tested without enabling this option.

2- The intention is to use order openings only at 0.01 or 0.1 or 1 fixed lots. And the closings, to total or partial closings. In the case of orders at 0.01, it would obviously be at full closes.

3- I do not understand this point very well. Anyway, at the end I will explain the correct way of what I am looking for and that personally I think it is one of the best ways to operate the GRID.

4- The same as point 1, I put it just for testing. I also tested without enabling this option.

"You made a very complicated set and I'm not sure you understand how it works))" A: Yes, I understand. I do understand CP but not 100%. The learning curve is higher than the usual EAs I have worked with.

EXPLANATION: The intention is to ALWAYS eliminate NEGATIVE orders FIRST and take small profits.

Please try this .SET CP MT5 - SystemGRID - Fixed lot 0.01 - Prof....set Take profit for each close is 0.1$. The test was done with:

Broker: RoboForex MT5
Account type: CENT
Pair: GBPUSD
Timeframe: M5
Exact date: 2021-10-03

In BlackTesting, it proceeds as follows:

Point 1: The price goes down, and the CP closes several SELL orders with positive amounts, for a buy order with higher negative amount. Good!!!

Point 2: Then the price goes up, leaving 3 open orders. As the price rises, CP closes 2 buy orders: 1 with negative amount and one with positive amount, taking the $0.1 profit, but leaving the SELL order that has a LARGER amount with no chance to close.



How should CP close at point 2? He should wait for the price to go up, and close the SELL order that is more in danger. As indeed the price did: It went up enough to be able to close the sale, but as CP closed the previous positive purchases, it cannot, and now we would have to wait for the price to go much higher to be able to close the sale that has a high negative amount.

This does not happen with few orders, it also happens with many more orders, causing the account to burn out.

There is a great potential behind this way of trading. I hope it has been understood, my head hurts from so much explaining. Successes!

Avatar
0
Andrey Khatimlianskyi

I've renamed the topic to better match the idea behind it.

Avatar
0
Andrey Khatimlianskyi
Quote from Michel

I assume you are referring to the .set file with the configuration. I have posted the .set in the main post above. Here is the direct download link: https://communitypowerea.userecho.com/uploaded/file/30028/1/478/c9c9bc254d3fc74f968485831458d4d2.set

Thanks for the update. I've checked your set.

1) TrailingStop closes 1st trade very fast, so it can't reach enough profit to close opposite lose.
Antimartingale doesn't work either because of TS.

2) Lot is minimal (0.01), so "Min part of losing order to close (%)" can't help (only full loss order can be closed, but it's lot the same as opposite lot so it's loss always bigger than opposite profit)

3) "Allow close both ways" disabled, so Partial close works only if profitable trades number < loss trades number.

4) You also use "Global Account TrailingStop" that closes all trades in some cases.

You made very complicated set and I'm not sure you understand how it works ))

If you disable Trailing and enable "Allow close both ways", it starts to close hedge partially, but in very strange manner.

But I don't understand how do you want it to work, so I'm not sure that this is wrong behavior.

Please, try to enable "Allow close both ways" and tell me what do you want to fix (how it works and how it have to work).

It closes hedge orders partially even with all other settings like in your set.

Avatar
0
Michel
Quote from Andrey Khatimlianskyi

Please, attach your tester ini with "Close main series by opposite main series" option enabled.

I'll check it.

I assume you are referring to the .set file with the configuration. I have posted the .set in the main post above. Here is the direct download link: https://communitypowerea.userecho.com/uploaded/file/30028/1/478/c9c9bc254d3fc74f968485831458d4d2.set

Avatar
0
Andrey Khatimlianskyi
Quote from Michel

Hello Andrey. Believe me, I tried all possible combinations, and the same thing happens. What Ulises said in 3 previous posts: https://communitypowerea.userecho.com/en/communities/1/topics/427-idea-implementation-of-this-ea-in-communitypower?redirect_to_reply=2735#comment-2735 is where the changes should be made.

Sorry, it is very confusing for me to indicate with certainty where to make the change among so many functions. I am just getting to know CP for a few days. But it would be a nice feature for CP and those of us who operate in GRID, adding the EA concept I mentioned at the beginning.

Please, attach your tester ini with "Close main series by opposite main series" option enabled.

I'll check it.

Avatar
0
Michel
Quote from Andrey Khatimlianskyi

Michel,

Seems you need "Hedge: Close main series by opposite main series" option.

Try to use it with your set and let me know how it goes.

Hello Andrey. Believe me, I tried all possible combinations, and the same thing happens. What Ulises said in 3 previous posts: https://communitypowerea.userecho.com/en/communities/1/topics/427-idea-implementation-of-this-ea-in-communitypower?redirect_to_reply=2735#comment-2735 is where the changes should be made.

Sorry, it is very confusing for me to indicate with certainty where to make the change among so many functions. I am just getting to know CP for a few days. But it would be a nice feature for CP and those of us who operate in GRID, adding the EA concept I mentioned at the beginning.

Avatar
0
Andrey Khatimlianskyi
  • Under review

Michel,

Seems you need "Hedge: Close main series by opposite main series" option.

Try to use it with your set and let me know how it goes.

Avatar
0
Michel
Quote from Ulises Cune

This is already done by CP when using GRID, but it doesn't work when using Anti-Martingale. I think you are proposing that it also works with Anti-Martingale.

In the first image you can clearly see how it closes losing positions with SELL winners. and in the second you see those of BUY

https://communitypowerea.userecho.com/en/communities/1/topics/422-grid-strategy?redirect_to_reply=2703#comment-2703


Base GRID

https://communitypowerea.userecho.com/en/communities/4/topics/144-base-grid

Yes, I think you are right, the change would be in the Anti-martingale option, although I am not entirely sure. I think CP closes orders by time, i.e. the one that has been open the longest and not the one with the largest negative amount.

Thanks for checking where the possible change needs to be made.

Avatar
1
Ulises Cune

This is already done by CP when using GRID, but it doesn't work when using Anti-Martingale. I think you are proposing that it also works with Anti-Martingale.

In the first image you can clearly see how it closes losing positions with SELL winners. and in the second you see those of BUY

https://communitypowerea.userecho.com/en/communities/1/topics/422-grid-strategy?redirect_to_reply=2703#comment-2703


Base GRID

https://communitypowerea.userecho.com/en/communities/4/topics/144-base-grid

Avatar
0
Michel
Quote from andrei rossi
Hello... So, as I understand it, I use a similar strategy... Let's imagine the following: I have several positions with increasing buy lots that are already losing money. The first OP that was opened is already far away from the market price... When the last OP has a slightly higher profit, the more distant OP is closed together with the OP that is in profit... In this way, I can eliminate more quickly the series of OPs that is open.

Hello Andrei. I do not recommend trading with MartinGale, because sometimes larger orders are left halfway, and another (negative) order is left further away from the price with a smaller amount, and it can be complicated to close that order. If you add this function to CP, you could study more thoroughly the MartinGale, because you would use the BackTesting.

Let me explain. Downward trend:

A- Buy

B- Sell

C- Buy

D- Sell

E- Buy

F- Sell

G- Buy

H- Sell

The EA closes the first 3 positive sales (B-D-F) and the Purchase with the highest negative amount (A). The orders C-E-G Buy and H Sell remain open.