How to increase 50% of the lot size of the last closed position?

 

Hi, everyone

I am trading in the US with a live MT4 account and need a help to make my strategy in EA.

Is it possible to increase the size of lot right after a position get closed in loss?

In order to increase 50% of the lot size of the last closed position I used the code following:

extern double MinusCloseLot = 50;

But just next positions were open in 50% increased lot size of initial position, Not Last Closed position. What I want is to increase 50% (or any otherpercentage) continually, for example, If 1 lot is closed in loss, then open 1.5 lot, and the 1.5 lot is closed in loss, then open 2.25 lot, which is 50% increased of thelost closed position, 1.5 lot.

I tried and searched for a time but couldn't find a solution. Please help.


 
Find the last closed position in the order history, check it's OrderProfit() to see if it closed at a profit or loss, if loss use it's OrderLots() multiplied by 1 + ( MinusCloseLot / 100 ) for the position size of your next order.

Let us know when you have blown your account ;-)
 
RaptorUK:
Find the last closed position in the order history, check it's OrderProfit() to see if it closed at a profit or loss, if loss use it's OrderLots() multiplied by 1 + ( MinusCloseLot / 100 ) for the position size of your next order.

Let us know when you have blown your account ;-)


Thank you for nice help

My strategy is combined with manual trading (Magicnumber=0). Only an initial position is open manually, since then, EA will close it with a specific pips of loss and open a new position in increased lot. Then if the new one is closed again with the same pips of loss, then another one will be open in consequently increased lot.

In this case, how could the code be added?

..

PS: I'm not gonna blow off my account, controlling risk, thank you.

 
tigres28:


Thank you for nice help

My strategy is combined with manual trading (Magicnumber=0). Only an initial position is open manually, since then, EA will close it with a specific pips of loss and open a new position in increased lot. Then if the new one is closed again with the same pips of loss, then another one will be open in consequently increased lot.

In this case, how can the code be added?

Without seeing any of your code I can only talk in general terms . . .

Find the last closed position, filter by symbol, unless your strategy is a portfolio type strategy, and then as I wrote above . . . I'm not sure what you are seeing as a problem in doing this ? can you explain ?

 
RaptorUK:

Without seeing any of your code I can only talk in general terms . . .

Find the last closed position, filter by symbol, unless your strategy is a portfolio type strategy, and then as I wrote above . . . I'm not sure what you are seeing as a problem in doing this ? can you explain ?

I just attached the code. Would you review and find what's wrong?
 

I'm sorry to post same topic twice, just began to use this forum and don't know how to use in detail.

 

I just want to show the MQL4 file but can't find how to do. SRC button is not available on my web brouser, Chrome.. I don't know.

 
RaptorUK:

Without seeing any of your code I can only talk in general terms . . .

Find the last closed position, filter by symbol, unless your strategy is a portfolio type strategy, and then as I wrote above . . . I'm not sure what you are seeing as a problem in doing this ? can you explain ?


Could you show me how to put MQL4 files or part of codes? Why is the SRC buttone not available on my web brouser? 
 
tigres28:

Could you show me how to put MQL4 files or part of codes? Why is the SRC buttone not available on my web brouser? 

The SRC button is just above the area where you type a new message . . .

 

Look at this post for more help:  https://www.mql5.com/en/forum/140334 

 

Scan history then if last trade is ours and is a loss check its lot size using e.g. double PrevLots=OrderLots();

double Lots=PrevLots+(PrevLots/2)

 
RaptorUK:

The SRC button is just above the area where you type a new message . . .

 

Look at this post for more help:  http://forum.mql4.comhttps://www.mql5.com/en/forum/140334 

Thank you, I got it
 
tonny:

Scan history then if last trade is ours and is a loss check its lot size using e.g. double PrevLots=OrderLots();

double Lots=PrevLots+(PrevLots/2)

Thank you, I'll try again
Reason: