Navigation´╝ÜHome > Content >

russian20_HP.mq4

Time: 2017-05-05 | Download file:russian20_HP.mq4

//+------------------------------------------------------------------+
//|                           Copyright 2005, Gordago Software Corp. |
//|                                          http://www.gordago.com/ |
//+------------------------------------------------------------------+

#property copyright "Copyright 2005, Gordago Software Corp."
#property link      "http://www.gordago.com"



extern double lTakeProfit = 20;
extern double sTakeProfit = 20;
extern color clOpenBuy = Blue;
extern color clCloseBuy = Aqua;
extern color clOpenSell = Red;
extern color clCloseSell = Violet;
extern color clModiBuy = Blue;
extern color clModiSell = Red;
extern string Name_Expert = "Generate from Gordago";
extern int Slippage = 1;
extern bool UseHourTrade = True;
extern int FromHourTrade = 14;
extern int ToHourTrade = 16;
extern bool UseSound = True;
extern string NameFileSound = "alert.wav";
extern double Lots = 1;


void deinit() {
   Comment("");
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start(){
   if (UseHourTrade){
      if (!(Hour()>=FromHourTrade && Hour()<=ToHourTrade)) {
         Comment("Wait for the trade. Be patient, and you will make some money!");
         return(0);
      } else Comment("");
   }else Comment("");
   if(Bars<100){
      Print("bars less than 100");
      return(0);
   }
   if(lTakeProfit<10){
      Print("TakeProfit less than 10");
      return(0);
   }
   if(sTakeProfit<10){
      Print("TakeProfit less than 10");
      return(0);
   }

   double diClose0=iClose(NULL,30,0);
   double diMA1=iMA(NULL,30,20,0,MODE_SMA,PRICE_CLOSE,0);
   double diClose2=iClose(NULL,30,0);
   double diMomentum3=iMomentum(NULL,30,5,PRICE_CLOSE,0);
   double diClose4=iClose(NULL,30,0);
   double diClose5=iClose(NULL,30,1);
   double diClose6=iClose(NULL,30,0);
   double diMA7=iMA(NULL,30,20,0,MODE_SMA,PRICE_CLOSE,0);
   double diClose8=iClose(NULL,30,0);
   double diMomentum9=iMomentum(NULL,30,5,PRICE_CLOSE,0);
   double diClose10=iClose(NULL,30,0);
   double diClose11=iClose(NULL,30,1);
   double diClose12=iClose(NULL,30,0);
   double diMomentum13=iMomentum(NULL,30,5,PRICE_CLOSE,0);
   double diClose14=iClose(NULL,30,0);
   double diMomentum15=iMomentum(NULL,30,5,PRICE_CLOSE,0);

   if(AccountFreeMargin()<(1000*Lots)){
      Print("We have no money. Free Margin = ", AccountFreeMargin());
      return(0);
   }
   if (!ExistPositions()){

      if ((diClose0>diMA1 && diClose2>diMomentum3 && diClose4>diClose5)){
         OpenBuy();
         return(0);
      }

      if ((diClose6diMomentum15)){
            CloseSell();
            return(0);
         }
      }
   }
   return (0);
}

bool ExistPositions() {
	for (int i=0; i        

Recommend