NinjaForex_Versi_Beta_AI

这个ea是高频头皮,或快速头皮(fast scalping),11倍,持仓时间1-6分钟,因此需要低延迟vps,实盘堪忧。

2019-08-032019-08-03

止损、挂单等点数都很小,

一种改造思路是把所有点数都放大10倍,变成4位平台的pip,能不能支持实盘?

欢迎有缘人改造,并分享你的结果。


#property link "EA @NinjaForex Versi Beta | Mail : Memberforex@gmail.com | Facebook : @NinjaForex.Click "
#property description "https://memberforex.com/store "

#import "stdlib.ex4"
   string ErrorDescription(int a0); 
#import

extern int MagicNumber = 1;
extern string TradeComment = "@NinjaForex Beta memberforex.com";
extern double Range_BidAsk = 20.3;
extern double BidAsk_High = 30.3;
extern double MinLots = 0.01;
extern double MaxLots = 100000000.0;
extern double Risk = 30.0;
extern double FixedLots = 0.01;
extern bool UseMM = TRUE;
extern int NinjaForex_Swing = 3;
extern int NinjaForex_scalper = 3;
extern bool Sett_lock = TRUE;
extern double ILock = 2.9;
extern double SLock = 0.3;
extern bool Sett_BE = TRUE;
extern double LP = 0.3;
extern double P_BE = 2.0;
extern string TimeFilter = "---------- Time Filter ----------";
extern string Bar_Times = "-2";
extern int StartHour = 0;
extern int StartMinute = 0;
extern int EndHour = 23;
extern int EndMinute = 59;
extern string Author = "=== Facebook : @NinjaForex | memberforex.com ===";
extern string Coder = "EA Type : HFT, Arbi, Scalper, Swing, Costum Indi";
extern string Contact_NinjaForex = "==================";
extern string Mail = "Email : memberforex@gmail.com";
extern string Facebook = "Facebook.com/NinjaForex";
extern string Costum_Indicator_2012 = "==================";
extern string Tools = ">> www.memberforex.com/store <<";
extern string Portofolio = "==================";
extern string Fx = "www.memberforex.com/Portofolio";
extern string Web_fx_btc_affiliate_xchanger = "www.memberforex.com/webdesign";
extern string RealRobot_NinjaForex = "==================";
extern string EA = "www.memberforex.com/Portofolio";
extern string HFT_Demo = "fxblue.com/users/ninjaforex6";
extern string EA_HFT1 = "fxblue.com/users/memberforex";
extern string EA_HFT2 = "fxblue.com/users/memberforex2";
extern string MultiEA_2012 = "www.myfxbook.com/NinjaForex public acc";
extern string CHF_CHT = "www.memberforex.com/Portofolio";
extern string Robot_NinjaForex = "==================";
extern string Hedging = "www.memberforex.com/robot";
extern string HFT1 = "www.memberforex.com/hft";
extern string HFT2 = "www.memberforex.com/samurai";
extern string AnotherPrivate_or_Develop = "Contact Our Mail/Facebook @NinjaForex";
extern string Parameter_Plus = "==================";
extern double LBL = 20.0;
extern int Bar = 150;
extern int Bar1 = 140;
extern int Bar2 = 170;
extern int Bar3 = 190;
extern int MaxTrades = 15;
extern double StopLoss = 5.0;
extern double NProfit = 30.0;
extern double ITProfit = 2.3;
extern double Comm_D = 0.05;
extern double NL = 20.0;
extern double Dn = 50.0;
extern double IL = 25.0;
extern double NDn = 20.0;
extern double IDn = 25.0;
extern int Slow_P = 10;
extern double BidAsk_middle = 20.3;
extern double BidAsk_low = 10.0;
extern double BidAsk_high = 30.6;
extern double M_I_U_NinjaForex = 100.6;
extern double M_I_V_NinjaForex = 1.0;
extern double M_I_Z_NinjaForex = 0.6;
extern int BarCandle_Use = 1;
extern string Info_NinjaForex = "Mail : memberforex@gmail.com | Facebook : @NinjaForex";


int Filter = 140;
double MaxSpreadPlusCommission = 10000.0;
int Limit = 20;
int Distance = 21;
int MAPeriod = 3;
int MAMethod = 3;
int Gi_180 = 0;
double G_pips_184 = 0.0;
int digit = 0;
double p = 0.0;
int LotDigit;
double minlots;
double maxlots;
double Gd_224;
double Gd_232;
double PendingDistance;
double trailingdistance;
double threshold;
int slippage = 3;
bool CalculateCommisionPoint;
double CommissionPoint;
double SPREAD[30];
int Gi_284 = 0;
string Gs_dummy_288;
//string Gs_unused_316 = "";
//string Gs_unused_324 = "";
double Gd_336;
double Gd_344;
datetime ViewFirstTime;
int ViewableBars;
int G_datetime_360;
string Gs_364 = "000,000,000";
string Gs_372 = "000,000,255";
int Gi_380;
int Gi_384;
int Gi_388;
int Gi_392 = 40;
double TrendTimeframe = 240.0;
bool Gi_404 = TRUE;
color G_color_408 = DimGray;
string G_name_412 = "SpreadIndikatorObj";
double Gd_420;
color G_color_428 = Red;
color G_color_432 = DarkGray;
color G_color_436 = SpringGreen;
bool Gi_440 = TRUE;
double G_ihigh_444;
double G_ilow_452;
double Gd_460;
int G_datetime_468;

