EA with MM request?

 

Any coder up for it?

THE EASY PART:

The basic is simple breakout of Xpips above and below user adjustable close price. For example the close price of the 07:15 candle. This will then initiate a stop buy/sell at x pips above and below this price(net-including spread. If spread is 2 pips and x=20 the buy will be at close + 22 and the sell will be at close - 20, I think) The stop should also be user setable for y pips and should include the spread for buy/sell, ie: Set to 20 pips this will include the spread for the specific pair. The TP will be the same user selectable and will give a net of the user selected pips, ie, if set to 30 this will be the total after spread considerations.

The pending orders will stay active for a 24 hr period and will then be adjusted according to the new close price. Any active orders at such time will stay active till stoped at loss or profit. New orders/trade may be entered into in the same direction as any open trades for the next period. Trades are only exited at tp or sl.

New orders are placed when stoped at loss or tp and a retrace to within z pips of the specified stoploss. If it was a buy and got stoped for a loss or the tp got hit and retaced to within z pip from the stop price level(here there is no need for spread considerstions) a new buy stop order is placed with same sl and tp.

All the above conditions is true till new time candle close. Any active trades should stay open till tp or sl is hit and it might hapen that a new order will fall within this range. This will entail that a new order will be executed and handled as a entity on it's own.

Wow, I hope I managed to explain that to an understandable degree.

THE DIFFICULT PART.(MM)

Now it really get interesting. And I know I am going to get a lot of flak for this. MARTINGALE but hereinto refered to as AMM.

The idea is to get an avarage of y pips per trade. This will differ per trader according to the settings above or for what ever strategy you use. The premise I am aiming for is that if the stategy was properly backtested(manually) and proven to have a longest losing streak of ie.4 in a row and your aim was 10 pips per trade with a stop of 10 pips (including spreads and all) you could still trade the forth trade to make up for all the losses plus the profits that you should have gained, were all the trades profitable the first time round.

Starting Size: 1 MiniLots.

TP: 5 Pips net.

SL: 15 net.

Total Lost Trade Size Potential

Seq. Pips MiniLots Pips

1 0 1 5

2 25 5 10

3 90 18 15

4 290 58 20

5 895 179 25

6 2715 543 30

(Seq = trade number, Total Lost Pips = lost on previous trade+tpPrevious+tpnow, TradeSize = minilots to get were I should be, Potential Pips = Where I should be.)

Remember that the edge is in your favour as you have tested this already. Now to give even a greater return for the risk is to multiply the next level of lots to trade with a factor of the equity avilable so as to exponentialy increase the profit potential on each successive trade. Obviously the risk increase but so does the chance of a loss decrease and we are increasing the potential gain exponentially on every loss but still taking into account the previous losses and available equity(I hope I am still making sense here-it is early in the morning?) the aove is just illistrating the traight increase and no factor involved but it shows that there is potential in this type of martingale.

Obviously this should all be applied to an account that could hold at least double the expected losing streak and at this level still be within an acceptable level of risk to the account.

This will then be sort of a progressive martingale system and I would like the option of applying this MM to the above strategy.

I have tested the above strategy with a TP = 5 pips(net) and SL = 15 (net) with the reentry criteria, trading 24/7 over a 5 month period(2006/06/01 - 2006/10/31). I did not look at the data just started applying the rules and now realized that it was range bound period and still show very promising results applying the above mentioned AMM with a 1to3 ratio:

30min Chart. ( I also Assumed that when i had a bar extending over both my TP and SL levels it will be 1 losing trade and 1 winning trade irrespectave of the previous trade outcome)

Number of trades: 686

Losing trades: 85

Winning trades : 601

Winning %: 87

Max consecutive losers : 3(7 times in 12 months)

Max DrawDown : 60pips total

Trading days: 12 months

Using above MM: +3430 pips ( remember,every trade is a winner using above explained AMM)

I am busy testing the rest of my data till the most recent and will update when done. Now updated to reflect the last 12 months.

If I had just taken the losses every time I would have been up only +1730pips (3005 pips won - 1275 pips lost), but using the AMM I am suggesting above converts every trade into a winner giving me close to 100% increase in profitability at +3430pips.

Will I trade this using real money? Most definitely. I will be a net winner if I stay with the program.

Now I know that the number of times I will be able to AMM will be directly impacted by my account size but this can still be managed to within acceptable risk parameters.

I do Hope some gurru coder can halp me with this.

Thank You

 

The market is unpredictable. If you suddenly have line 10 stoplosses and 0 wins with this money management, you won't feel good any more, trust me.

As for testing. If in a candle both TP and SL are hit, SL is ALWAYS hit first (MT4 strategy tester). Don't fool yourself, its not a 50/50 chance, its usually 90% for stoploss especially for TP of 5.

If your spread is 2, TP = 5, SL = 15 you will need:

3:1 winning ratio to stay on breakeven. That is 75% winning positions (yep, 75%, not 66% as some may think). Next, if you want profit to be made at profit factor of 3, you will need 9 consecutive wins and 3 consecutive losses. Since 3 losses was max for a small time period and you didn't take into consideration ability of SL being hit each time there was a TP and SL on one candle, we will think you do need 9 winning trades in a row.

Oh and besides all of this I already made a similar money management. The lot was calculated by this formula:

total loss to this point from the last profit + % of gain (we cover loss for 100% with new TP, and this % is additional gain, calculated as % of total loss).

Yeah, it covers all the loss of the previous series of loss with a new position and even gains profit. But if you set that gain % to a higher value than 30%, it blows your account.

As I've seen your % gain is much higher than 30%.

The funniest thing for this kind of money management is

You go for $3K risks to gain $0,3K profit.

Yes, you cover all expenses even if you have a 10 losing streak. But the important thing here is that you should be ready to lose your deposit the moment you invest into an EA with similar rules.

My point:

The only way to be profitable in the long term is constantly winning system, which generates profits in both ranging and trending market with a high winning ratio (over 75%) and average win higher than average loss.

Money management is a way to manage funds, not make them.

 

Shinigami

Thank you for taking the time to give a very decent reply. I have a 87% winning strategy and the back tests were done manually. I still would like to be able to apply this strategy and even with the 1:3 ratio I still get just over 50% of the pips taking the straight losses. If you could write me the EA with a normal MM of taking profit on the TP for a percentage of the position and then moving the stop to BE and trailing the remainder. This is a breakout strategy and more than 90% of the positions did move make decent moves past the TP when it was reached. The ea is to make it easier to test different combinations TP and SL and should I find something that made a significant increase I can then go and forward test for a period and compare to the backtest figures. I actually did take a loss when the bar reached over both TP and SL. I also asked that there should be an option for other MM types to be applied. The other way to do this is aplly the adapted Martingale for a max of three consecutive losses as the backtests showed max three in a row, then should it come to a forth the loss will be taken and the new stats would be used for future lot sizes and will then be able to cope with 4 consecutive losses still being in the % risk factor of the account in total. The record keeping facility would allow this strategy to addapt to the market as it experience this in real time.

Ie: Start with lot sizes to give 3% risk and 1 loser.

Lose 2 in a row 1st time, take the loss on 2nd loser, now readjust lot size to take into account 2 losers in a row still 3% risk.

Lose 3 in a row 1st time, take the loss on 3rd loser, now readjust lot size to take into account 3 losers in a row still 3% risk.

Lose 4 in a row 1st time, take the loss on 4th loser, now readjust lot size to take into account 4 losers in a row still 3% risk. and so on..........

Just some more thoughts on this.

Hope you would still be interested.

Reason: