Navigation:Home > Content >

RoyaleWaveSell.mq4

Time: 2010-06-22 | Download file:RoyaleWaveSell.mq4

#property copyright "Copyright © 2007, ProfitSantai-5.1"
#property link      "http://www.santaiforex.afcobiz.com"

string Gs_rw0004_76 = "RW0004";
string Gs_84 = "[email protected]";
extern string BasicOption = "***  Basic Option  ***";
extern double TakeProfit = 50.0;
double Gd_108;
extern double StopLoss = 0.0;
extern double SizeLot = 0.1;
extern int MaxTrades = 20;
extern int Pips = 100;
extern string OpenPositionInfo = "TRUE = Buy Only, FALSE = Sell Only";
extern bool OpenPosition = FALSE;
extern bool OpenSupport = TRUE;
extern int Magic_Number = 20202;
int Gi_unused_152 = 1;
int Gi_unused_156 = 6;
int Gi_160 = 50;
double Gd_164 = 2.0;
double Gd_172 = 3.0;
double Gd_180 = 3.0;
double Gd_188 = 2.0;
double Gd_196 = 5.0;
double Gd_204 = 5.0;
int Gi_212 = 2003;
int Gi_216 = 1;
int Gi_220 = 2050;
int Gi_224 = 12;
int Gi_unused_228 = 22;
int Gi_unused_232 = 30;
int Gi_236 = 0;
int Gi_240 = 12;
int Gi_244 = 0;
int G_count_248 = 0;
int G_pos_252 = 0;
int G_slippage_256 = 5;
double G_price_260 = 0.0;
double G_price_268 = 0.0;
double G_ask_276 = 0.0;
double G_bid_284 = 0.0;
double Gd_292 = 0.0;
double G_lots_300 = 0.0;
int G_cmd_308 = OP_BUY;
int Gi_312 = 0;
int Gi_unused_316 = 0;
bool Gi_320 = TRUE;
double G_order_open_price_324 = 0.0;
int Gi_unused_332 = 0;
double Gd_unused_336 = 0.0;
int Gi_unused_344 = 0;
int Gi_unused_348 = 0;
double Gd_unused_352 = 0.0;
double Gd_unused_360 = 0.0;
double Gd_unused_368 = 0.0;
double Gd_376 = 0.0;
string Gs_384 = "";
string Gs_unused_392 = "";
string Gs_400;
int Gi_unused_408 = 16711680;
double Gda_412[2][6];
int G_period_416 = 100;
int G_ma_method_420 = MODE_SMA;
int G_applied_price_424 = PRICE_CLOSE;
int G_period_428 = 10;
int G_ma_method_432 = MODE_SMA;
int G_applied_price_436 = PRICE_CLOSE;