int init() 
{
   datetime WorkTimeframe;
   ArrayInitialize(SPREAD, 0);
   digit = Digits;
   p = Point;
   Print("Digits: " + digit + " Point: " + DoubleToStr(p, digit));
   double lotstep = MarketInfo(Symbol(), MODE_LOTSTEP);
   LotDigit = MathLog(lotstep) / MathLog(0.1);
   minlots = MathMax(MinLots, MarketInfo(Symbol(), MODE_MINLOT));
   maxlots = MathMin(MaxLots, MarketInfo(Symbol(), MODE_MAXLOT));
   Gd_224 = Risk / 100.0;
   Gd_232 = NormalizeDouble(MaxSpreadPlusCommission * p, digit + 1);
   PendingDistance = NormalizeDouble(Limit * p, digit);//20
   trailingdistance = NormalizeDouble(Distance * p, digit);//21
   threshold = NormalizeDouble(p * Filter, digit);//140
   CalculateCommisionPoint = FALSE;
   CommissionPoint = NormalizeDouble(G_pips_184 * p, digit + 1);
   if (!IsTesting()) 
   {
      f0_8();
      if (Gi_404) 
      {
         WorkTimeframe = Period();
         switch (WorkTimeframe) {
         case PERIOD_M1:
            TrendTimeframe = 5;
            break;
         case PERIOD_M5:
            TrendTimeframe = 15;
            break;
         case PERIOD_M15:
            TrendTimeframe = 30;
            break;
         case PERIOD_M30:
            TrendTimeframe = 60;
            break;
         case PERIOD_H1:
            TrendTimeframe = 240;
            break;
         case PERIOD_H4:
            TrendTimeframe = 1440;
            break;
         case PERIOD_D1:
            TrendTimeframe = 10080;
            break;
         case PERIOD_W1:
            TrendTimeframe = 43200;
            break;
         case PERIOD_MN1:
            TrendTimeframe = 43200;
         }
      }
      Gd_420 = 0.0001;
      f0_7();
      f0_2();
      f0_0();
      lefttime();
   }
   return (0);
}
	 	  	 			  	   	  	  	 				    	  	 					    	  	   	   	 	 	   	 	 		  		 					 			 		  	   				 		 		  	      			   			 	 	 	 					  	 			  	 
int deinit() {
   if (!IsTesting()) 
   {
      for (int i = 1; i <= Gi_392; i++) ObjectDelete("Padding_rect" + i);
      for (int count_4 = 0; count_4 < 10; count_4++) 
      {
         ObjectDelete("BD" + count_4);
         ObjectDelete("SD" + count_4);
      }
      ObjectDelete("time");
      ObjectDelete(G_name_412);
   }
   Comment("");
   ObjectDelete("B3LLogo");
   ObjectDelete("B3LCopy");
   ObjectDelete("FiboUp");
   ObjectDelete("FiboDn");
   ObjectDelete("FiboIn");
   return (0);
}
	 	 			  	    		   		  	 				 		   			   	  	  			  						 							 			 				  	    		    	 	 	    	 	    	 	 	 							 	  	 				 				 			  		  	 	
int start() 
{
   int error_8;
   string Ls_12;
   int ticket_20;
   double price_24;
   bool bool_32;
   double Ld_36;
   double oldsl;
   double price_60;
   double PointValue;
   int Li_180;
   int cmd_188;
   double Ld_196;
   double Ld_204;
   double ihigh_68 = iHigh(NULL, 0, 0);
   double ilow_76 = iLow(NULL, 0, 0);
   double ima_84 = iMA(NULL, 0, MAPeriod, Gi_180, MAMethod, PRICE_LOW, 0);
   double ima_92 = iMA(NULL, 0, MAPeriod, Gi_180, MAMethod, PRICE_HIGH, 0);
   double Ld_100 = ima_84 - ima_92;
   if (!CalculateCommisionPoint) 
   {
      for (int pos_108 = OrdersHistoryTotal() - 1; pos_108 >= 0; pos_108--) 
      {
         if (OrderSelect(pos_108, SELECT_BY_POS, MODE_HISTORY)) 
         {
            if (OrderProfit() != 0.0) 
            {
               if (OrderClosePrice() != OrderOpenPrice()) 
               {
                  if (OrderSymbol() == Symbol()) 
                  {
                     CalculateCommisionPoint = TRUE;
                     PointValue = MathAbs(OrderProfit() / (OrderClosePrice() - OrderOpenPrice()));
                     CommissionPoint = (-OrderCommission()) / PointValue;
                     break;
                  }
               }
            }
         }
      }
   }

   double spread = Ask - Bid;
   ArrayCopy(SPREAD, SPREAD, 0, 1, 29);
   SPREAD[29] = spread;
   if (Gi_284 < 30) Gi_284++;
   double Ld_128 = 0;
   pos_108 = 29;
   for (int count_136 = 0; count_136 < Gi_284; count_136++) 
   {
      Ld_128 += SPREAD[pos_108];
      pos_108--;
   }
   double AvgSpread = Ld_128 / Gi_284;
   double Ld_148 = NormalizeDouble(Ask + CommissionPoint, digit);
   double Ld_156 = NormalizeDouble(Bid - CommissionPoint, digit);
   double Ld_164 = NormalizeDouble(AvgSpread + CommissionPoint, digit + 1);
   double atr = ihigh_68 - ilow_76;
   if (atr > threshold) 
   {
      if (Bid < ima_84) Li_180 = -1;
      else
         if (Bid > ima_92) Li_180 = 1;
   }
   int count_184 = 0;
   for (pos_108 = 0; pos_108 < OrdersTotal(); pos_108++) //fast scalping
   {
      if (OrderSelect(pos_108, SELECT_BY_POS, MODE_TRADES)) 
      {
         if (OrderMagicNumber() == MagicNumber) 
         {
            cmd_188 = OrderType();
            if (cmd_188 == OP_BUYLIMIT || cmd_188 == OP_SELLLIMIT) continue;
            if (OrderSymbol() == Symbol()) 
            {
               count_184++;
               switch (cmd_188) 
               {
               case OP_BUY:
                  if (Distance < 0) break;
                  oldsl = NormalizeDouble(OrderStopLoss(), digit);
                  price_60 = NormalizeDouble(Bid - trailingdistance, digit);
                  if (!((oldsl == 0.0 || price_60 > oldsl))) break;
                  bool_32 = OrderModify(OrderTicket(), OrderOpenPrice(), price_60, OrderTakeProfit(), 0, Lime);
                  if (!(!bool_32)) break;
                  error_8 = GetLastError();
                  Ls_12 = ErrorDescription(error_8);
                  Print("BUY Modify Error Code: " + error_8 + " Message: " + Ls_12 + " OP: " + DoubleToStr(price_24, digit) + " SL: " + DoubleToStr(price_60, digit) +
                     " Bid: " + DoubleToStr(Bid, digit) + " Ask: " + DoubleToStr(Ask, digit));
                  break;
               case OP_SELL:
                  if (Distance < 0) break;
                  oldsl = NormalizeDouble(OrderStopLoss(), digit);
                  price_60 = NormalizeDouble(Ask + trailingdistance, digit);
                  if (!((oldsl == 0.0 || price_60 < oldsl))) break;
                  bool_32 = OrderModify(OrderTicket(), OrderOpenPrice(), price_60, OrderTakeProfit(), 0, Orange);
                  if (!(!bool_32)) break;
                  error_8 = GetLastError();
                  Ls_12 = ErrorDescription(error_8);
                  Print("SELL Modify Error Code: " + error_8 + " Message: " + Ls_12 + " OP: " + DoubleToStr(price_24, digit) + " SL: " + DoubleToStr(price_60, digit) +
                     " Bid: " + DoubleToStr(Bid, digit) + " Ask: " + DoubleToStr(Ask, digit));
                  break;
               case OP_BUYSTOP:
                  Ld_36 = NormalizeDouble(OrderOpenPrice(), digit);
                  price_24 = NormalizeDouble(Ask + PendingDistance, digit);
                  if (!((price_24 < Ld_36))) break;
                  price_60 = NormalizeDouble(price_24 - StopLoss * Point, digit);//5p
                  bool_32 = OrderModify(OrderTicket(), price_24, price_60, OrderTakeProfit(), 0, Lime);
                  if (!(!bool_32)) break;
                  error_8 = GetLastError();
                  Ls_12 = ErrorDescription(error_8);
                  Print("BUYSTOP Modify Error Code: " + error_8 + " Message: " + Ls_12 + " OP: " + DoubleToStr(price_24, digit) + " SL: " + DoubleToStr(price_60, digit) +
                     " Bid: " + DoubleToStr(Bid, digit) + " Ask: " + DoubleToStr(Ask, digit));
                  break;
               case OP_SELLSTOP:
                  Ld_36 = NormalizeDouble(OrderOpenPrice(), digit);
                  price_24 = NormalizeDouble(Bid - PendingDistance, digit);
                  if (!((price_24 > Ld_36))) break;
                  price_60 = NormalizeDouble(price_24 + StopLoss * Point, digit);
                  bool_32 = OrderModify(OrderTicket(), price_24, price_60, OrderTakeProfit(), 0, Orange);
                  if (!(!bool_32)) break;
                  error_8 = GetLastError();
                  Ls_12 = ErrorDescription(error_8);
                  Print("SELLSTOP Modify Error Code: " + error_8 + " Message: " + Ls_12 + " OP: " + DoubleToStr(price_24, digit) + " SL: " + DoubleToStr(price_60, digit) +
                     " Bid: " + DoubleToStr(Bid, digit) + " Ask: " + DoubleToStr(Ask, digit));
               }
            }
         }
      }
   }
   if (count_184 == 0 && Li_180 != 0 && Ld_164 <= Gd_232 && WorkHour()) 
   {
      Ld_196 = AccountBalance() * AccountLeverage() * Gd_224;
      if (!UseMM) Ld_196 = FixedLots;
      Ld_204 = NormalizeDouble(Ld_196 / MarketInfo(Symbol(), MODE_LOTSIZE), LotDigit);
      Ld_204 = MathMax(minlots, Ld_204);
      Ld_204 = MathMin(maxlots, Ld_204);
      if (Li_180 < 0) {
         price_24 = NormalizeDouble(Ask + PendingDistance, digit);
         price_60 = NormalizeDouble(price_24 - StopLoss * Point, digit);
         ticket_20 = OrderSend(Symbol(), OP_BUYSTOP, Ld_204, price_24, slippage, price_60, 0, TradeComment, MagicNumber, 0, Lime);
         if (ticket_20 <= 0) {
            error_8 = GetLastError();
            Ls_12 = ErrorDescription(error_8);
            Print("BUYSTOP Send Error Code: " + error_8 + " Message: " + Ls_12 + " LT: " + DoubleToStr(Ld_204, LotDigit) + " OP: " + DoubleToStr(price_24, digit) + " SL: " +
               DoubleToStr(price_60, digit) + " Bid: " + DoubleToStr(Bid, digit) + " Ask: " + DoubleToStr(Ask, digit));
         }
      } else {
         price_24 = NormalizeDouble(Bid - PendingDistance, digit);
         price_60 = NormalizeDouble(price_24 + StopLoss * Point, digit);
         ticket_20 = OrderSend(Symbol(), OP_SELLSTOP, Ld_204, price_24, slippage, price_60, 0, TradeComment, MagicNumber, 0, Orange);
         if (ticket_20 <= 0) 
         {
            error_8 = GetLastError();
            Ls_12 = ErrorDescription(error_8);
            Print("BUYSELL Send Error Code: " + error_8 + " Message: " + Ls_12 + " LT: " + DoubleToStr(Ld_204, LotDigit) + " OP: " + DoubleToStr(price_24, digit) + " SL: " +
               DoubleToStr(price_60, digit) + " Bid: " + DoubleToStr(Bid, digit) + " Ask: " + DoubleToStr(Ask, digit));
         }
      }
   }
   string Ls_212 = "AvgSpread:" + DoubleToStr(AvgSpread, digit) + "  Commission rate:" + DoubleToStr(CommissionPoint, digit + 1) + "  Real avg. spread:" + DoubleToStr(Ld_164,
      digit + 1);
   if (Ld_164 > Gd_232) 
   {
      Ls_212 = Ls_212 
         + "\n" 
      + "The EA can not run with this spread ( " + DoubleToStr(Ld_164, digit + 1) + " > " + DoubleToStr(Gd_232, digit + 1) + " )";
   }
   if (count_184 != 0 || Li_180 != 0) 
   {
   }
   if (!IsTesting()) 
   {
      f0_2();
      f0_7();
      f0_0();
      lefttime();
      f0_8();
   }
   return (0);
}
			 	   	    	 			 						 				 			 		 	 	   				    	  	   		  	   		 		  	   	 				 		  		 			 	  	 		  		 		 	  				  	  		     		   					 	   
