Martingale Optimization

 

Hello in attach file you can view a martingale expert, my only suggestion is if anyone can change the code to take operation in this way;

.- if the first position is buy the second will be sell and thir buy and fourth sell etc etc (all depend of the max trades variable)

.- if the first position is sell the second will be buy and third sell and fourth buy etc etc. (all depend of the max trades variable)

Thanks in advance

Pedro Echenagucia

Files:
 

hello anyone can help with this optimization? thanks in advance

Pedro Echenagucia

 
pelele79:
Hello in attach file you can view a martingale expert, my only suggestion is if anyone can change the code to take operation in this way;

.- if the first position is buy the second will be sell and thir buy and fourth sell etc etc (all depend of the max trades variable)

.- if the first position is sell the second will be buy and third sell and fourth buy etc etc. (all depend of the max trades variable)

Thanks in advance

Pedro Echenagucia

Hi Pedro,

I don't really understand about your strategy. If the first is buy, second is sell, then third is buy, then ... once the TP is reach, how is the calculation the overall P/L?

For instance: pip=20 tp=25 no progression (always 0.1lot):

BUY-SELL-BUY = +5

BUY-SELL-BUY-SELL = -30

BUY-SELL-BUY-SELL-BUY = -25

BUY-SELL-BUY-SELL-BUY-SELL = -80

Thus, the end result is always minus

Could you explain it in more detail please? Thanks.

Cheers,

 

Well the idea is this, for example

the first buy (0,1 lot), sell(0,2 lot) and so on, believe me the only modification will be that the expert dont take only buys or only sell, i want that anyone change the code ... for me this will be the an excelent system. Manually work perfectly but is very dificult follow it.

thanks for your reply.

Pedro Echenagucia

wibitiens:
Hi Pedro,

I don't really understand about your strategy. If the first is buy, second is sell, then third is buy, then ... once the TP is reach, how is the calculation the overall P/L?

For instance: pip=20 tp=25 no progression (always 0.1lot):

BUY-SELL-BUY = +5

BUY-SELL-BUY-SELL = -30

BUY-SELL-BUY-SELL-BUY = -25

BUY-SELL-BUY-SELL-BUY-SELL = -80

Thus, the end result is always minus

Could you explain it in more detail please? Thanks.

Cheers,
 

these are lines 107 and 108 of the EA

if(OrderType()==OP_BUY) MyOrderType=2;

if(OrderType()==OP_SELL) MyOrderType=1;

if you will just reverse the MyOrderType= (2 reversed to 1, 1 reversed to 2)

it might just work.

 

show statement if this works...at least 1 month forward test

 
pelele79:
Hello in attach file you can view a martingale expert, my only suggestion is if anyone can change the code to take operation in this way;

.- if the first position is buy the second will be sell and thir buy and fourth sell etc etc (all depend of the max trades variable)

.- if the first position is sell the second will be buy and third sell and fourth buy etc etc. (all depend of the max trades variable)

Thanks in advance

Pedro Echenagucia

HI

here you are.I modifyed and attached the ea for you.if you want to the ea start with sell ,set "firstorder=1" and if you want the ea to start with buy ,set "firstorder=0"

Files:
 

Let me explain better (my english is not good), for example:

currency eur\usd

price: 1,3000

buy 1 lot 1,3000 the price goes to 1,2985 then sell 2 lot 1,2985 the price move to 1,3000 again then buy 4 lot 1,3000 the number of trades depend of the variable MAXTRADES and the pips into buy and sell depend of the variable PIPS.

i hope that anyone can change the code.

regards

Pedro Echenagucia

pghiaci:
HI here you are.I modifyed and attached the ea for you.if you want to the ea start with sell ,set "firstorder=1" and if you want the ea to start with buy ,set "firstorder=0"
 
pelele79:
Let me explain better (my english is not good), for example:

currency eur\usd

price: 1,3000

buy 1 lot 1,3000 the price goes to 1,2985 then sell 2 lot 1,2985 the price move to 1,3000 again then buy 4 lot 1,3000 the number of trades depend of the variable MAXTRADES and the pips into buy and sell depend of the variable PIPS.

i hope that anyone can change the code.

regards

Pedro Echenagucia

ok

but that's not a martigale any more.

I attached an ea for you.this ea has a topic in this site.you can find it.

Files:
sam_step.mq4  13 kb
 

i need help

anyone can see the code in the first post and change it, the experts take only buys or only sells usng martingale progression, i need that the expert using the same code put intercalate positions.

please thanks in advance

Regards

Pedro Echenagucia

 

Hello Pedro,

I developed and tested many systems like what you are looking for. This is what I found to be true:

A system like this works great in a strong trending market.

A system like this will blow your account in a flat market. It doesn't take long for your 0.1 lot to be 25.6 lots! That's only about 8 times that it switches from long to short doubling each time. You would need a huge account balance to sustain this.

Just something to think about.