//////////////////////////////////////////////////////////////////// // myfxovereasy.mq4 // ver. 1.0.1 // 2008 http://earnforex.com //////////////////////////////////////////////////////////////////// // Based on combined FXOverEasy indicators. High CPU usage! // Sometimes high profits can be interrupted with a row of losses. // Don't trade with more than 2% of your total margin. //////////////////////////////////////////////////////////////////// #property copyright "EA myfxovereasy www.earnforex.com 2007" /* Parameters are optimized for EUR/USD M15 chart and $1,000 account */ extern int TakeProfit = 160; extern int StopLoss = 110; extern double Lots=0.1; extern double Slippage = 3; extern int ComboTriggerLevel = 6; // Can be 6 or 8 extern bool OnlyTradeFullBars = true; extern color clOpenBuy = Blue; extern color clOpenSell = Red; int Magic; //EA magic number int LastBars = 0; //Last number of bars in chart double Poin; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //Checking for unconvetional Point digits number if (Point == 0.00001) Poin = 0.0001; //5 digits else if (Point == 0.001) Poin = 0.01; //3 digits else Poin = Point; //Normal Magic = Period()+103605052008; return(0); } //+------------------------------------------------------------------+ //| Start of the EA Heder | //+------------------------------------------------------------------+ int start() { int result, lookupidx; //Intermediate variables if (LastBars == iBars(Symbol(), 0)) return(0); //If no new bars formed since last iteration else LastBars = iBars(Symbol(), 0); //Update LastBars if ((TakeProfit <= 0) || (StopLoss <= 0)) //Check TakeProfit and StopLoss validity { Print("TakeProfit and StopLoss should be greater than 0."); return(0); } if(AccountFreeMargin()<(1000*Lots)) //Check free margin { Print("We have no money. Free Margin = ", AccountFreeMargin()); return(0); } if (OnlyTradeFullBars) if (Volume[0]>1) return(0); //Skip partial bar else lookupidx= 1; //Look at the values of the previous bar (recently completed bar) else lookupidx= 0; int graylevel = iCustom(NULL, 0, "FXOE-Combo", 0, lookupidx); int redlevel = iCustom(NULL, 0, "FXOE-Combo", 1, lookupidx); int greenlevel = iCustom(NULL, 0, "FXOE-Combo", 2, lookupidx); if (greenlevel != 0) result = greenlevel; else if (redlevel != 0) result = redlevel; else result = 0; if (result >= ComboTriggerLevel) fSell(); //Short if (result <= -ComboTriggerLevel) fBuy(); //Long return(0); } //+------------------------------------------------------------------+ //| Buy | //+------------------------------------------------------------------+ void fBuy() { int result = OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Ask-StopLoss*Poin,Bid+TakeProfit*Poin,"myfxovereasy",Magic,0,clOpenBuy); Print("Long: ", Ask); } //+------------------------------------------------------------------+ //| Sell | //+------------------------------------------------------------------+ void fSell() { int result = OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Bid+StopLoss*Poin,Ask-TakeProfit*Poin,"myfxovereasy",Magic,0,clOpenSell); Print("Short: ", Bid); }