int WorkHour() 
{
   if ((Hour() > StartHour && Hour() < EndHour) || (Hour() == StartHour && Minute() >= StartMinute) || (Hour() == EndHour && Minute() < EndMinute)) return (1);
   return (0);
}
	  				  			  		  	 	  	 	  	 		  	 		   				  												 							 		 			 	 	          	  		    		     	  		 				  	 	  		 			 		   			      	 	
void f0_8() 
{
   Gd_336 = WindowPriceMax();
   Gd_344 = WindowPriceMin();
   ViewFirstTime = Time[WindowFirstVisibleBar()];
   ViewableBars = WindowFirstVisibleBar() - WindowBarsPerChart();
   if (ViewableBars < 0) ViewableBars = 0;
   G_datetime_360 = Time[ViewableBars] + 60 * Period();
   for (int i = 1; i <= Gi_392; i++) 
   {
      if (ObjectFind("Padding_rect" + i) == -1) ObjectCreate("Padding_rect" + i, OBJ_RECTANGLE, 0, ViewFirstTime, Gd_336 - (Gd_336 - Gd_344) / Gi_392 * (i - 1), G_datetime_360, Gd_336 - (Gd_336 - Gd_344) / Gi_392 * i);
      ObjectSet("Padding_rect" + i, OBJPROP_TIME1, ViewFirstTime);
      ObjectSet("Padding_rect" + i, OBJPROP_TIME2, G_datetime_360 - 1);
      ObjectSet("Padding_rect" + i, OBJPROP_PRICE1, Gd_336 - (Gd_336 - Gd_344) / Gi_392 * (i - 1));
      ObjectSet("Padding_rect" + i, OBJPROP_PRICE2, Gd_336 - (Gd_336 - Gd_344) / Gi_392 * i);
      ObjectSet("Padding_rect" + i, OBJPROP_BACK, TRUE);
      ObjectSet("Padding_rect" + i, OBJPROP_COLOR, colorcolor(Gs_364, Gs_372, Gi_392, i));
   }
   WindowRedraw();
}
	 	 	 	  	   			   			 	 							   		    	  		 			  	 				 		 				 		  				       		 	  	 	 		   	 	 	  	 	 											  	 		 	 				  		  		 		 	
