Experts: Simplest Hedging EA ever

 

Simplest Hedging EA ever:

This EA simply opens two opposing positions at the beginning of the first new bar it comes across. Both positions can win lose or draw. Works best in 5M timeframe and can be optimised using "Open prices only".

Author: Monu Ogbe

 
Very interesting concept-I have backtested and looks decent-what motivated this idea/strategy? Daniel
 
forexman05:
Very interesting concept-I have backtested and looks decent-what motivated this idea/strategy? Daniel

Thanks forexman.

The motivation? Well, according to secondary school statistics if you roll a dice you have a 1:6 chance of predicting the outcome. If, however you roll two dice, the odds are not 1:12, but 1:36. If you posit that each indicator has a specific statistical chance of predicting an outcome the more indicators you use, the worse the odds! Of course I'm being simplistic, but it has led me to start thinking very hard about finding a minimalist approach to trading - starting with no indicators at all!

As for the backtesting results, you will find that the EA works if the market is consistent; i.e., if optimised for a gentle or steep rising or falling market, it continues to work while the market retains that profile. I guess one could look for a long term trend, optimise for the last few days of that trend and set the robot off UNTIL the trend changes. Be careful! :)

Monu
 
hi,
nice idea, but, you made a mistake reguarding the coding.

your code:
int start(){
   if (last_bar == Bars) return(0);
   last_bar = Bars;
   if (OrdersTotal() == 0){
         OrderSend(Symbol(), OP_BUY, lots ,Ask, 3, Ask - stop_loss * Point, Bid + take_profit * Point, IDENT, MAGIC, 0, Blue);
         OrderSend(Symbol(), OP_SELL, lots ,Bid, 3, Bid + take_profit * Point, Ask - take_profit * Point, IDENT, MAGIC, 0, Red);
   } 
   return(0);
}
as you can see you have not the same SL/TP levels for BUY and SELL.
i assume this was not meant.

try this code
int start(){
   if (last_bar == Bars) return(0);
   last_bar = Bars;
   if (OrdersTotal() == 0){
         OrderSend(Symbol(), OP_BUY, lots ,Ask, 3, Ask - stop_loss * Point, Bid + take_profit * Point, IDENT, MAGIC, 0, Blue);
         OrderSend(Symbol(), OP_SELL, lots ,Bid, 3, Bid + stop_loss * Point, Ask - take_profit * Point, IDENT, MAGIC, 0, Red);
   } 
   return(0);
}
and let me know your results.
michael
 
Thanks Michael, you're correct, and I have fixed this in mo_bidir_v0_1.mq4. It works better :)
 
if (last_bar == Bars) return(0);
   last_bar = Bars;
This will stop working once you reach max bars on chart.
int start() {                    static Time0;
if (Time[0] == Time0) return(0); Time0 = Time[0];
 

Hi can email me the updated EA? i like to try. Thanks

ng_hans@yahoo.com.sg

Regards
Hans Ng

 
Hi Hans, I've uploaded the bug-fix (mo_bidir_v0_1.mq4). I thought I did that this morning, but I guess I'm not too clever with these computer machines :)
 
BTW, click the russian language link and xerofforex has done a 10-year back test - very amusing :)

 
WHRoeder:
if (last_bar == Bars) return(0);
   last_bar = Bars;
This will stop working once you reach max bars on chart.
Hi WHR, maybe the variable name is unclear. By "last_bar" I really mean the last bar that has been processed... i.e., the most recent apart from the current one :). Thanks for the thought, though!
 
I would certainly add a time-of-day filter and test trailing stops
Reason: