Jump to content

toritoo

Members
  • Posts

    30
  • Joined

  • Last visited

Posts posted by toritoo

  1. Re: {req} how to modify an ea

     

    Hi toritoo,

     

    Good day,

     

    I'm sorry for the delay.

     

    Just one quick question. The additional order you want me to add, what kind?? I mean I can add for buy option another buy position or buystop or buylimit, and the opposite for sell option....like Sell position, Sellstop or Selllimit.

     

    please let me know.

     

    Best wishes,

     

    good day to you too

     

    i just want another buy position and the opposite for sell

  2. Re: REQ: BBW Scalper

     

    Yes toritoo, I do.

    But this EA needs to be educated from DLL file. Since we have no access to the ShouldBuy/Sell functions.

    The DLL has 5 functions Init, GetStatus, ShouldBuy, ShouldSell and DeInit. If we cannot surpass Init function (the one that checks for user name and password) we just can't have access to the two primary logics functions (ShouldSell/Buy ones).

    The DLL is encrypted, it's difficult to decrypt for me.

     

    do you think you can modificate one EA for me

  3. Hi guys,

    Can anybody educate:

    hxxp://www.inv3storsh4v3n.com/Downloads.html

     

    thanks

     

     

    here is educated it

     

    #property copyright "Copyright © 2009, Investors Haven"
    #property link      "[email protected]"
    
    #include <stdlib.mqh>
    
    #import "BBW_Scalper_v4_4_0_Pro.dll"
      int Init(string a0, string a1, string a2, string a3, string a4, string a5);
      int GetStatus(string& a0[]);
      bool ShouldSell(string a0, double a1, double a2, double a3, double a4, double a5, double a6, double a7, double a8, double a9, double a10, double a11, double a12, int a13, int a14, double a15, double a16, double a17);
      bool ShouldBuy(string a0, double a1, double a2, double a3, double a4, double a5, double a6, double a7, double a8, double a9, double a10, double a11, double a12, int a13, int a14, double a15, double a16, double a17);
      void Uninit(string a0);
    #import
    
    string gs_76 = "v4_4_0";
    extern string AUTHENTICATION = "------";
    extern string Username = "";
    extern string Password = "";
    extern string BROKER_sETTING = "-------";
    extern bool UseECNExecution = FALSE;
    extern string UNIQUE_CHART_VALUES = "-------";
    extern int MagicNumber = 143;
    extern string DIVERSIFICATION_SETTING = "-----";
    extern int NumOfPairs = 6;
    extern string EARNING_SETTINGS = "-----";
    extern int BreakEvenSpread = 0;
    extern double TakeProfit = 400.0;
    extern bool EnableAccelerator = TRUE;
    extern int MaxOrderSize = 50;
    extern int MaxOrders = 5;
    extern double Risk = 50.0;
    extern double MarginLevelMin = 1000.0;
    extern string TRAILING_STOP_SETTINGS = "-------";
    extern double StartTrailingAfterPips = 45.0;
    extern double TrailingStopPips = 20.0;
    extern string STOP_LOSS_SETTINGS = "-----";
    extern double StopLoss = 0.0;
    extern string SPREAD_PROTECTION = "-----";
    extern double SpreadMax = 0.0;
    extern string OPEN_DRAWDOWN_SETTINGS = "-----";
    extern string __STOP_TAKING_NEW_TRADES = "-----";
    extern bool StopOpeningTrades = FALSE;
    extern bool EnableMaxDrawdownProtection = TRUE;
    extern double MaxDrawdownInPips = 200.0;
    extern bool EnableTrimmer = FALSE;
    extern int ActivateEveryCandle = 1;
    extern string __COLLECT_EARNINGS = "-----";
    extern bool EnableCashCollection = TRUE;
    extern double CashCollectInPips = 10.0;
    extern string __CLEAN_ORDERS = "----";
    extern bool CloseAllOpenOrders = FALSE;
    extern bool CloseAllPositiveOrders = FALSE;
    extern bool CloseAllNegativeOrders = FALSE;
    extern bool GLOBALCloseAllOpenOrders = FALSE;
    extern bool GLOBALCloseAllPositiveOrders = FALSE;
    extern bool GLOBALCloseAllNegativeOrders = FALSE;
    extern string TROUBLESHOOTING_SETTING = "-----";
    extern bool EnableLog = FALSE;
    int gi_352 = 0;
    int gi_356 = 1;
    double g_lots_360 = 0.1;
    double gd_368;
    datetime g_time_392;
    datetime g_time_396;
    double gd_400 = 0.0;
    double gd_408 = 0.0;
    double gd_416 = 0.0;
    double gd_424 = 0.0;
    string gsa_432[] = {""};
    double gda_436[2];
    int g_slippage_440;
    int g_count_444 = 0;
    
    int init() {
      if (Digits < 4) gd_400 = 0.01;
      else gd_400 = 0.0001;
      if (Digits == 3 || Digits == 5) gd_424 = 0.1;
      else gd_424 = 1.0;
      if (StopLoss < MarketInfo(Symbol(), MODE_STOPLEVEL) && StopLoss > 0.0) {
         Alert("StopLoss not allowed by broker", MarketInfo(Symbol(), MODE_STOPLEVEL), " for Symbol: ", Symbol());
         return (1);
      }
      HideTestIndicators(TRUE);
      gsa_432[0] = "1234567891123456";
      for (int li_0 = 4; li_0 < 11; li_0++) gsa_432[0] = gsa_432[0] + gsa_432[0];
      if (Init(AccountName(), AccountNumber(), Symbol(), AccountCompany(), Username, Password) == 0) {
         Comment("Failed to start the EA. Make sure you do not run it twice on the same pair.");
         return (1);
      }
      gi_352 = MaxOrders;
      return (0);
    }
    
    int deinit() {
      Uninit(Symbol());
      return (0);
    }
    
    int start() {
      CheckLicense();
      double l_icustom_0 = iCustom(NULL, 0, "$BBW2_" + gs_76, 0, 0);
      double l_icustom_8 = iCustom(NULL, 0, "$BBW2_" + gs_76, 1, 0);
      double l_icustom_16 = iCustom(NULL, 0, "$BBW2_" + gs_76, 1, 1);
      double l_icustom_24 = iCustom(NULL, 0, "$BBW2_" + gs_76, 2, 0);
      double l_icustom_32 = iCustom(NULL, 0, "$BBW2_" + gs_76, 2, 1);
      double l_icustom_40 = iCustom(NULL, 0, "$BBW_linreg_" + gs_76, 0, 0);
      double l_istochastic_48 = iStochastic(Symbol(), 0, 14, 3, 3, MODE_SMA, 0, MODE_SIGNAL, 0);
      double l_istochastic_56 = iStochastic(Symbol(), 0, 14, 3, 3, MODE_SMA, 0, MODE_MAIN, 0);
      double l_isar_64 = iSAR(Symbol(), 0, 0.02, 0.2, 0);
      DoModifyECNTrades();
      DoTrailingStops();
      ArrayInitialize(gda_436, 0.0);
      if (CloseAllOpenOrders) ClosingAllOrders();
      ArrayInitialize(gda_436, 0.0);
      if (GLOBALCloseAllOpenOrders) GLOBALClosingAllOrders();
      ArrayInitialize(gda_436, 0.0);
      if (GLOBALCloseAllPositiveOrders) GLOBALClosingAllPosOrders();
      ArrayInitialize(gda_436, 0.0);
      if (GLOBALCloseAllNegativeOrders) GLOBALClosingAllNegOrders();
      ArrayInitialize(gda_436, 0.0);
      if (CloseAllPositiveOrders) ClosingAllPosOrders();
      ArrayInitialize(gda_436, 0.0);
      if (CloseAllNegativeOrders) ClosingAllNegOrders();
      ArrayInitialize(gda_436, 0.0);
      if (EnableCashCollection == TRUE) CashCollector();
      if (EnableTrimmer) {
         if (Time[0] != g_time_396) {
            g_count_444++;
            if (g_count_444 >= ActivateEveryCandle) {
               TrimBad();
               g_count_444 = 0;
            }
            g_time_396 = Time[0];
         }
      }
      if (EnableMaxDrawdownProtection == TRUE) MaxDDProt();
      if (StopOpeningTrades) return (0);
      if (AccountMargin() > 0.0) {
         gd_408 = 100.0 * (AccountEquity() / AccountMargin());
         if (gd_408 <= MarginLevelMin) {
            Print("Magrin Level is below the min");
            return (0);
         }
      }
      if (SpreadMax > 0.0) {
         gd_416 = MarketInfo(Symbol(), MODE_SPREAD) * gd_424;
         if (gd_416 > SpreadMax) {
            Print("Spread is greater than SpreadMax");
            return (0);
         }
      }
      if (!IsTradeAllowed() || Time[0] == g_time_392) return (0);
      g_time_392 = Time[0];
      if (!(AccountFreeMargin() > AccountBalance() / 2.0)) {
         Print("Free Margin is less than half the balance");
         return (0);
      }
      if (EnableAccelerator == TRUE) GetAccellerated();
      int li_72 = GetOrdersTotal();
      double l_price_76 = 0;
      if (TakeProfit > 0.0 && !UseECNExecution) l_price_76 = TakeProfit * gd_400;
      double l_price_84 = 0;
      if (StopLoss > 0.0 && !UseECNExecution) l_price_84 = StopLoss * gd_400;
      int l_ticket_92 = 0;
      int l_error_96 = 0;
      if (ShouldSell(Symbol(), Ask, Bid, gd_400, l_icustom_8, l_icustom_16, l_icustom_24, l_icustom_32, l_icustom_0, l_icustom_40, l_istochastic_48, l_istochastic_56, l_isar_64, li_72, MaxOrders, High[2], Open[1], Close[1])) {
         if (l_price_84 != 0.0) l_price_84 = Bid + l_price_84;
         if (l_price_76 != 0.0) l_price_76 = Bid - l_price_76;
         gi_356 = 1;
         g_lots_360 = GetLots();
         if (gi_356 > 1) {
            for (int li_100 = 1; li_100 <= gi_356; li_100++) {
               RefreshRates();
               l_ticket_92 = OrderSend(Symbol(), OP_SELL, g_lots_360, Bid, 3, l_price_84, l_price_76, StringConcatenate("BW_Scalp_", Symbol(), "_Sell"), MagicNumber, 0, Red);
               if (l_ticket_92 == -1) l_error_96 = GetLastError();
               Sleep(1000);
            }
         } else {
            l_ticket_92 = OrderSend(Symbol(), OP_SELL, g_lots_360, Bid, 3, l_price_84, l_price_76, StringConcatenate("BW_Scalp_", Symbol(), "_Sell"), MagicNumber, 0, Red);
            if (l_ticket_92 == -1) l_error_96 = GetLastError();
         }
      }
      if (ShouldBuy(Symbol(), Ask, Bid, gd_400, l_icustom_8, l_icustom_16, l_icustom_24, l_icustom_32, l_icustom_0, l_icustom_40, l_istochastic_48, l_istochastic_56, l_isar_64, li_72, MaxOrders, Low[2], Open[1], Close[1])) {
         if (l_price_84 != 0.0) l_price_84 = Ask - l_price_84;
         if (l_price_76 != 0.0) l_price_76 = Ask + l_price_76;
         gi_356 = 1;
         g_lots_360 = GetLots();
         if (gi_356 > 1) {
            for (int li_104 = 1; li_104 <= gi_356; li_104++) {
               RefreshRates();
               l_ticket_92 = OrderSend(Symbol(), OP_BUY, g_lots_360, Ask, 3, l_price_84, l_price_76, StringConcatenate("BW_Scalp_", Symbol(), "_Buy"), MagicNumber, 0, Green);
               if (l_ticket_92 == -1) l_error_96 = GetLastError();
               Sleep(3000);
            }
         } else {
            l_ticket_92 = OrderSend(Symbol(), OP_BUY, g_lots_360, Ask, 3, l_price_84, l_price_76, StringConcatenate("BW_Scalp_", Symbol(), "_Buy"), MagicNumber, 0, Green);
            if (l_ticket_92 == -1) l_error_96 = GetLastError();
         }
      }
      return (0);
    }
    
    void CheckLicense() {
      string ls_0 = "";
      if (IsTesting()) ls_0 = "Running in backtest";
      else {
         if (IsDemo()) ls_0 = "Trading on demo account";
         else ls_0 = "Trading on live account";
      }
      int li_8 = GetStatus(gsa_432);
      string ls_12 = StringSubstr(gsa_432[0], 0, StringLen(gsa_432[0]));
      switch (li_8) {
      case 0:
         Comment("Initializing EA...");
         return;
      case 1:
         Comment("License OK:\n" + ls_12 
            + "\n" 
         + ls_0);
         return;
      case 2:
      case 3:
      case 4:
         Comment("License could not be verified:\n" + ls_12);
         return;
      case 5:
         Comment("Please enter username and password.");
         return;
      }
      Comment("Internal error: #" + li_8);
    }
    
    int GetOrdersTotal() {
      int l_count_0 = 0;
      for (int l_pos_4 = 0; l_pos_4 <= OrdersTotal(); l_pos_4++) {
         OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES);
         if (OrderMagicNumber() == MagicNumber && OrderSymbol() == Symbol()) l_count_0++;
      }
      return (l_count_0);
    }
    
    double GetLots() {
      int li_0 = GetOrdersTotal();
      double l_marginrequired_4 = MarketInfo(Symbol(), MODE_MARGINREQUIRED);
      double l_minlot_12 = MarketInfo(Symbol(), MODE_MINLOT);
      double l_lotstep_20 = MarketInfo(Symbol(), MODE_LOTSTEP);
      if (MaxOrders > gi_352) {
         if (li_0 < MaxOrders && li_0 > gi_352) MaxOrders = li_0;
         else MaxOrders = gi_352;
      }
      double ld_28 = AccountFreeMargin() / (MaxOrders * NumOfPairs) * Risk / 100.0;
      gd_368 = MathFloor(ld_28 / l_marginrequired_4 / l_lotstep_20) * l_lotstep_20;
      if (gd_368 < l_minlot_12)
         if (l_minlot_12 <= 1.0) gd_368 = l_minlot_12;
      if (gd_368 > MaxOrderSize) {
         gi_356 = MathFloor(gd_368 / MaxOrderSize);
         gd_368 = MaxOrderSize;
      }
      if (gd_368 > MarketInfo(Symbol(), MODE_MAXLOT)) gd_368 = MarketInfo(Symbol(), MODE_MAXLOT);
      return (gd_368);
    }
    
    void DoModifyECNTrades() {
      int l_ord_total_0 = OrdersTotal();
      for (int l_pos_4 = 0; l_pos_4 <= l_ord_total_0; l_pos_4++) {
         OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES);
         if (OrderMagicNumber() == MagicNumber && OrderSymbol() == Symbol()) ModifyECNOrder();
      }
    }
    
    void DoTrailingStops() {
      int l_ord_total_0;
      if (StartTrailingAfterPips * Point != 0.0) {
         l_ord_total_0 = OrdersTotal();
         for (int l_pos_4 = 0; l_pos_4 <= l_ord_total_0; l_pos_4++) {
            OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES);
            if (OrderMagicNumber() == MagicNumber && OrderSymbol() == Symbol()) TrailOrder();
         }
      }
    }
    
    void ModifyECNOrder() {
      bool l_bool_0;
      int l_error_4;
      RefreshRates();
      if (OrderType() == OP_BUY) {
         if (OrderStopLoss() == 0.0 && StopLoss != 0.0) {
            l_bool_0 = OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() - gd_400 * StopLoss, OrderTakeProfit(), 0, Green);
            if (l_bool_0 != TRUE) l_error_4 = GetLastError();
         }
         if (OrderTakeProfit() == 0.0 && TakeProfit != 0.0) {
            l_bool_0 = OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), OrderOpenPrice() + gd_400 * TakeProfit, 0, Green);
            if (l_bool_0 != TRUE) l_error_4 = GetLastError();
         }
      }
      if (OrderType() == OP_SELL) {
         if (OrderStopLoss() == 0.0 && StopLoss != 0.0) {
            l_bool_0 = OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() + gd_400 * StopLoss, OrderTakeProfit(), 0, Red);
            if (l_bool_0 != TRUE) l_error_4 = GetLastError();
         }
         if (OrderTakeProfit() == 0.0 && TakeProfit != 0.0) {
            l_bool_0 = OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), OrderOpenPrice() - gd_400 * TakeProfit, 0, Red);
            if (l_bool_0 != TRUE) l_error_4 = GetLastError();
         }
      }
    }
    
    void TrailOrder() {
      bool l_bool_0;
      int l_error_4;
      double l_price_8 = 0.0;
      RefreshRates();
      if (OrderType() == OP_BUY) {
         if (OrderStopLoss() == 0.0 || OrderStopLoss() < OrderOpenPrice() && BreakEvenSpread > 0) {
            l_price_8 = OrderOpenPrice() + BreakEvenSpread * gd_400;
            if (Bid > OrderOpenPrice() && Bid - 5.0 * gd_400 > l_price_8 && l_price_8 > OrderOpenPrice()) {
               if (l_price_8 == OrderOpenPrice()) l_price_8 += 2.0 * gd_400;
               l_bool_0 = OrderModify(OrderTicket(), OrderOpenPrice(), l_price_8, OrderTakeProfit(), 0, Green);
               if (l_bool_0 != TRUE) l_error_4 = GetLastError();
            }
         } else {
            if (OrderStopLoss() == 0.0 || Bid - OrderStopLoss() > gd_400 * TrailingStopPips && Bid - OrderOpenPrice() > gd_400 * StartTrailingAfterPips) {
               l_bool_0 = OrderModify(OrderTicket(), OrderOpenPrice(), Bid - gd_400 * TrailingStopPips, OrderTakeProfit(), 0, Green);
               if (l_bool_0 != TRUE) l_error_4 = GetLastError();
            }
         }
      }
      l_price_8 = 0.0;
      if (OrderType() == OP_SELL) {
         if (OrderStopLoss() == 0.0 || OrderStopLoss() > OrderOpenPrice() && BreakEvenSpread > 0) {
            l_price_8 = OrderOpenPrice() - BreakEvenSpread * gd_400;
            if (!(Ask < OrderOpenPrice() && Ask + 5.0 * gd_400 < l_price_8 && l_price_8 < OrderOpenPrice())) return;
            if (l_price_8 == OrderOpenPrice()) l_price_8 -= 2.0 * gd_400;
            l_bool_0 = OrderModify(OrderTicket(), OrderOpenPrice(), l_price_8, OrderTakeProfit(), 0, Green);
            if (l_bool_0 == TRUE) return;
            l_error_4 = GetLastError();
            return;
         }
         if (OrderStopLoss() == 0.0 || OrderStopLoss() - Ask > gd_400 * TrailingStopPips && OrderOpenPrice() - Ask > gd_400 * StartTrailingAfterPips) {
            l_bool_0 = OrderModify(OrderTicket(), OrderOpenPrice(), Ask + gd_400 * TrailingStopPips, OrderTakeProfit(), 0, Red);
            if (l_bool_0 != TRUE) l_error_4 = GetLastError();
         }
      }
    }
    
    void ClosingAllOrders() {
      for (int l_ord_total_0 = OrdersTotal(); l_ord_total_0 >= 0; l_ord_total_0--) {
         OrderSelect(l_ord_total_0, SELECT_BY_POS, MODE_TRADES);
         if (OrderMagicNumber() == MagicNumber && OrderSymbol() == Symbol()) {
            GetMarketInfo();
            if (!OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), g_slippage_440, Orange)) Print(OrderError());
         }
      }
    }
    
    void ClosingAllPosOrders() {
      for (int l_ord_total_0 = OrdersTotal(); l_ord_total_0 >= 0; l_ord_total_0--) {
         OrderSelect(l_ord_total_0, SELECT_BY_POS, MODE_TRADES);
         if (OrderMagicNumber() == MagicNumber && OrderSymbol() == Symbol() && OrderProfit() > 0.0) {
            GetMarketInfo();
            if (!OrderClose(OrderTicket(), OrderLots(), gda_436[1 - OrderType()], g_slippage_440)) Print(OrderError());
         }
      }
    }
    
    void ClosingAllNegOrders() {
      for (int l_ord_total_0 = OrdersTotal(); l_ord_total_0 >= 0; l_ord_total_0--) {
         OrderSelect(l_ord_total_0, SELECT_BY_POS, MODE_TRADES);
         if (OrderMagicNumber() == MagicNumber && OrderSymbol() == Symbol() && OrderProfit() < 0.0) {
            GetMarketInfo();
            if (!OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), g_slippage_440, Orange)) Print(OrderError());
         }
      }
    }
    
    void GLOBALClosingAllOrders() {
      for (int li_0 = OrdersTotal(); li_0 >= 0; li_0--)
         if (OrderSelect(OrderTicket(), SELECT_BY_POS, MODE_TRADES) && OrderType() <= OP_SELL && GetMarketInfo() && !OrderClose(OrderTicket(), OrderLots(), gda_436[1 - OrderType()], g_slippage_440)) Print(OrderError());
    }
    
    void GLOBALClosingAllPosOrders() {
      for (int l_ord_total_0 = OrdersTotal(); l_ord_total_0 >= 0; l_ord_total_0--) {
         OrderSelect(l_ord_total_0, SELECT_BY_POS, MODE_TRADES);
         if (OrderProfit() > 0.0) {
            GetMarketInfo();
            if (!OrderClose(OrderTicket(), OrderLots(), gda_436[1 - OrderType()], g_slippage_440)) Print(OrderError());
         }
      }
    }
    
    void GLOBALClosingAllNegOrders() {
      for (int l_ord_total_0 = OrdersTotal(); l_ord_total_0 >= 0; l_ord_total_0--) {
         OrderSelect(l_ord_total_0, SELECT_BY_POS, MODE_TRADES);
         if (OrderProfit() < 0.0) {
            GetMarketInfo();
            if (!OrderClose(OrderTicket(), OrderLots(), gda_436[1 - OrderType()], g_slippage_440)) Print(OrderError());
         }
      }
    }
    
    string OrderError() {
      int l_error_0 = GetLastError();
      return (StringConcatenate("Order:", OrderTicket(), " GetLastError()=", l_error_0, " ", ErrorDescription(l_error_0)));
    }
    
    int GetMarketInfo() {
      RefreshRates();
      gda_436[0] = MarketInfo(OrderSymbol(), MODE_ASK);
      gda_436[1] = MarketInfo(OrderSymbol(), MODE_BID);
      double l_point_0 = MarketInfo(OrderSymbol(), MODE_POINT);
      if (l_point_0 == 0.0) return (0);
      g_slippage_440 = (gda_436[0] - gda_436[1]) / l_point_0;
      return (gda_436[0] > 0.0 && gda_436[1] > 0.0);
    }
    
    void CashCollector() {
      double ld_0 = 0.0;
      double ld_8 = 0.0;
      bool li_16 = TRUE;
      for (int l_pos_20 = 0; l_pos_20 <= OrdersTotal(); l_pos_20++) {
         OrderSelect(l_pos_20, SELECT_BY_POS, MODE_TRADES);
         if (OrderMagicNumber() == MagicNumber && OrderSymbol() == Symbol()) {
            if (OrderType() == OP_BUY) ld_8 = NormalizeDouble(OrderClosePrice() - OrderOpenPrice(), Digits);
            else ld_8 = NormalizeDouble(OrderOpenPrice() - OrderClosePrice(), Digits);
            if (ld_8 < 0.0) li_16 = FALSE;
            ld_0 += ld_8;
         }
      }
      if (li_16 == 0) {
         if (ld_0 > CashCollectInPips * gd_400) {
            Print(StringConcatenate(Symbol(), " - ChartPipTotal: ", DoubleToStr(ld_0, Digits)));
            Print(StringConcatenate("Profits exceed ", DoubleToStr(CashCollectInPips * gd_400, Digits), "pips, We are closing trades on ", Symbol(), "."));
            StopOpeningTrades = TRUE;
            for (l_pos_20 = OrdersTotal(); l_pos_20 >= 0; l_pos_20--) {
               OrderSelect(l_pos_20, SELECT_BY_POS, MODE_TRADES);
               if (OrderMagicNumber() == MagicNumber && OrderSymbol() == Symbol()) {
                  GetMarketInfo();
                  if (!OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), g_slippage_440, Orange)) Print(OrderError());
               }
            }
            StopOpeningTrades = FALSE;
         }
      }
    }
    
    void MaxDDProt() {
      double ld_0 = 0.0;
      int li_unused_8 = 0;
      double ld_12 = 0.0;
      for (int l_count_20 = 0; l_count_20 <= OrdersTotal(); l_count_20++) {
         OrderSelect(OrderTicket(), SELECT_BY_POS, MODE_TRADES);
         if (OrderMagicNumber() == MagicNumber && OrderSymbol() == Symbol()) {
            if (OrderType() == OP_BUY) ld_12 = NormalizeDouble(OrderClosePrice() - OrderOpenPrice(), Digits);
            else ld_12 = NormalizeDouble(OrderOpenPrice() - OrderClosePrice(), Digits);
            ld_0 += ld_12;
         }
      }
      if (ld_0 < (-1.0 * MaxDrawdownInPips) * gd_400) Print(StringConcatenate(Symbol(), " - MaxDrawdown is greater than ", (-1.0 * MaxDrawdownInPips) * gd_400, " pausing trades on ", Symbol(), " for now."));
    }
    
    void GetAccellerated() {
      double l_price_0 = 0;
      if (TakeProfit > 0.0 && !UseECNExecution) l_price_0 = TakeProfit * gd_400;
      double l_price_8 = 0;
      if (StopLoss > 0.0 && !UseECNExecution) l_price_8 = StopLoss * gd_400;
      int l_ticket_16 = 0;
      int l_error_20 = 0;
      int l_count_24 = 0;
      for (int l_pos_28 = 0; l_pos_28 <= OrdersTotal(); l_pos_28++) {
         OrderSelect(l_pos_28, SELECT_BY_POS, MODE_TRADES);
         if (OrderMagicNumber() == MagicNumber && OrderSymbol() == Symbol()) l_count_24++;
      }
      for (l_pos_28 = 0; l_pos_28 <= OrdersTotal(); l_pos_28++) {
         OrderSelect(OrderTicket(), SELECT_BY_POS, MODE_TRADES);
         if (OrderMagicNumber() == MagicNumber && OrderSymbol() == Symbol()) {
            if (OrderProfit() > 0.0) {
               if (OrderType() == OP_BUY) {
                  if (l_count_24 >= 3 * gi_352) continue;
                  if (l_price_8 != 0.0) l_price_8 = Ask - l_price_8;
                  if (l_price_0 != 0.0) l_price_0 = Ask + l_price_0;
                  gi_356 = 1;
                  g_lots_360 = GetLots();
                  if (gi_356 > 1) {
                     for (int li_32 = 1; li_32 <= gi_356; li_32++) {
                        RefreshRates();
                        l_ticket_16 = OrderSend(Symbol(), OP_BUY, g_lots_360, Ask, 3, l_price_8, l_price_0, StringConcatenate("BW_Scalp_", Symbol(), "_ACCBuy"), MagicNumber, 0, Green);
                        if (l_ticket_16 == -1) l_error_20 = GetLastError();
                        Sleep(1000);
                     }
                     return;
                  }
                  l_ticket_16 = OrderSend(Symbol(), OP_BUY, g_lots_360, Ask, 3, l_price_8, l_price_0, StringConcatenate("BW_Scalp_", Symbol(), "_ACCBuy"), MagicNumber, 0, Green);
                  if (l_ticket_16 != -1) break;
                  l_error_20 = GetLastError();
                  return;
               }
               if (l_count_24 < 3 * gi_352) {
                  if (l_price_8 != 0.0) l_price_8 = Bid + l_price_8;
                  if (l_price_0 != 0.0) l_price_0 = Bid - l_price_0;
                  gi_356 = 1;
                  g_lots_360 = GetLots();
                  if (gi_356 > 1) {
                     for (int li_36 = 1; li_36 <= gi_356; li_36++) {
                        RefreshRates();
                        l_ticket_16 = OrderSend(Symbol(), OP_SELL, g_lots_360, Bid, 3, l_price_8, l_price_0, StringConcatenate("BW_Scalp_", Symbol(), "_ACCSell"), MagicNumber, 0, Red);
                        if (l_ticket_16 == -1) l_error_20 = GetLastError();
                        Sleep(1000);
                     }
                     return;
                  }
                  l_ticket_16 = OrderSend(Symbol(), OP_SELL, g_lots_360, Bid, 3, l_price_8, l_price_0, StringConcatenate("BW_Scalp_", Symbol(), "_ACCSell"), MagicNumber, 0, Red);
                  if (l_ticket_16 != -1) break;
                  l_error_20 = GetLastError();
                  return;
               }
            }
         }
      }
    }
    
    void TrimBad() {
      int l_ticket_0 = -1;
      double l_ord_profit_4 = 0.0;
      for (int l_count_12 = 0; l_count_12 <= OrdersTotal(); l_count_12++) {
         OrderSelect(OrderTicket(), SELECT_BY_POS, MODE_TRADES);
         if (OrderMagicNumber() == MagicNumber && OrderSymbol() == Symbol()) {
            if (OrderProfit() < 0.0 && OrderProfit() < l_ord_profit_4) {
               l_ticket_0 = OrderTicket();
               l_ord_profit_4 = OrderProfit();
               Print("OrderTicket: ", OrderTicket(), " OrderProfit: ", OrderProfit(), " BigLoserValue: ", l_ord_profit_4);
            }
         }
      }
      if (l_ticket_0 > -1) {
         OrderSelect(l_ticket_0, SELECT_BY_TICKET, MODE_TRADES);
         if (OrderMagicNumber() == MagicNumber && OrderSymbol() == Symbol()) {
            GetMarketInfo();
            if (!OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), g_slippage_440, Orange)) Print(OrderError());
         }
      }
      l_ticket_0 = 0;
      l_ord_profit_4 = 0;
    }

  4. Re: {req} how to modify an ea

     

    hello Mr scarface

     

    yes that is what i want the EA to do....

     

    -- 08 Dec 2009, 04:40 --

     

    -- 08 Dec 2009, 10:40 --

     

    hello scarface

     

     

    how are you sir...

    i am just writing just because i wanna know if you did the modification to the EA....i was trying to do it but i could not.

     

    -- 08 Dec 2009, 11:33 --

     

    Hi toritoo,

     

    I looked at the code and everything seemed o.k.

     

    There is no problem at all. I also backtested it and working prefect.

     

    I guess you want to add a hedge position, is that what you are looking for???

     

    If Not, can you explain a little more so I can understand exactly what you need.

     

    Please let me know as soon as possible.

     

    Best wishes,

  5. Re: {req} how to modify an ea

     

    hello scarface

     

    thank for answer me again....

    i want the EA to make a consecutive trade. when the ea make a trade like buy and the currency goes down , make another trade or when the ea make a trade like sell and the currency goes up , make another trade

×
×
  • Create New...