int colorcolor(string As_0, string As_8, int Ai_16, int Ai_20) 
{
   int str2int_24 = StrToInteger(StringSubstr(As_0, 0, 3));
   int str2int_28 = StrToInteger(StringSubstr(As_0, 4, 3));
   int str2int_32 = StrToInteger(StringSubstr(As_0, 8, 3));
   int str2int_36 = StrToInteger(StringSubstr(As_8, 0, 3));
   int str2int_40 = StrToInteger(StringSubstr(As_8, 4, 3));
   int str2int_44 = StrToInteger(StringSubstr(As_8, 8, 3));
   if (str2int_24 > str2int_36) Gi_380 = str2int_24 + (str2int_36 - str2int_24) / Ai_16 * Ai_20;
   if (str2int_24 < str2int_36) Gi_380 = str2int_24 - (str2int_24 - str2int_36) / Ai_16 * Ai_20;
   if (str2int_28 > str2int_40) Gi_384 = str2int_28 + (str2int_40 - str2int_28) / Ai_16 * Ai_20;
   if (str2int_28 < str2int_40) Gi_384 = str2int_28 - (str2int_28 - str2int_40) / Ai_16 * Ai_20;
   if (str2int_32 > str2int_44) Gi_388 = str2int_32 + (str2int_44 - str2int_32) / Ai_16 * Ai_20;
   if (str2int_32 < str2int_44) Gi_388 = str2int_32 - (str2int_32 - str2int_44) / Ai_16 * Ai_20;
   Gi_384 *= 256;
   Gi_388 <<= 16;
   return (Gi_380 + Gi_384 + Gi_388);
}
			 			       		 	 		  	  			 		 	 			      	  		   					  						  			 		 	  	   			    			 	      	    			 	 			 			 	    				 	 		 			 			  	 	
void f0_2() 
{
   double Lda_0[10];
   double Lda_4[10];
   double Lda_8[10];
   double Lda_12[10];
   int Li_16;
   int Li_20;
   int Li_24;
   int Li_32;
   if (Period() < TrendTimeframe) 
   {
      ArrayCopySeries(Lda_0, 2, Symbol(), TrendTimeframe);
      ArrayCopySeries(Lda_4, 1, Symbol(), TrendTimeframe);
      ArrayCopySeries(Lda_8, 0, Symbol(), TrendTimeframe);
      ArrayCopySeries(Lda_12, 3, Symbol(), TrendTimeframe);
      Li_32 = 3;
      for (int Li_28 = 2; Li_28 >= 0; Li_28--) {
         Li_20 = Time[0] + Period() * (90 * Li_32);
         Li_24 = Time[0] + 90 * (Period() * (Li_32 + 1));
         if (ObjectFind("BD" + Li_28) == -1) {
            if (Lda_8[Li_28] > Lda_12[Li_28]) Li_16 = 170;
            else Li_16 = 43520;
            f0_6("D" + Li_28, Li_20, Li_24, Lda_8[Li_28], Lda_12[Li_28], Lda_4[Li_28], Lda_0[Li_28], Li_16);
         } else {
            if (Lda_8[Li_28] > Lda_12[Li_28]) Li_16 = 170;
            else Li_16 = 43520;
            f0_5("D" + Li_28, Li_20, Li_24, Lda_8[Li_28], Lda_12[Li_28], Lda_4[Li_28], Lda_0[Li_28], Li_16);
         }
         Li_32++;
         Li_32++;
      }
   }
}
			  	  	   	  			 	  			 		   			 	 		 	     		     	 	   	 	 	   	 			  	 			 					 	  		   	 	  		 	  		    	  		    	  	 	    				 						    
