Navigation´╝ÜHome > Content >

CoinflipwithMM.mq4

Time: 2017-01-10 | Download file:CoinflipwithMM.mq4

//+------------------------------------------------------------------+
//|                                          CoinflipwithMM          |
//|                                                                  |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|              External Variables                                  |
//+------------------------------------------------------------------+
   
extern int StopLoss             =   40;
extern int TakeProfit           =   43;
extern int    Slippage          =   3;
extern double Lots              =   0.1;





double MinLots, MaxLots, UseLots,BuyLots, SellLots;

int    NumBuys, NumSells;

int start()
{
  NumBuys  = 0;
  NumSells = 0;
  
  BuyLots  = 0.00;
  SellLots = 0.00;


  {
    OrderSelect(SELECT_BY_POS,MODE_TRADES);

    if (OrderSymbol() == Symbol()) 
    
    {
      if (OrderType() == OP_BUY)  NumBuys++;    
      if (OrderType() == OP_SELL) NumSells++;     
    }   
  }

   UseLots = Lots;
     
   if(MathMod(TimeCurrent()/60, 2)==0 && NumSells <1 && NumBuys <1) 
    {
      OrderSend(Symbol(),OP_BUY,UseLots,Ask,Slippage,Ask-StopLoss*Point,Ask+TakeProfit*Point,"CoinflipwithMM ",0,0,White);
      Print ("Errors opening BUY order = ",GetLastError());
      return(0);
    }
 
 
if ( NumBuys <1 && NumSells <1)
 
    {
      OrderSend(Symbol(),OP_SELL,UseLots,Bid,Slippage,Bid+StopLoss*Point,Bid-TakeProfit*Point,"CoinflipwithMM ",0,0,Red);
      Print ("Errors opening SELL order = ",GetLastError());
      return(0);
    }
   
 
//Screen comments         
  Comment("Balance: ", AccountBalance(), ", Equity: ", AccountEquity(), ", Lots: ",UseLots,
        
        "\nNum Buys: ", NumBuys, ", Num Sells: ", NumSells, ", BuyLots:", BuyLots, ", SellLots:", SellLots);
        

  return(0);
}

Recommend