Please help to make this Awesome EA! simple concept high win ratio

Hell Everyone,

So i was looking for consistency and patterns and came to one interesting concept that should work with a 80-90% win ratio with no DD ever.

Need help to create an EA to do the following if it is possible.

Looking at EURUSD the M5 TF

Every time you have 4 candlesticks of the same color/direction happen the EA will open a trade going the opposite direction of the 4 bars, for example when you have 4 candles close together all buy candles the EA would then open a sell entry with adjustable TP and SL, default for TP and SL should be 10 pips each (need to test this)
this will not produce a win during break out and news spikes, hence a SL is needed, however in ranging days this seems to be very consistent and won’t have any DD.

If anyone can add to this or create it that would be awesome. Thank you !

– edited –

OK, i created the EA and added some parameters so you can play with the settings. It let’s you define:

  • the number of consecutive candles you’re looking for
  • Stop Loss and Take Profit pips
  • Lot size
  • Multipletrades: if true it makes multiple trades at the same time. If false, it doesn’t.


You just need to attach the EA to the chart you want, in your case it would be the 5M EURUSD, but it will work for any currency pair and timeframe.

Unfortunately the backtest I did (year 2012) wasn’t profitable. Maybe with some tweaking you can improve your ideas. Let me know. Anyway, please test the expert before using in a real account. :slight_smile:

Here’s the expert:

merg357_4candlesticks.zip (6.04 KB)

– end edit –

Do you want the EA to open multiple trades at the same time if or only one trade at a time?

For example if there are 5 consecutive bulish bars, I open 1 trade after forth and a second trade after fifth bar?

What if there are 4 new consecutive bars while a trade is open?

This EA is easy, I will make it for you. :slight_smile:

2 Likes

Oh man you are Awesome!!!

Thanks so much, I will tweak these settings I know I can make this work. I will keep you posted!!! thanks again

Quick question though, I am trying to backtest it and it keeps showing blank results…any idea of what iam doing wrong here?

was getting ordersend error 130 think i fixed it now but doesn’t seem to be triggering code to TP in back test , will keep playing with it

Averied,

Check this OUT! I changed candles to 3 consecutive and SL to 100, TP 10, with .1 lots and Multitrades to TRUE, look at the drawdown.

Bars in test 26420
Ticks modelled 3706183
Modelling quality 90.00%
Mismatched charts errors 0
Initial deposit 10000.00
Total net profit 524.90
Gross profit 14746.50
Gross loss -14221.60
Profit factor 1.04
Expected payoff 0.18
Absolute drawdown 22.90
Maximal drawdown 430.60 (4.07%)
Relative drawdown 4.07% (430.60)
Total trades 2900
Short positions (won %) 1469 (51.60%)
Long positions (won %) 1431 (50.24%)
Profit trades (% of total) 1477 (50.93%)
Loss trades (% of total) 1423 (49.07%)
Largest
profit trade 10.00
loss trade -10.00
Average
profit trade 9.98
loss trade -9.99
Maximum
consecutive wins (profit in money) 11 (110.00)
consecutive losses (loss in money) 10 (-100.00)
Maximal
consecutive profit (count of wins) 110.00 (11)
consecutive loss (count of losses) -100.00 (10)
Average
consecutive wins 2
consecutive losses 2

Error 130 means invalid stops. Depending on the broker, the number of decimals, lot size etc. changes.

Try playing with the SL, TP and Lots. Maybe instead of SL= 10 you need to use 100 in your broker. I tested it correctly, let me know if you get it working.

Check in the trade tab if the SL and TP values of each order are the ones you actually want.

Well guess you got it working then. I will check this stats later and do further backtesting.

Is it at least working as you expected?

with some more tweaking this will work well, can wait to demo it!! thanks again
I will keep you posted.

Yes!! in backtest thus far, will have to wait until tomorrow to demo it but I have a good feeling that it will be profitable, i will look into other more volatile pairs too to find candle patterns.
Lets make some money!

Hi Averied,

Alrighty, day 1 demo tested. Not so great, i want to reverse the code now and enter to same direction versus opposite, Ive tried to edit the code myself but it will not work; please see below, can you see what I am doing wrong here?

if (Close[i] < Open[i])
{
cbarsbear++;
beartxt = "Consecutive bearish: " + DoubleToStr(cbarsbear,0);
ObjectSetText(“txtcbear”,beartxt,9, “Verdana”, Red);
}
else
{
cbarsbear = 0;
beartxt = "Consecutive bearish: " + DoubleToStr(cbarsbear,0);
ObjectSetText(“txtcbear”,beartxt,9, “Verdana”, Red);
}
if (Close[i] > Open[i])
{
cbarsbull++;
bulltxt = "Consecutive bullish: " + DoubleToStr(cbarsbull,0);
ObjectSetText(“txtcbull”,bulltxt,9, “Verdana”, Green);
}
else
{
cbarsbull = 0;
bulltxt = "Consecutive bullish: " + DoubleToStr(cbarsbull,0);
ObjectSetText(“txtcbull”,bulltxt,9, “Verdana”, Green);
}
}
if (cbarsbear == candlesticks)
{
OrderSend(Symbol(),OP_SELL,Lots,Ask,3,Ask-SLpipsPoint,Ask+TPpipsPoint,“4candlesticks”,16384,0,Green);
}
if (cbarsbull == candlesticks)
{
OrderSend(Symbol(),OP_BUY,Lots,Bid,3,Bid+SLpipsPoint,Bid-TPpipsPoint,“4candlesticks”,16384,0,Red);
}
}

return(0);
}

void delay(int speed)
{
if(IsVisualMode()==true)

{

  int Waitloop = 0;

  while(Waitloop &lt; speed)
  {
  //Comment("Wait Loop Count = ", Waitloop); 
  Waitloop ++;
  }

}
}

Also had one other idea, is it possible to write a code that would identify a single candle that closes above a certain number of pips? For example, code an entry for a candlestick that closes say over 60 pips, if a bull candle closes above 60 pips place a buy entry OR if a single candle hits 50 pip movement an entry is placed for 10 Pip profit going the same direction.

What do you think?

thank you

merg357_4candlesticksV2.zip (6.29 KB)

OK, I’ve added a new parameter to the EA. Now you can set “tradeopposite” true or false, so you can get the behaviour you want. Haven’t tested it though.

OrderSend(Symbol(),OP_BUY,Lots,Bid,3,Bid+SLpips*Po int,Bid-TPpips*Point,“4candlesticks”,16384,0,Red);

I think that space in Point might be the mistake, but not sure if there’s something else wrong.

Good luck! Let’s see if I get the time to implement your second idea.

so far backtesting these is not going so great :(. I did find consistent profits with the following settings using version one of this EA
Sl 600
Tp 400
Daily TF , 3000k balance to start
80% win
3 bars consecutive then one opposite direction.

BUT i have the solution!!!
Here is a consistency that is true 99% of the time, we just have to play with the settings to find the right TF and number of pips. It should be really simple;
Whenever a candle closes that is over XX (number of pips) an entry is place in the opposite direction with adjustable TP and SL, you would have to look at TF from M5 and up, preferably higher TF, just looking at the charts you can see that this is almost always the case that there is a retrace of an average of 25% and in some cases the full candle on the H1 TF.

What do you think my friend? this is the golden ticket here !!!

OK boss!! Let’s go for the golden ticket!! :slight_smile:

I’ve added a new parameter to the EA Version 3, InstantTradePips.

If you put:

candlesticks = 1
InstantTradePips = 50, It will do what you say. If one bar is 50 pips up or down, it will make a trade.

You can still set “tradeopposite” parameter for this!

Good luck! :wink:

merg357_4candlesticksV3.zip (5.76 KB)

1 Like

thanks for that my friend, very frustrating with the backtest it just seems like no matter what i change the results are all the same

Is it possible to have an EA place a trade on a candle while its open, say on a breakout for a M5 TF, it moves 50 pips in one direction then opens a trade on that same candle to make a small 10 pip profit?

OK… added a new parameter in EA. “mode”

if mode = 1, it will check for InstantTradePips in the open candle. Also don’t forget to put the tradeopposite parameter. In this mode you must put mutipletrades = false, or it will be a disaster! :slight_smile: Will try to add something to control this later.

if mode = 0, it will work like Version 3.

Try it out, haven’t tested!

Good luck!

merg357_4candlesticksV4.zip (6.75 KB)

1 Like

My friend, you are a god among men!!!

I have come to realize that mt4 backtest with strategy tester is rubbish. However, demoing this latest improvement shows an amazing amount of promise. it will take a bit of time to tweak it for higher RR but I like it.
What are your thoughts, any ideas on how we can improve this?

On a side note, i use the attached indicator to detect surges in the market and would be awesome if there was anyway to add it or make EA that places a trade when this triggers? Using 4 digit one…
Once again, you are then man…I trying to learn how to do this myself, I tried to play with the editor in mt4 but its proving a challenge, not sure how to add or edit indicator

LOL I put on mutilple trades= true on the demo account and I see what you mean…it was awesome it placed like 30 trades in 10 seconds

Alright my friend, I really need to learn how to do this. How do I convert a custom indicator into a EA?
I have figured out how to eliminate some false signals here using our EA if we can incorporate an indicator showing movement or trend direction. I have some of these but don’t know how to add them.
I have figured that if general trend is UP you can use our EA to place an bull trade after 3 bear trade candles have been closed. this will result in small profit but consistent, what do you think?