void f0_6(string As_0, int A_datetime_8, int A_datetime_12, double A_price_16, double A_price_24, double A_price_32, double A_price_40, color A_color_48) 
{
   if (A_price_16 == A_price_24) A_color_48 = Gray;
   ObjectCreate("B" + As_0, OBJ_RECTANGLE, 0, A_datetime_8, A_price_16, A_datetime_12, A_price_24);
   ObjectSet("B" + As_0, OBJPROP_STYLE, STYLE_SOLID);
   ObjectSet("B" + As_0, OBJPROP_COLOR, A_color_48);
   ObjectSet("B" + As_0, OBJPROP_BACK, TRUE);
   int datetime_52 = A_datetime_8 + (A_datetime_12 - A_datetime_8) / 2;
   ObjectCreate("S" + As_0, OBJ_TREND, 0, datetime_52, A_price_32, datetime_52, A_price_40);
   ObjectSet("S" + As_0, OBJPROP_COLOR, A_color_48);
   ObjectSet("S" + As_0, OBJPROP_BACK, TRUE);
   ObjectSet("S" + As_0, OBJPROP_RAY, FALSE);
   ObjectSet("S" + As_0, OBJPROP_WIDTH, 2);
}
		   	    	 	  	 			  		   	   	 			 		   	   			 	  	 		 		 	 		 		 				   			  	 		 	 		    	   			 	 		     		  	      		 	  	  			 	 	 		   	
void f0_5(string As_0, int A_datetime_8, int A_datetime_12, double Ad_16, double Ad_24, double Ad_32, double Ad_40, color A_color_48) 
{
   if (Ad_16 == Ad_24) A_color_48 = Gray;
   ObjectSet("B" + As_0, OBJPROP_TIME1, A_datetime_8);
   ObjectSet("B" + As_0, OBJPROP_PRICE1, Ad_16);
   ObjectSet("B" + As_0, OBJPROP_TIME2, A_datetime_12);
   ObjectSet("B" + As_0, OBJPROP_PRICE2, Ad_24);
   ObjectSet("B" + As_0, OBJPROP_BACK, TRUE);
   ObjectSet("B" + As_0, OBJPROP_COLOR, A_color_48);
   int datetime_52 = A_datetime_8 + (A_datetime_12 - A_datetime_8) / 2;
   ObjectSet("S" + As_0, OBJPROP_TIME1, datetime_52);
   ObjectSet("S" + As_0, OBJPROP_PRICE1, Ad_32);
   ObjectSet("S" + As_0, OBJPROP_TIME2, datetime_52);
   ObjectSet("S" + As_0, OBJPROP_PRICE2, Ad_40);
   ObjectSet("S" + As_0, OBJPROP_BACK, TRUE);
   ObjectSet("S" + As_0, OBJPROP_WIDTH, 2);
   ObjectSet("S" + As_0, OBJPROP_COLOR, A_color_48);
}
		 	 				 			 	 			     	     	 			  	 		 		      		 		   	  		   	  	     			 			  	  	 	 	   		 	 	  	 	 	  	       			 	  			    			 		  	 		 
void f0_7() 
{
   double Ld_0 = (Ask - Bid) / Gd_420;
   string text_8 = "Spread: " + DoubleToStr(Ld_0, 1) + " pips";
   if (ObjectFind(G_name_412) < 0) {
      ObjectCreate(G_name_412, OBJ_LABEL, 0, 0, 0);
      ObjectSet(G_name_412, OBJPROP_CORNER, 1);
      ObjectSet(G_name_412, OBJPROP_YDISTANCE, 260);
      ObjectSet(G_name_412, OBJPROP_XDISTANCE, 10);
      ObjectSetText(G_name_412, text_8, 13, "Arial", G_color_408);
   }
   ObjectSetText(G_name_412, text_8);
   WindowRedraw();
}
	 					  	 	  		    	  	 		 	 		    		   	 		  			 							  						  		 					 	    	     	 			    	      	 			 					 	 	  	  			 			  			  	   	 	
void lefttime()
{
   int Li_8 = Time[0] + 60 * Period() - TimeCurrent();
   double Ld_0 = Li_8 / 60.0;
   int Li_12 = Li_8 % 60;
   Li_8 = (Li_8 - Li_8 % 60) / 60;
   Comment(Li_8 + " minutes " + Li_12 + " seconds left to bar end");
   ObjectDelete("time");
   if (ObjectFind("time") != 0) {
      ObjectCreate("time", OBJ_TEXT, 0, Time[0], Close[0] + 0.0005);
      ObjectSetText("time", "                                 <--" + Li_8 + ":" + Li_12, 13, "Verdana", Yellow);
      return;
   }
   ObjectMove("time", 0, Time[0], Close[0] + 0.0005);
}
	 			   		 	 	 		   							 		 		   	 	 		 					 	 		  	 	  	  	 	  	 		 			  	 	 	  		   					 		   		   				 	 		 		  		  	    		    		 	  	   
