Navigation:Home > Content >

Palmuz.mq4

Time: 2010-05-21 | Download file:Palmuz.mq4

//+------------------------------------------------------------------+
//|                                                        Palmuz.mq4 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, vr."
#property link      "http://www.palmuz.ee"

extern int        Magic                = 16108;
extern string     Настройки_объемов;
extern double     StartLot             = 0.1;
extern double     Multipl              = 1.25;
extern string     Основные_настройки;
extern int        OrderStep            = 190;
extern int        TakeProfit           = 120;
extern string     Блок_анализа_тренда;
extern bool       Use_Trand_Analiz     = false;
extern int        MA_Period            = 70;
extern string     Методы_усреднения_МА = "0-Simple, 1-Exponet, 2-Smooted, 3-Linear Wed";
extern int        MA_Aver_Metod        = 0;
extern string     MA_Prices            = "0-Close, 1-Open, 2- High,3-Low"; 
extern int        MA_Use_Price         = 0;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {

   Comment("");

   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
  
   Comment("");
  
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
  int random;
  int ord[8];
  double tp, step, sr_cena, lot, sumlot,lotprice;
  double maxlot = -1;
  double minbuyprice = 10000000000;
  double maxsellprice=-1;
  double MA=iMA(Symbol(),0,MA_Period,0,MA_Aver_Metod,MA_Use_Price,0);
  //-----------------------
  if (Digits==2||Digits==4){tp=TakeProfit*Point;step=OrderStep*Point;}
  if (Digits==3||Digits==5){tp=TakeProfit*10*Point;step=OrderStep*10*Point;}
  lot=StartLot;
  Uchet_orderov(Magic,Symbol(),ord);
   if (ord[6]==0&&ord[7]==0){
    if (!Use_Trand_Analiz)  {
    MathSrand(TimeLocal());
    random = MathRand();
    if (random < 16384){ 
    OrderSend(Symbol(),OP_SELL,lot,Bid,100,0,Bid-tp,NULL,Magic,0,Red);
    OrderSend(Symbol(),OP_SELLLIMIT,NormalizeDouble(lot*Multipl,2),Bid+step,100,0,0,NULL,Magic,0,Red);
    }
    else{
    OrderSend(Symbol(),OP_BUY,lot,Ask,100,0,Ask+tp,NULL,Magic,0,Green);
    OrderSend(Symbol(),OP_BUYLIMIT,NormalizeDouble(lot*Multipl,2),Ask-step,100,0,0,NULL,Magic,0,Green);
     }
    }
    else{
    if (Close[0]>MA){
    OrderSend(Symbol(),OP_BUY,lot,Ask,100,0,Ask+tp,NULL,Magic,0,Green);
    OrderSend(Symbol(),OP_BUYLIMIT,NormalizeDouble(lot*Multipl,2),Ask-step,100,0,0,NULL,Magic,0,Green);
    }
    else if (Close[0]0&&ord[7]==0){
    for (int pos=0; posOrderOpenPrice())minbuyprice=OrderOpenPrice();
    if (OrderType()==OP_SELL && maxsellprice=0; opord--)
  {
   OrderSelect(opord, SELECT_BY_POS, MODE_TRADES);
   if(OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
   {
   
     if (OrderType() == OP_BUY)
     vsego++;
   }
  
  }
  return (vsego);
}
//+------------------------------------------------------------------+
int TSell()
{
 int vsego =0;
 for (int opord = OrdersTotal()-1; opord >=0; opord--)
  {
   OrderSelect(opord, SELECT_BY_POS, MODE_TRADES);
   if(OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
   {
   
     if (OrderType() == OP_SELL)
     vsego++;
   }
  
  }
  return (vsego);
}

Recommend