int init() {
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   Gd_108 = SizeLot;
   if (Gi_244 == 1) {
      if (Gi_236 != 0) Gd_292 = MathCeil(AccountBalance() * Gi_240 / 10000.0);
      else Gd_292 = Gd_108;
   } else {
      if (Gi_236 != 0) Gd_292 = MathCeil(AccountBalance() * Gi_240 / 10000.0) / 10.0;
      else Gd_292 = Gd_108;
   }
   if (Gd_292 > 100.0) Gd_292 = 100;
   G_count_248 = 0;
   for (G_pos_252 = 0; G_pos_252 < OrdersTotal(); G_pos_252++) {
      OrderSelect(G_pos_252, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol() == Symbol()) G_count_248++;
   }
   if (G_count_248 < 1) {
      if (TimeYear(TimeCurrent()) < Gi_212) return (0);
      if (TimeMonth(TimeCurrent()) < Gi_216) return (0);
      if (TimeYear(TimeCurrent()) > Gi_220) return (0);
      if (TimeMonth(TimeCurrent()) > Gi_224) return (0);
   }
   if (Symbol() == "EURUSD") Gd_376 = Gd_164;
   if (Symbol() == "GBPUSD") Gd_376 = Gd_172;
   if (Symbol() == "USDJPY") Gd_376 = Gd_188;
   if (Symbol() == "USDCHF") Gd_376 = Gd_180;
   if (Symbol() == "GBPJPY") Gd_376 = Gd_196;
   if (Symbol() == "EURJPY") Gd_376 = Gd_204;
   if (Gd_376 == 0.0) Gd_376 = 5;
   if (G_count_248 >= MaxTrades) Gi_320 = FALSE;
   else Gi_320 = TRUE;
   int Li_0 = 0;
   if (TimeMinute(Gda_412[Li_0][0]) == 0 && TimeHour(Gda_412[Li_0][0]) == 0) G_order_open_price_324 = 0;
   if (G_order_open_price_324 == 0.0) {
      for (G_pos_252 = 0; G_pos_252 < OrdersTotal(); G_pos_252++) {
         OrderSelect(G_pos_252, SELECT_BY_POS, MODE_TRADES);
         G_cmd_308 = OrderType();
         if (OrderSymbol() == Symbol()) {
            G_order_open_price_324 = OrderOpenPrice();
            if (G_cmd_308 == OP_BUY) Gi_312 = 2;
            if (G_cmd_308 == OP_SELL) Gi_312 = 1;
         }
      }
   }
   if (G_count_248 < 1) {
      Gi_312 = 3;
      if (OpenPosition == TRUE) Gi_312 = 2;
      if (OpenPosition == FALSE) Gi_312 = 1;
      if (Gi_160 == 1) {
         if (Gi_312 == 1) Gi_312 = 2;
         else
            if (Gi_312 == 2) Gi_312 = 1;
      }
   }
   if ((!IsTesting()) || IsTesting()) {
      if (iMA(NULL, 0, G_period_428, 0, G_ma_method_432, G_applied_price_436, 0) > iMA(NULL, 0, G_period_416, 0, G_ma_method_420, G_applied_price_424, 0) && iMA(NULL, 0,
         G_period_428, 0, G_ma_method_432, G_applied_price_436, 1) > iMA(NULL, 0, G_period_416, 0, G_ma_method_420, G_applied_price_424, 1)) Gs_400 = "UP";
      if (iMA(NULL, 0, G_period_428, 0, G_ma_method_432, G_applied_price_436, 0) < iMA(NULL, 0, G_period_416, 0, G_ma_method_420, G_applied_price_424, 0) && iMA(NULL, 0,
         G_period_428, 0, G_ma_method_432, G_applied_price_436, 1) < iMA(NULL, 0, G_period_416, 0, G_ma_method_420, G_applied_price_424, 1)) Gs_400 = "DOWN";
      if (Gi_312 == 3) Gs_384 = "Waiting for next Signal";
      else Gs_384 = " ";
      Comment("EARoyaleWave", 
         "\nwww.santaiforex.afcobiz.com", 
         "\nForex Account Server : ", AccountServer(), 
         "\nDate : ", Month(), "-", Day(), "-", Year(), 
         "\n", "Server Time: ", Hour(), ":", Minute(), ":", Seconds(), 
         "\nSerial Number : ", Gs_rw0004_76, 
         "\nEmail Address : ", Gs_84, 
         "\nAccount Name : ", AccountName(), 
         "\n", 
         "\nTrend : ", Gs_400, 
      "\n", Gs_384);
   }
   if (Gi_312 == 1 && Gi_320 == TRUE && OpenSupport == FALSE && iMA(NULL, 0, G_period_428, 0, G_ma_method_432, G_applied_price_436, 0) < iMA(NULL, 0, G_period_416, 0,
      G_ma_method_420, G_applied_price_424, 0) && iMA(NULL, 0, G_period_428, 0, G_ma_method_432, G_applied_price_436, 1) < iMA(NULL, 0, G_period_416, 0, G_ma_method_420,
      G_applied_price_424, 1)) {
      if (Bid - G_order_open_price_324 >= Pips * Point || G_count_248 < 1) {
         G_bid_284 = Bid;
         G_order_open_price_324 = 0;
         if (TakeProfit == 0.0) G_price_268 = 0;
         else G_price_268 = G_bid_284 - TakeProfit * Point;
         if (StopLoss == 0.0) G_price_260 = 0;
         else G_price_260 = G_bid_284 + StopLoss * Point;
         if (G_count_248 != 0) {
            G_lots_300 = Gd_292;
            for (G_pos_252 = 1; G_pos_252 <= G_count_248; G_pos_252++) {
               if (MaxTrades > 12) G_lots_300 = NormalizeDouble(1.0 * G_lots_300, 2);
               else G_lots_300 = NormalizeDouble(1.0 * G_lots_300, 2);
            }
         } else G_lots_300 = Gd_292;
         if (G_lots_300 > 100.0) G_lots_300 = 100;
         OrderSend(Symbol(), OP_SELL, G_lots_300, G_bid_284, G_slippage_256, G_price_260, G_price_268, "EARoyaleWave", Magic_Number, 0, Red);
         return (0);
      }
   }
   if (Gi_312 == 2 && Gi_320 == TRUE && OpenSupport == FALSE && iMA(NULL, 0, G_period_428, 0, G_ma_method_432, G_applied_price_436, 0) > iMA(NULL, 0, G_period_416, 0,
      G_ma_method_420, G_applied_price_424, 0) && iMA(NULL, 0, G_period_428, 0, G_ma_method_432, G_applied_price_436, 1) > iMA(NULL, 0, G_period_416, 0, G_ma_method_420,
      G_applied_price_424, 1)) {
      if (G_order_open_price_324 - Ask >= Pips * Point || G_count_248 < 1) {
         G_ask_276 = Ask;
         G_order_open_price_324 = 0;
         if (TakeProfit == 0.0) G_price_268 = 0;
         else G_price_268 = G_ask_276 + TakeProfit * Point;
         if (StopLoss == 0.0) G_price_260 = 0;
         else G_price_260 = G_ask_276 - StopLoss * Point;
         if (G_count_248 != 0) {
            G_lots_300 = Gd_292;
            for (G_pos_252 = 1; G_pos_252 <= G_count_248; G_pos_252++) {
               if (MaxTrades > 12) G_lots_300 = NormalizeDouble(1.0 * G_lots_300, 2);
               else G_lots_300 = NormalizeDouble(1.0 * G_lots_300, 2);
            }
         } else G_lots_300 = Gd_292;
         if (G_lots_300 > 100.0) G_lots_300 = 100;
         OrderSend(Symbol(), OP_BUY, G_lots_300, G_ask_276, G_slippage_256, G_price_260, G_price_268, "EARoyaleWave", Magic_Number, 0, Blue);
         return (0);
      }
   }
   if (Gi_312 == 1 && Gi_320 == TRUE && OpenSupport == TRUE) {
      if (Bid - G_order_open_price_324 >= Pips * Point || G_count_248 < 1) {
         G_bid_284 = Bid;
         G_order_open_price_324 = 0;
         if (TakeProfit == 0.0) G_price_268 = 0;
         else G_price_268 = G_bid_284 - TakeProfit * Point;
         if (StopLoss == 0.0) G_price_260 = 0;
         else G_price_260 = G_bid_284 + StopLoss * Point;
         if (G_count_248 != 0) {
            G_lots_300 = Gd_292;
            for (G_pos_252 = 1; G_pos_252 <= G_count_248; G_pos_252++) {
               if (MaxTrades > 12) G_lots_300 = NormalizeDouble(1.0 * G_lots_300, 2);
               else G_lots_300 = NormalizeDouble(1.0 * G_lots_300, 2);
            }
         } else G_lots_300 = Gd_292;
         if (G_lots_300 > 100.0) G_lots_300 = 100;
         OrderSend(Symbol(), OP_SELL, G_lots_300, G_bid_284, G_slippage_256, G_price_260, G_price_268, "EARoyaleWave", Magic_Number, 0, Red);
         return (0);
      }
   }
   if (Gi_312 == 2 && Gi_320 == TRUE && OpenSupport == TRUE) {
      if (G_order_open_price_324 - Ask >= Pips * Point || G_count_248 < 1) {
         G_ask_276 = Ask;
         G_order_open_price_324 = 0;
         if (TakeProfit == 0.0) G_price_268 = 0;
         else G_price_268 = G_ask_276 + TakeProfit * Point;
         if (StopLoss == 0.0) G_price_260 = 0;
         else G_price_260 = G_ask_276 - StopLoss * Point;
         if (G_count_248 != 0) {
            G_lots_300 = Gd_292;
            for (G_pos_252 = 1; G_pos_252 <= G_count_248; G_pos_252++) {
               if (MaxTrades > 12) G_lots_300 = NormalizeDouble(1.0 * G_lots_300, 2);
               else G_lots_300 = NormalizeDouble(1.0 * G_lots_300, 2);
            }
         } else G_lots_300 = Gd_292;
         if (G_lots_300 > 100.0) G_lots_300 = 100;
         OrderSend(Symbol(), OP_BUY, G_lots_300, G_ask_276, G_slippage_256, G_price_260, G_price_268, "EARoyaleWave", Magic_Number, 0, Blue);
         return (0);
      }
   }
   return (0);
}

Recommend