void f0_0() 
{
   int i = iBarShift(NULL, PERIOD_D1, Time[0]) + 1;
   G_ihigh_444 = iHigh(NULL, PERIOD_D1, i);
   G_ilow_452 = iLow(NULL, PERIOD_D1, i);
   G_datetime_468 = iTime(NULL, PERIOD_D1, i);
   if (TimeDayOfWeek(G_datetime_468) == 0) {
      G_ihigh_444 = MathMax(G_ihigh_444, iHigh(NULL, PERIOD_D1, i + 1));
      G_ilow_452 = MathMin(G_ilow_452, iLow(NULL, PERIOD_D1, i + 1));
   }
   Gd_460 = G_ihigh_444 - G_ilow_452;
   f0_1();
}
	 	 			  	    		   		  	 				 		   			   	  	  			  						 							 			 				  	    		    	 	 	    	 	    	 	 	 							 	  	 				 				 			  		  	 	
int f0_1() {
   if (ObjectFind("FiboUp") == -1) ObjectCreate("FiboUp", OBJ_FIBO, 0, G_datetime_468, G_ihigh_444 + Gd_460, G_datetime_468, G_ihigh_444);
   else {
      ObjectSet("FiboUp", OBJPROP_TIME2, G_datetime_468);
      ObjectSet("FiboUp", OBJPROP_TIME1, G_datetime_468);
      ObjectSet("FiboUp", OBJPROP_PRICE1, G_ihigh_444 + Gd_460);
      ObjectSet("FiboUp", OBJPROP_PRICE2, G_ihigh_444);
   }
   ObjectSet("FiboUp", OBJPROP_LEVELCOLOR, G_color_428);
   ObjectSet("FiboUp", OBJPROP_FIBOLEVELS, 13);
   ObjectSet("FiboUp", OBJPROP_FIRSTLEVEL, 0.0);
   ObjectSetFiboDescription("FiboUp", 0, "(100.0%) -  %$");
   ObjectSet("FiboUp", 211, 0.236);
   ObjectSetFiboDescription("FiboUp", 1, "(123.6%) -  %$");
   ObjectSet("FiboUp", 212, 0.382);
   ObjectSetFiboDescription("FiboUp", 2, "(138.2%) -  %$");
   ObjectSet("FiboUp", 213, 0.5);
   ObjectSetFiboDescription("FiboUp", 3, "(150.0%) -  %$");
   ObjectSet("FiboUp", 214, 0.618);
   ObjectSetFiboDescription("FiboUp", 4, "(161.8%) -  %$");
   ObjectSet("FiboUp", 215, 0.764);
   ObjectSetFiboDescription("FiboUp", 5, "(176.4%) -  %$");
   ObjectSet("FiboUp", 216, 1.0);
   ObjectSetFiboDescription("FiboUp", 6, "(200.0%) -  %$");
   ObjectSet("FiboUp", 217, 1.236);
   ObjectSetFiboDescription("FiboUp", 7, "(223.6%) -  %$");
   ObjectSet("FiboUp", 218, 1.5);
   ObjectSetFiboDescription("FiboUp", 8, "(250.0%) -  %$");
   ObjectSet("FiboUp", 219, 1.618);
   ObjectSetFiboDescription("FiboUp", 9, "(261.8%) -  %$");
   ObjectSet("FiboUp", 220, 2.0);
   ObjectSetFiboDescription("FiboUp", 10, "(300.0%) -  %$");
   ObjectSet("FiboUp", 221, 2.5);
   ObjectSetFiboDescription("FiboUp", 11, "(350.0%) -  %$");
   ObjectSet("FiboUp", 222, 3.0);
   ObjectSetFiboDescription("FiboUp", 12, "(400.0%) -  %$");
   ObjectSet("FiboUp", 223, 3.5);
   ObjectSetFiboDescription("FiboUp", 13, "(450.0%) -  %$");
   ObjectSet("FiboUp", 224, 4.0);
   ObjectSetFiboDescription("FiboUp", 14, "(500.0%) -  %$");
   ObjectSet("FiboUp", OBJPROP_RAY, TRUE);
   ObjectSet("FiboUp", OBJPROP_BACK, TRUE);
   if (ObjectFind("FiboDn") == -1) ObjectCreate("FiboDn", OBJ_FIBO, 0, G_datetime_468, G_ilow_452 - Gd_460, G_datetime_468, G_ilow_452);
   else {
      ObjectSet("FiboDn", OBJPROP_TIME2, G_datetime_468);
      ObjectSet("FiboDn", OBJPROP_TIME1, G_datetime_468);
      ObjectSet("FiboDn", OBJPROP_PRICE1, G_ilow_452 - Gd_460);
      ObjectSet("FiboDn", OBJPROP_PRICE2, G_ilow_452);
   }
   ObjectSet("FiboDn", OBJPROP_LEVELCOLOR, G_color_436);
   ObjectSet("FiboDn", OBJPROP_FIBOLEVELS, 19);
   ObjectSet("FiboDn", OBJPROP_FIRSTLEVEL, 0.0);
   ObjectSetFiboDescription("FiboDn", 0, "(0.0%) -  %$");
   ObjectSet("FiboDn", 211, 0.236);
   ObjectSetFiboDescription("FiboDn", 1, "(-23.6%) -  %$");
   ObjectSet("FiboDn", 212, 0.382);
   ObjectSetFiboDescription("FiboDn", 2, "(-38.2%) -  %$");
   ObjectSet("FiboDn", 213, 0.5);
   ObjectSetFiboDescription("FiboDn", 3, "(-50.0%) -  %$");
   ObjectSet("FiboDn", 214, 0.618);
   ObjectSetFiboDescription("FiboDn", 4, "(-61.8%) -  %$");
   ObjectSet("FiboDn", 215, 0.764);
   ObjectSetFiboDescription("FiboDn", 5, "(-76.4%) -  %$");
   ObjectSet("FiboDn", 216, 1.0);
   ObjectSetFiboDescription("FiboDn", 6, "(-100.0%) -  %$");
   ObjectSet("FiboDn", 217, 1.236);
   ObjectSetFiboDescription("FiboDn", 7, "(-123.6%) -  %$");
   ObjectSet("FiboDn", 218, 1.382);
   ObjectSetFiboDescription("FiboDn", 8, "(-138.2%) -  %$");
   ObjectSet("FiboDn", 219, 1.5);
   ObjectSetFiboDescription("FiboDn", 9, "(-150.0%) -  %$");
   ObjectSet("FiboDn", 220, 1.618);
   ObjectSetFiboDescription("FiboDn", 10, "(-161.8%) -  %$");
   ObjectSet("FiboDn", 221, 1.764);
   ObjectSetFiboDescription("FiboDn", 11, "(-176.4%) -  %$");
   ObjectSet("FiboDn", 222, 2.0);
   ObjectSetFiboDescription("FiboDn", 12, "(-200.0%) -  %$");
   ObjectSet("FiboDn", 223, 2.5);
   ObjectSetFiboDescription("FiboDn", 13, "(-250.0%) -  %$");
   ObjectSet("FiboDn", 224, 3.0);
   ObjectSetFiboDescription("FiboDn", 14, "(-300.0%) -  %$");
   ObjectSet("FiboDn", 225, 3.5);
   ObjectSetFiboDescription("FiboDn", 15, "(-350.0%) -  %$");
   ObjectSet("FiboDn", 226, 4.0);
   ObjectSetFiboDescription("FiboDn", 16, "(-400.0%) -  %$");
   ObjectSet("FiboDn", 227, 4.5);
   ObjectSetFiboDescription("FiboDn", 17, "(-450.0%) -  %$");
   ObjectSet("FiboDn", 228, 5.0);
   ObjectSetFiboDescription("FiboDn", 18, "(-500.0%) -  %$");
   ObjectSet("FiboDn", OBJPROP_RAY, TRUE);
   ObjectSet("FiboDn", OBJPROP_BACK, TRUE);
   if (Gi_440) {
      if (ObjectFind("FiboIn") == -1) ObjectCreate("FiboIn", OBJ_FIBO, 0, G_datetime_468, G_ihigh_444, G_datetime_468 + 86400, G_ilow_452);
      else {
         ObjectSet("FiboIn", OBJPROP_TIME2, G_datetime_468);
         ObjectSet("FiboIn", OBJPROP_TIME1, G_datetime_468 + 86400);
         ObjectSet("FiboIn", OBJPROP_PRICE1, G_ihigh_444);
         ObjectSet("FiboIn", OBJPROP_PRICE2, G_ilow_452);
      }
      ObjectSet("FiboIn", OBJPROP_LEVELCOLOR, G_color_432);
      ObjectSet("FiboIn", OBJPROP_FIBOLEVELS, 7);
      ObjectSet("FiboIn", OBJPROP_FIRSTLEVEL, 0.0);
      ObjectSetFiboDescription("FiboIn", 0, "Daily LOW (0.0) -  %$");
      ObjectSet("FiboIn", 211, 0.236);
      ObjectSetFiboDescription("FiboIn", 1, "(23.6) -  %$");
      ObjectSet("FiboIn", 212, 0.382);
      ObjectSetFiboDescription("FiboIn", 2, "(38.2) -  %$");
      ObjectSet("FiboIn", 213, 0.5);
      ObjectSetFiboDescription("FiboIn", 3, "(50.0) -  %$");
      ObjectSet("FiboIn", 214, 0.618);
      ObjectSetFiboDescription("FiboIn", 4, "(61.8) -  %$");
      ObjectSet("FiboIn", 215, 0.764);
      ObjectSetFiboDescription("FiboIn", 5, "(76.4) -  %$");
      ObjectSet("FiboIn", 216, 1.0);
      ObjectSetFiboDescription("FiboIn", 6, "Daily HIGH (100.0) -  %$");
      ObjectSet("FiboIn", OBJPROP_RAY, TRUE);
      ObjectSet("FiboIn", OBJPROP_BACK, TRUE);
   } else ObjectDelete("FiboIn");
   return (0);
}


本博客所有文章如无特别注明均为原创。作者:天泓评测
分享到:更多

相关推荐

发表评论

路人甲 表情
Ctrl+Enter快速提交

网友评论(0)