WNW
632
WNW  
wolfe:
I'll work on this next. This part will be new for me. Anyone have ideas or examples?

I've attached an EA that uses money management.

You'll want to follow the "Risk" variable (% of account that will determine lot size). Sorry I can't be of more help, my coding skills are pretty limited.

Files:
jlpigrid.mq4  8 kb
matrixebiz
1631
matrixebiz  

I have two identical EA's, except one has Money Management added.

This is the only the code that was added when compared the two;

extern bool UseMM = true; // 1 = true & 0 = false

extern double Risk = 5; // percent of account equity to risk per trade

[/code]

and

[code]

// ====== Money Management of Lot Size routine ======

if(UseMM)

{

Lots=AccountEquity()* Risk/100/1000;

if( Lots>0.1 )

{

Lots=NormalizeDouble(Lots,1);

}

else

Lots=NormalizeDouble(Lots,2);

}

Hope it helps

wolfe
1037
wolfe  
Cijas:
Found something strange in my live trading (version 1.4 this time) in GBPJPY.

This morning (9:33) EA open a 0.01 buy at 212.25 with NextTrade at 100 pips and SL of 10% and TP of 1 % the

At 14:35 EA open an other buy trade of 0.02 at 213.35.

At 14:48 EA close with profit my first trade (0.01) at a price of 213.40.

Ea only closed this trade not the second trade ?!

At 15:08 EA open a sell trade (0.03) at 212.35.

I am surprise that EA open the second trade (0.02) at 213.35 and not at 213.25 --> i choosed a slippage of 8 pips not 10 ?

I am more surprise that the TP was only for one trade and didn't close all orders.

Do you know why wolfe ?

Cijas,

Could you post the statement to look at? Also, post the trade journal. Were there any errors in the journal?

I'm not too concerned with when your Next_Trade was hit. Next_Trade will execute when current price is >= (greater than, or equal to) your last open + Next_Trade for buys, or for buys, or < for sells) to fire an Ordersend() command. If the server context is busy, re-quoting in a fast moving market, or not responding, the EA will try up to 5 times to put your order through. When the order finally does go through, you may or may not be EXACTLY on your Next_Trade price. GBPJPY with it's high spread, and fast moving volitility, makes it a good candidate NOT to land it's Next_Trade exactly where desired.

A little more concerning to me is why ALL orders didn't close when your 1% TP was met. Out of curiosity, what does 1% work out to.

The EA closes orders by identifying them by their magic number, it doesn't just close ALL open orders because you may have EA attached to more than 1 chart. Each currency pair is assigned it's own magic number for this purpose. In v1_5 (currently working on) I will try to address this issue.

What happened to you is all the orders didn't close, only one did. Then the EA looked at the last order placed (0.2) and when the conditions were met is added to that (0.3). In the next version I will put in some more fail safe measures to try and fix this problem.

wolfe
1037
wolfe  
WNW:
I've attached an EA that uses money management. You'll want to follow the "Risk" variable (% of account that will determine lot size). Sorry I can't be of more help, my coding skills are pretty limited.

Thanks WNW, I'll check this out when I get home tonight. Should help.

wolfe
1037
wolfe  
matrixebiz:
I have two identical EA's, except one has Money Management added.

This is the only the code that was added when compared the two;

extern bool UseMM = true; // 1 = true & 0 = false

extern double Risk = 5; // percent of account equity to risk per trade

[/code]

and

[code]

// ====== Money Management of Lot Size routine ======

if(UseMM)

{

Lots=AccountEquity()* Risk/100/1000;

if( Lots>0.1 )

{

Lots=NormalizeDouble(Lots,1);

}

else

Lots=NormalizeDouble(Lots,2);

}

Hope it helps

Thanks matrixebiz,

Shouldn't be too hard to figure out.

Everyone realizes that MM will only effect the first order of a cycle right?

wolfe
1037
wolfe  
Neo:
One of the things I've noticed is that we get further and further away from the goal as more positions are opened as each adds another "spread" to the floating loss which makes the job of catching up progressively harder as price then needs to move much further in a given direction without a reversed entry to have any hope of closing the series.

Not sure how best to overcome this issue but it will blow up the account at some point if left unchecked. This is especially a problem with wide spread pairs like GJ.

I've tried using a very small lot increment and this does help but the account will still blow at some point.

Thinking caps on, guys!

I agree with your statements Neo.

There needs to be some additional strategy put into play here.

Who has a possible solution?

Almos
12
Almos  
wolfe:
I agree with your statements Neo.

There needs to be some additional strategy put into play here.

Who has a possible solution?

What if starting the trades in hedged form (I guess who uses this EA, TakeProfit is lower than the Next Trade parameter and this causes the main "getstuck"-problem).

So two "lines" would run at the same time. First starts with buy, second with sell. If one starts struggling in Buys-Sells, the second takes a win until that time.

And somehow maybe they could be optimised to each other (CloseAllTrades). Just an idea. Would it work?

[Deleted]  

I am waiting for the directional input to be in v1.5, where I can specify Long or Short as the initial opening (Then use long only or short only in conjunction with this)...Then I am going to use some indicator to give me a bias and use close-all and autorestart to false...with a basket of four non correlated pairs.

I may or may not utilize increments...I have not decided yet...I will prolly' test with increments first...

ES

WNW
632
WNW  

As long as you persist in using ANY lot incrementing you'll run into trouble.

Don't use any and widen your grid.

wolfe
1037
wolfe  
ElectricSavant:
I am waiting for the directional input to be in v1.5, where I can specify Long or Short as the initial opening (Then use long only or short only in conjunction with this)...Then I am going to use some indicator to give me a bias and use close-all and autorestart to false...with a basket of four non correlated pairs.

I may or may not utilize increments...I have not decided yet...I will prolly' test with increments first...

ES

Already have external variables Start_Long_NOW and Start_Short_NOW coded into v1_5.

Explain your (Then use long only or short only in conjunction with this)...

Do you want this coded into the EA, or are you wanting to just select this when you attach the EA to a chart?