2010年9月28日 星期二

//+------------------------------------------------------------------+
//|                                                     AO_Daily.mq4 |
//|                       Copyright ?2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+

#property copyright "Copyright 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

extern string PlayMusic = "yes";
extern string ModifyOrder = "yes";

int EMA_Frame = 250;

double ExchangeRate = 3.31;

double TrendStart = 1.2588;

double ProtectPips = 0.0020;
double TakeProfitPips = 0.0000;

int SleepSeconds = 10000; // 1 sec = 1000 10000 15000 60000 300000

string EMA_Line = "none";

string EMA_Line_05 = "none";
string EMA_Line_10 = "none";
string EMA_Line_15 = "none";
string EMA_Line_20 = "none";

string EMA_Line_50 = "none";
string EMA_Line_100 = "none";
string EMA_Line_150 = "none";
string EMA_Line_200 = "none";
string EMA_Line_250 = "none";

string AC0_Area = "none";
string AC0_AC1 = "none";

double LeftSeconds = 0.0;
double ProceedDays = 0.0;
string OrderProtected = "no";

color lastusedColor = Black;
double lastusedFontSize = 9.0;
string lastusedFont = "Arial";
int cntDisplay = 10;

void _LabelCreate ( string _Name, int _XDistance, int _YDistance, int _Corner = 0 )
{
    int _GetLastError;

    if ( !ObjectCreate( _Name, OBJ_LABEL, 0, 0, 0 ) )
    {
        _GetLastError = GetLastError();
        if ( _GetLastError != 4200 )
        {
            Print( "ObjectCreate( \"", _Name, "\", OBJ_LABEL,0,0,0 ) - Error #", _GetLastError );
            return(-1);
        }
    }
    if ( !ObjectSet( _Name, OBJPROP_CORNER, _Corner ) )
    {
        _GetLastError = GetLastError();
        Print( "ObjectSet( \"", _Name, "\", OBJPROP_CORNER, ", _Corner,
                                                    " ) - Error #", _GetLastError );
    }
    if ( !ObjectSet( _Name, OBJPROP_XDISTANCE, _XDistance ) )
    {
        _GetLastError = GetLastError();
        Print( "ObjectSet( \"", _Name, "\", OBJPROP_XDISTANCE, ", _XDistance,
                                                            " ) - Error #", _GetLastError );
    }
    if ( !ObjectSet( _Name, OBJPROP_YDISTANCE, _YDistance ) )
    {
        _GetLastError = GetLastError();
        Print( "ObjectSet( \"", _Name, "\", OBJPROP_YDISTANCE, ", _YDistance,
                                                            " ) - Error #", _GetLastError );
    }
    if ( !ObjectSetText ( _Name, "", 10 ) )
    {
        _GetLastError = GetLastError();
        Print( "ObjectSetText( \"", _Name, "\", \"\", 10 ) - Error #", _GetLastError );
    }
}

void info( int LabelNumber, string Text, color Color = -1,
              double FontSize = -1.0, string Font = "-1" )
{
    string LabelName;
    if ( LabelNumber < 10 )
        LabelName = StringConcatenate( "InfoLabel_0", LabelNumber );
    else
        LabelName = StringConcatenate( "InfoLabel_" , LabelNumber );

    if ( Color < 0 ) Color = lastusedColor;
    if ( FontSize < 0 ) FontSize = lastusedFontSize;
    if ( Font == "-1" ) Font = lastusedFont;

    lastusedColor = Color;
    lastusedFontSize = FontSize;
    lastusedFont = Font;

    if ( !ObjectSetText( LabelName, Text, FontSize, Font, Color ) )
    {
        int _GetLastError = GetLastError();
        Print( "ObjectSetText( \"", LabelName,"\", \"", Text, "\", ", FontSize, ", ", Font,
                                                            ", ", Color, " ) - Error #", _GetLastError );
    }
    ObjectsRedraw();
}

void info_init()
{
    for ( int row = 0; row <= cntDisplay; row ++ )
    {
        _LabelCreate( StringConcatenate( "InfoLabel_0", row ),   4, 15 + 15*row );
        _LabelCreate( StringConcatenate( "InfoLabel_1", row ), 270, 15 + 15*row );
    }
}

void info_deinit()
{
    int _GetLastError;
    for ( int row = 0; row <= cntDisplay; row ++ )
    {
        if ( !ObjectDelete( StringConcatenate( "InfoLabel_0", row ) ) )
        {
            _GetLastError = GetLastError();
            Print( "ObjectDelete( \"", StringConcatenate( "InfoLabel_0", row ),
                                                            "\" ) - Error #", _GetLastError );
        }
        if ( !ObjectDelete( StringConcatenate( "InfoLabel_1", row ) ) )
        {
            _GetLastError = GetLastError();
            Print( "ObjectDelete( \"", StringConcatenate( "InfoLabel_1", row ),
                                                            "\" ) - Error #", _GetLastError );
        }
    }
}

int init()
{
    info_init();

   return(0);
}

int deinit()
{
    info_deinit();
   
   return(0);
}

int start()
{

   // custom indicator testing
  
   /*
   Print("");

   int i;

   for(i=0; i<11; i++)  
   {
      //Print("i = ",i,"   ",DoubleToStr(Close[i]-Close[i+20],5));
      //Print("i = ",i,"   ",DoubleToStr(Close[i]-iMA(NULL,0,250,0,1,0,i),5));
      //Print("i = ",i,"   ",DoubleToStr(iMA(NULL,0,10,0,1,0,i)-iMA(NULL,0,10,0,1,0,i+1),5));
      //Print("i = ",i,"   ",DoubleToStr(High[i]-Low[i],5));
      //Print("i = ",i,"     ",DoubleToStr(iMA(NULL,0,250,0,1,0,i)-iMA(NULL,0,250,0,1,0,i+1),5));
   }
   */

   // initialliaze

   double EMA_50_Value = iMA(NULL,0,50,0,1,0,0); 
   double EMA_100_Value = iMA(NULL,0,100,0,1,0,0); 
   double EMA_150_Value = iMA(NULL,0,150,0,1,0,0); 
   double EMA_200_Value = iMA(NULL,0,200,0,1,0,0); 
   double EMA_250_Value = iMA(NULL,0,250,0,1,0,0); 

   // modify order

   double TotalPips = 0.0;
   double StopProfitLoss = 0.0;
   double TakeProfitLoss = 0.0;
  
   double Pips_EMA_50 = 0.0;
   double Pips_EMA_250 = 0.0;

   double Pips_EMA_100 = 0.0;
   double Pips_EMA_150 = 0.0;
   double Pips_EMA_200 = 0.0;

   int cnt = 0;  
   int count = 0;

   int cntBuy = 0;
   int cntSell = 0;
  
   int cntLoss = 0;

   int cntUnProtected = 0;
   int cntProtected = 0;
  
   int cntALL = 0;

   double StopLossNewValueBuy = 0.00;
  
   double TotalOrderPrice = 0.00;

   double TotalUnClose = 0.00;
   double TotalStopLoss = 0.00;

   double LastProfitLoss = 0.0;

   for(cnt = 0 ; cnt < OrdersTotal() ; cnt++)
   {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol())
     
      if(cnt == 0)
      {
         ProceedDays = (TimeCurrent() - OrderOpenTime()) / 86400;
      }
     

      if(OrderType() == 0)
      {
         TotalOrderPrice = TotalOrderPrice + OrderOpenPrice();

         TotalPips = TotalPips + (Bid - OrderOpenPrice());
         StopProfitLoss = OrderStopLoss() - OrderOpenPrice();
         TakeProfitLoss = OrderTakeProfit() - OrderOpenPrice();
         LastProfitLoss = Bid - OrderOpenPrice();

         if(Bid - OrderOpenPrice() < 0)
         {
            cntLoss = cntLoss + 1;
         }

         LeftSeconds = TimeCurrent() - OrderOpenTime();
        
         cntALL = cntALL + 1;
        
         cntBuy++;
        
         if(Bid - OrderOpenPrice() > ProtectPips && OrderStopLoss() == 0.0000 && ModifyOrder == "yes")
         {
            StopLossNewValueBuy = OrderOpenPrice() + TakeProfitPips;
            OrderModify(OrderTicket(),OrderOpenPrice(),StopLossNewValueBuy,OrderTakeProfit(),0,Blue);
            OrderProtected = "yes";
         }

         Pips_EMA_50 = Pips_EMA_50 + (EMA_50_Value - OrderOpenPrice());
         Pips_EMA_100 = Pips_EMA_100 + (EMA_100_Value - OrderOpenPrice());
         Pips_EMA_150 = Pips_EMA_150 + (EMA_150_Value - OrderOpenPrice());
         Pips_EMA_200 = Pips_EMA_200 + (EMA_200_Value - OrderOpenPrice());
         Pips_EMA_250 = Pips_EMA_250 + (EMA_250_Value - OrderOpenPrice());

         if(OrderStopLoss() == 0.0000)
         {
            TotalUnClose = TotalUnClose + OrderStopLoss() - OrderOpenPrice();
            cntUnProtected++;
         }else{           
            TotalStopLoss = TotalStopLoss + OrderStopLoss() - OrderOpenPrice();
            cntProtected++;
         }
      }
     
      if(OrderType() == 1)
      {
         TotalOrderPrice = TotalOrderPrice + OrderOpenPrice();

         TotalPips = TotalPips + (OrderOpenPrice() - Ask);
         StopProfitLoss = OrderOpenPrice() - OrderStopLoss();
         TakeProfitLoss = OrderOpenPrice() - OrderTakeProfit();
         LastProfitLoss = OrderOpenPrice() - Ask;       
        
         if(OrderOpenPrice() - Ask < 0)
         {
            cntLoss = cntLoss + 1;
         }

         LeftSeconds = TimeCurrent() - OrderOpenTime();

         cntALL = cntALL + 1;

         cntSell++;
        
         if(OrderOpenPrice() - Ask > ProtectPips && OrderStopLoss() == 0.0000 && ModifyOrder == "yes")
         {
            StopLossNewValueBuy = OrderOpenPrice() - TakeProfitPips;
            OrderModify(OrderTicket(),OrderOpenPrice(),StopLossNewValueBuy,OrderTakeProfit(),0,Blue);
            OrderProtected = "yes";
         }

         Pips_EMA_50 = Pips_EMA_50 + (OrderOpenPrice() - EMA_50_Value);
         Pips_EMA_100 = Pips_EMA_100 + (OrderOpenPrice() - EMA_100_Value);
         Pips_EMA_150 = Pips_EMA_150 + (OrderOpenPrice() - EMA_150_Value);
         Pips_EMA_200 = Pips_EMA_200 + (OrderOpenPrice() - EMA_200_Value);
         Pips_EMA_250 = Pips_EMA_250 + (OrderOpenPrice() - EMA_250_Value);

         if(OrderStopLoss() == 0.0000)
         {
            TotalUnClose = TotalUnClose + OrderOpenPrice() - OrderStopLoss();
            cntUnProtected++;
         }else{           
            TotalStopLoss = TotalStopLoss + OrderOpenPrice() - OrderStopLoss();
            cntProtected++;
         }
      }

      count++;

   } 
  
   // start music

   double EMA_Slope_5 = iMA(NULL,0,EMA_Frame,0,1,0,4) - iMA(NULL,0,EMA_Frame,0,1,0,5); 
   double EMA_Slope_4 = iMA(NULL,0,EMA_Frame,0,1,0,3) - iMA(NULL,0,EMA_Frame,0,1,0,4); 
   double EMA_Slope_3 = iMA(NULL,0,EMA_Frame,0,1,0,2) - iMA(NULL,0,EMA_Frame,0,1,0,3); 
   double EMA_Slope_2 = iMA(NULL,0,EMA_Frame,0,1,0,1) - iMA(NULL,0,EMA_Frame,0,1,0,2); 
   double EMA_Slope_1 = iMA(NULL,0,EMA_Frame,0,1,0,0) - iMA(NULL,0,EMA_Frame,0,1,0,1); 

   double AC1_D1 = iAO(NULL, 1440, 1);
   double AC0_D1 = iAO(NULL, 1440, 0);

   //Print(AC1_D1,"   ",AC0_D1);

   double AC1 = iAO(NULL, 0, 1);
   double AC0 = iAO(NULL, 0, 0);

   // Bell2 Yeah - DingDong Clink
   // alert2 ok - alert tick
   // news stops - connect timeout
   // wmpaud4 wmpaud2 - starwars robocop - bugsbunny2 daffyduck2
   // QRECORD QMEM QDELETE QABMENU

   if(OrderProtected == "yes")
   {
      OrderProtected = "no";
      if(PlayMusic == "yes"){PlaySound("Love_of_Siam_Gun_lae_gun.wav");}  
   }else{
      if(AC0_D1 > AC1_D1)
      {
         if(AC0 > AC1)
         {
            if(PlayMusic == "yes"){PlaySound("DingDong.wav");}  
         }else{
            if(PlayMusic == "yes"){PlaySound("Clink.wav");}  
         }
      }else{
         if(AC0 > AC1)
         {
            if(PlayMusic == "yes"){PlaySound("Bell2.wav");}  
         }else{
            if(PlayMusic == "yes"){PlaySound("Yeah.wav");}  
         }
      }
   }

   // EMA Line
  
   if(EMA_Slope_5 > 0 && EMA_Slope_4 > 0 && EMA_Slope_3 > 0 && EMA_Slope_2 > 0 && EMA_Slope_1 > 0)
   {
      EMA_Line = "B";
   }else{
      if(EMA_Slope_5 <= 0 && EMA_Slope_4 <= 0 && EMA_Slope_3 <= 0 && EMA_Slope_2 <= 0 && EMA_Slope_1 <= 0)
      {
         EMA_Line = "S";
      }else{
         EMA_Line = "-";
      }
   }

   // AC

   if(AC0 > 0)
   {
      AC0_Area = "B";
   }else{
      AC0_Area = "S";
   }

   if(AC0 > AC1)
   {
      AC0_AC1 = "B";
   }else{
      AC0_AC1 = "S";
   }

   // slope section 1

   double EMA_Slope_5_1 = iMA(NULL,0,5,0,1,0,0) - iMA(NULL,0,5,0,1,0,1); 
  
   if(EMA_Slope_5_1 > 0)
   {
      EMA_Line_05 = "B";
   }else{
      EMA_Line_05 = "S";
   }

   double EMA_Slope_10_1 = iMA(NULL,0,10,0,1,0,0) - iMA(NULL,0,10,0,1,0,1); 
  
   if(EMA_Slope_10_1 > 0)
   {
      EMA_Line_10 = "B";
   }else{
      EMA_Line_10 = "S";
   }

   double EMA_Slope_15_1 = iMA(NULL,0,15,0,1,0,0) - iMA(NULL,0,15,0,1,0,1); 
  
   if(EMA_Slope_10_1 > 0)
   {
      EMA_Line_15 = "B";
   }else{
      EMA_Line_15 = "S";
   }

   double EMA_Slope_20_1 = iMA(NULL,0,20,0,1,0,0) - iMA(NULL,0,20,0,1,0,1); 
  
   if(EMA_Slope_20_1 > 0)
   {
      EMA_Line_20 = "B";
   }else{
      EMA_Line_20 = "S";
   }

   // slope section 2

   double EMA_Slope_50_5 = iMA(NULL,0,50,0,1,0,4) - iMA(NULL,0,50,0,1,0,5); 
   double EMA_Slope_50_4 = iMA(NULL,0,50,0,1,0,3) - iMA(NULL,0,50,0,1,0,4); 
   double EMA_Slope_50_3 = iMA(NULL,0,50,0,1,0,2) - iMA(NULL,0,50,0,1,0,3); 
   double EMA_Slope_50_2 = iMA(NULL,0,50,0,1,0,1) - iMA(NULL,0,50,0,1,0,2); 
   double EMA_Slope_50_1 = iMA(NULL,0,50,0,1,0,0) - iMA(NULL,0,50,0,1,0,1); 
  
   if(EMA_Slope_50_5 > 0 && EMA_Slope_50_4 > 0 && EMA_Slope_50_3 > 0 && EMA_Slope_50_2 > 0 && EMA_Slope_50_1 > 0)
   {
      EMA_Line_50 = "B";
   }else{
      if(EMA_Slope_50_5 <= 0 && EMA_Slope_50_4 <= 0 && EMA_Slope_50_3 <= 0 && EMA_Slope_50_2 <= 0 && EMA_Slope_50_1 <= 0)
      {
         EMA_Line_50 = "S";
      }else{
         EMA_Line_50 = "-";
      }
   }

   double EMA_Slope_100_5 = iMA(NULL,0,100,0,1,0,4) - iMA(NULL,0,100,0,1,0,5); 
   double EMA_Slope_100_4 = iMA(NULL,0,100,0,1,0,3) - iMA(NULL,0,100,0,1,0,4); 
   double EMA_Slope_100_3 = iMA(NULL,0,100,0,1,0,2) - iMA(NULL,0,100,0,1,0,3); 
   double EMA_Slope_100_2 = iMA(NULL,0,100,0,1,0,1) - iMA(NULL,0,100,0,1,0,2); 
   double EMA_Slope_100_1 = iMA(NULL,0,100,0,1,0,0) - iMA(NULL,0,100,0,1,0,1); 
  
   if(EMA_Slope_100_5 > 0 && EMA_Slope_100_4 > 0 && EMA_Slope_100_3 > 0 && EMA_Slope_100_2 > 0 && EMA_Slope_100_1 > 0)
   {
      EMA_Line_100 = "B";
   }else{
      if(EMA_Slope_100_5 <= 0 && EMA_Slope_100_4 <= 0 && EMA_Slope_100_3 <= 0 && EMA_Slope_100_2 <= 0 && EMA_Slope_100_1 <= 0)
      {
         EMA_Line_100 = "S";
      }else{
         EMA_Line_100 = "-";
      }
   }

   double EMA_Slope_150_5 = iMA(NULL,0,150,0,1,0,4) - iMA(NULL,0,150,0,1,0,5); 
   double EMA_Slope_150_4 = iMA(NULL,0,150,0,1,0,3) - iMA(NULL,0,150,0,1,0,4); 
   double EMA_Slope_150_3 = iMA(NULL,0,150,0,1,0,2) - iMA(NULL,0,150,0,1,0,3); 
   double EMA_Slope_150_2 = iMA(NULL,0,150,0,1,0,1) - iMA(NULL,0,150,0,1,0,2); 
   double EMA_Slope_150_1 = iMA(NULL,0,150,0,1,0,0) - iMA(NULL,0,150,0,1,0,1); 
  
   if(EMA_Slope_150_5 > 0 && EMA_Slope_150_4 > 0 && EMA_Slope_150_3 > 0 && EMA_Slope_150_2 > 0 && EMA_Slope_150_1 > 0)
   {
      EMA_Line_150 = "B";
   }else{
      if(EMA_Slope_150_5 <= 0 && EMA_Slope_150_4 <= 0 && EMA_Slope_150_3 <= 0 && EMA_Slope_150_2 <= 0 && EMA_Slope_150_1 <= 0)
      {
         EMA_Line_150 = "S";
      }else{
         EMA_Line_150 = "-";
      }
   }

   double EMA_Slope_200_5 = iMA(NULL,0,200,0,1,0,4) - iMA(NULL,0,200,0,1,0,5); 
   double EMA_Slope_200_4 = iMA(NULL,0,200,0,1,0,3) - iMA(NULL,0,200,0,1,0,4); 
   double EMA_Slope_200_3 = iMA(NULL,0,200,0,1,0,2) - iMA(NULL,0,200,0,1,0,3); 
   double EMA_Slope_200_2 = iMA(NULL,0,200,0,1,0,1) - iMA(NULL,0,200,0,1,0,2); 
   double EMA_Slope_200_1 = iMA(NULL,0,200,0,1,0,0) - iMA(NULL,0,200,0,1,0,1); 
  
   if(EMA_Slope_200_5 > 0 && EMA_Slope_200_4 > 0 && EMA_Slope_200_3 > 0 && EMA_Slope_200_2 > 0 && EMA_Slope_200_1 > 0)
   {
      EMA_Line_200 = "B";
   }else{
      if(EMA_Slope_200_5 <= 0 && EMA_Slope_200_4 <= 0 && EMA_Slope_200_3 <= 0 && EMA_Slope_200_2 <= 0 && EMA_Slope_200_1 <= 0)
      {
         EMA_Line_200 = "S";
      }else{
         EMA_Line_200 = "-";
      }
   }

   double EMA_Slope_250_5 = iMA(NULL,0,250,0,1,0,4) - iMA(NULL,0,250,0,1,0,5); 
   double EMA_Slope_250_4 = iMA(NULL,0,250,0,1,0,3) - iMA(NULL,0,250,0,1,0,4); 
   double EMA_Slope_250_3 = iMA(NULL,0,250,0,1,0,2) - iMA(NULL,0,250,0,1,0,3); 
   double EMA_Slope_250_2 = iMA(NULL,0,250,0,1,0,1) - iMA(NULL,0,250,0,1,0,2); 
   double EMA_Slope_250_1 = iMA(NULL,0,250,0,1,0,0) - iMA(NULL,0,250,0,1,0,1); 
  
   if(EMA_Slope_250_5 > 0 && EMA_Slope_250_4 > 0 && EMA_Slope_250_3 > 0 && EMA_Slope_250_2 > 0 && EMA_Slope_250_1 > 0)
   {
      EMA_Line_250 = "B";
   }else{
      if(EMA_Slope_250_5 <= 0 && EMA_Slope_250_4 <= 0 && EMA_Slope_250_3 <= 0 && EMA_Slope_250_2 <= 0 && EMA_Slope_250_1 <= 0)
      {
         EMA_Line_250 = "S";
      }else{
         EMA_Line_250 = "-";
      }
   }

   // show label LawnGreen YellowGreen HotPink Pink
  
   if(EMA_Slope_5 > 0 && EMA_Slope_4 > 0 && EMA_Slope_3 > 0 && EMA_Slope_2 > 0 && EMA_Slope_1 > 0)
   {
      info( 0, EMA_Line_05 + " " + EMA_Line_10 + " " + EMA_Line_15 + " " + EMA_Line_20 + "   " + EMA_Line_50 + " " + EMA_Line_100 + " " + EMA_Line_150 + " " + EMA_Line_200 + " " + EMA_Line_250 + "   " + AC0_Area + " " + AC0_AC1 + "   " + PlayMusic + " " + ModifyOrder + "  " + DoubleToStr(Bid,4)+ "  " + DoubleToStr(LeftSeconds/60,2), LawnGreen, 14 );
   }else{
      if(EMA_Slope_5 <= 0 && EMA_Slope_4 <= 0 && EMA_Slope_3 <= 0 && EMA_Slope_2 <= 0 && EMA_Slope_1 <= 0)
      {
         info( 0, EMA_Line_05 + " " + EMA_Line_10 + " " + EMA_Line_15 + " " + EMA_Line_20 + "   " + EMA_Line_50 + " " + EMA_Line_100 + " " + EMA_Line_150 + " " + EMA_Line_200 + " " + EMA_Line_250 + "   " + AC0_Area + " " + AC0_AC1 + "   " + PlayMusic + " " + ModifyOrder + "  " + DoubleToStr(Bid,4)+ "  " + DoubleToStr(LeftSeconds/60,2), Pink, 14 );
      }else{
         info( 0, EMA_Line_05 + " " + EMA_Line_10 + " " + EMA_Line_15 + " " + EMA_Line_20 + "   " + EMA_Line_50 + " " + EMA_Line_100 + " " + EMA_Line_150 + " " + EMA_Line_200 + " " + EMA_Line_250 + "   " + AC0_Area + " " + AC0_AC1 + "   " + PlayMusic + " " + ModifyOrder + "  " + DoubleToStr(Bid,4)+ "  " + DoubleToStr(LeftSeconds/60,2), Yellow, 14 );
      }
   }

    info( 1, cntUnProtected + " + " + cntProtected + "  = " + cntALL + "  " + DoubleToStr(ProceedDays,0) + "  " + DoubleToStr(ExchangeRate,2) + "  " + DoubleToStr(AccountEquity()*ExchangeRate,2) + "  " + DoubleToStr(AccountProfit()*ExchangeRate,2) + "  " + DoubleToStr(AccountEquity(),2), Yellow , 14);

    info( 2, DoubleToStr(ProtectPips,4) + "  " + DoubleToStr(TakeProfitPips,4) + "  " + DoubleToStr(Bid - Ask,4) + "  " + SleepSeconds + "  " + DoubleToStr(TrendStart,4) + "  " + DoubleToStr(Bid-TrendStart,4), Cyan );

    info( 3, DoubleToStr(EMA_50_Value,4) + "  " + DoubleToStr(EMA_100_Value,4) + "  " + DoubleToStr(EMA_150_Value,4) + "  " + DoubleToStr(EMA_200_Value,4) + "  " + DoubleToStr(EMA_250_Value,4), LawnGreen );
    info( 4, DoubleToStr(Bid - EMA_50_Value,4) + "  " + DoubleToStr(Bid - EMA_100_Value,4) + "  " + DoubleToStr(Bid - EMA_150_Value,4) + "  " + DoubleToStr(Bid - EMA_200_Value,4) + "  " + DoubleToStr(Bid - EMA_250_Value,4), LawnGreen );
    info( 5, DoubleToStr(Pips_EMA_50,4) + "  " + DoubleToStr(Pips_EMA_100,4) + "  " + DoubleToStr(Pips_EMA_150,4) + "  " + DoubleToStr(Pips_EMA_200,4) + "  " + DoubleToStr(Pips_EMA_250,4), LawnGreen );
    info( 6, DoubleToStr(Pips_EMA_50*100/AccountBalance()*100,2) + "  "  + DoubleToStr(Pips_EMA_100*100/AccountBalance()*100,2) + "  "  + DoubleToStr(Pips_EMA_150*100/AccountBalance()*100,2) + "  "  + DoubleToStr(Pips_EMA_200*100/AccountBalance()*100,2) + "  "  + DoubleToStr(Pips_EMA_250*100/AccountBalance()*100,2) + "%" + "  " + TimeToStr(TimeCurrent()), LawnGreen );

   if(iOpen(NULL,0,0)-iLow(NULL,0,0) != 0)
   {
       info( 7, DoubleToStr(iHigh(NULL,0,0)-iLow(NULL,0,0),4) + "  " + DoubleToStr(iHigh(NULL,0,0)-iOpen(NULL,0,0),4) + "  " + DoubleToStr(iLow(NULL,0,0)-iOpen(NULL,0,0),4) + "  " + DoubleToStr((iHigh(NULL,0,0)-iOpen(NULL,0,0))/(iOpen(NULL,0,0)-iLow(NULL,0,0)),2) + "  DM = " + DoubleToStr(iClose(NULL,0,0)-iOpen(NULL,0,0),4), Yellow );
   }else{
       info( 7, DoubleToStr(iHigh(NULL,0,0)-iLow(NULL,0,0),4) + "  " + DoubleToStr(iHigh(NULL,0,0)-iOpen(NULL,0,0),4) + "  " + DoubleToStr(iLow(NULL,0,0)-iOpen(NULL,0,0),4) + "  DM = " + DoubleToStr(iClose(NULL,0,0)-iOpen(NULL,0,0),4), Yellow );
   }

   if(cntALL != 0)
   {
      info( 8, "SW = " + DoubleToStr((TotalPips*100)-AccountProfit(),2) + "  AV = " + DoubleToStr(TotalOrderPrice/cntALL,4) + "  AVD = " + DoubleToStr(TotalOrderPrice/cntALL - Bid,4), Cyan );
   }else{
      info( 8, "SW = " + DoubleToStr((TotalPips*100)-AccountProfit(),2), Cyan );
   }     

    info( 9, "LO = "  + DoubleToStr(LastProfitLoss,4) + "  PL = " + DoubleToStr(AccountProfit(),2) + "  PL% = " + DoubleToStr(AccountProfit()/AccountBalance()*100,2) + "%", Yellow );
         
    Sleep(SleepSeconds);

    for ( int n = 0; n <= cntDisplay; n ++ ) info( n, "" );
   
   // end initialiaze   

   return(0);

}

1 則留言:

  1. 江大,

    可以解释一下吗?是否自动买入卖出呢?

    回覆刪除