Jump to content

BBW Scalper


Recommended Posts

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;
}

Link to comment
Share on other sites

  • Replies 119
  • Created
  • Last Reply

Top Posters In This Topic

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Re: REQ: BBW Scalper

 

Yes, i do know that.

But by accessing functions i meant getting it's code. In order to access that code we must be able to decrypt the dll binary file.

The other way is to fake the Init function, surpass it so the dll give us access to the other functions. But we are then in the same problem... it's encrypted.

Link to comment
Share on other sites

Re: REQ: BBW Scalper

 

I went to the website and asked for a free one-month demo for the Pro Version. I have been testing it this week and it has so far produced good results, about 7% increase. I'm testing it on JadeFX using 1 mini lot with a a 5K demo account.

 

You can contact them and they will give you a free demo. You can request a demo here

 

http://investorshaven.com/Registration.html

Link to comment
Share on other sites

Re: REQ: BBW Scalper

 

Seems like this is actually trivial to educate, I don't know where you guys are messing this one up.

Comment out the following section like this:-

 

   
//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);
//}

 

This seems like the only place in the code where Init is called from the DLL and the only result of the calculation is to determine whether to shut the EA down or not. By commenting the whole bit out, we skip authentication entirely.

 

Also there is the following bit you can modify (the lines commented with EDUCATED are added lines)

 

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);
  li_8 = 3; // <------------------------------------EDUCATED
  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:
     Comment("EA has been EDUCATED!\n" + ls_12 + "\n" + ls_0); //<---------------------- EDUCATED
  case 4:
     Comment("License could not be verified:\n" + ls_12);
     return;

 

This CheckLicence routine appears to do nothing other than to report the License status on the chart. There are no variables in here which seem to affect trading logic as far as I can tell. Note that most of the variables are all local variables (li, ls, etc) and don't touch other parts of the code outside this routine. Also note how this routine is a "void" routine and therefore any "return" command used from it cannot report anything back to any other part of the code!

You could probably just skip the call to this routine entirely earlier on in the EA!

 

Now..... I have not tested my educated version at all, and I have no idea if the dll is going to detect the fact that the EA has been educated or not... but I doubt that it will care. In any case, if you guys want to test it, by all means, go ahead and run it against the legit demo version they have and see if the trades match.

 

If the coders wanted to be REAL bastards, they should simply include the Username and password and do a check on it inside a DLL call that makes actual trading decisions! (such as the ShouldBuy and the ShouldSell routines). That would rather successfully deter an easy education like this one. >:)

 

...and give kudos if you liked my tutorial on EA education. :)>-

Link to comment
Share on other sites

Re: REQ: BBW Scalper

 

I've been a beta tester on this one for a few months.

 

You can view my current results on 4 accounts:

 

http://www.myfxbook.com/members/mbbbwM1

 

This EA is stable and profitable. ML% only ever briefly dips below 1,000% which is largely the secret to it's success.

 

I've done some Live trading with it within the Hedge Fund for whom I trade and it is equally as profitable and SAFE as when I Demo Trade it. I use the PRO version, and we're working to tune it for even better performance.

 

The broker I use is ECN with 5-digit.

 

Since this isn't your typical Scam EA hit-and-run company, I would recommend buying this EA after you've proved it to yourself in Back and Forward Testing.

 

This one, in my opinion, should be listed in the Black Book for Non-Sharing. Don't you think authors who create EAs which WORK and put money in your pocket should be rewarded?

 

Best,

Merlin

Link to comment
Share on other sites

Re: REQ: BBW Scalper

 

Rio,

 

I have done that before, but i realized that the DLL was avoiding to initiate if you don't execute the Init function first.

Why? Because everytime i try to run a backtest this crash all my platforms i test this on.

It's not that easy i guess, or i'm missing something then..

Please try it on your platform and see what you get.

Thanks for the interest.

Link to comment
Share on other sites

Re: BBW Scalper

 

This EA is awesome. In one day demo account, it create a number of trades and earn me 19$ from 100$ capital.

Though there are still some pending orders during the weekend, based on the equity currently I have, I still earn $10 in a day.

Thinking to purchase this EA.

 

Great idea!

 

Did you notice your MarginLevel%? Should be close to 1000%. So trades, even in DD, will eventually come to profit without any fear EVER of a Margin Call.

 

Definitely worth supporting by purchasing.

 

You can see my results, still ongoing after 3 weeks, on a post earlier in this thread.

Link to comment
Share on other sites

Re: BBW Scalper

 

Hi Stic,

 

Check out my forward testing on the top four accounts @

http://www.myfxbook.com/members/mbbbwM1

 

My backtesting guy is working hard to find optimized settings for each pair. Takes a while, and backtesting is never, imo, as effective as forward testing.

 

Best results from a good broker..... 5-digit, ECN, STP with the Demo data the same as Live Data.

 

Shifting to Live, one has to deal with market fills, which may affect results either way but not by much. I've made good profits with this on Live, as well.

 

One important tweak...... Open up the Indicators and Change the first number to 11, and the Type to Exponential.

 

There's no point to trading with stop losses with this EA although you CAN if you wish. It stops taking trades when your ML% drops to 1000% (or less, as you can change that setting). At that point, you just use patience and wait for the original trades to come to profit, freeing up ML% once again. Your Account Balance is protected at all times this way and shows the advantage of using a 'basket' of currencies.

 

I go seriously live with this in January.

 

Regards, and happy pipping!

Merlin

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...