这里有3.02版本的源码
// Cash Hammer v3.02MM
// Educated!
#property copyright "Forex Invest Group & Yuriy Tokman"
#property link "sale@forexinvest.ee,zhtfx.com"
#include <stdlib.mqh>
extern string ____1____ = "__Signal__";
extern int TF = 0;
extern int pips = 10;
extern string ____2____ = "__Trade__";
extern bool op_BUY = TRUE;
extern bool op_SELL = TRUE;
extern double Lots = 0.1;
extern bool Choice_method = FALSE;
extern double Risk = 0.0;
extern int StopLoss = 0;
extern int TakeProfit = 30;
extern int MagicNumber = 10;
extern string ____3___ = "__Traling__";
extern bool Traling = FALSE;
extern bool TSProfitOnly = TRUE;
extern int TStop.Buy = 30;
extern int TStop.Sell = 20;
extern int TrailingStep = 10;
extern string ____4____ = "__Lock __";
extern bool Lock = TRUE;
extern bool Lock_TRL = FALSE;
extern int Lock_pips = 13;
extern double koef_lot_lock = 2.0;
extern int StopLoss_Lock = 0;
extern string ____5____ = "__Averag__";
extern bool AVERAGES = TRUE;
extern int MN_b = 200;
extern int MN_s = 300;
extern int pips_prosadka = 22;
extern double otstyp = 13.0;
extern double koef_lot = 1.1;
extern double exponents = 1.0;
extern int TakeProfit_Av = 34;
extern string ____6____ = "__Rest __";
extern int Slippage = 3;
extern bool MarketWatch = FALSE;
extern bool ShowComment = TRUE;
extern bool ALERT = TRUE;
int gi_276 = 0; // EDUCATED !!
bool gi_280 = FALSE;
bool gi_284 = FALSE;
double gd_288 = 0.0;
string gsa_296[256];
int g_datetime_300 = 0;
int g_datetime_304 = 0;
int g_count_308 = 0;
int init() {
gi_284 = FALSE;
gi_276 = AccountNumber(); // EDUCATED !!
if (!IsTradeAllowed()) {
Message("For normal job of the adviser it is necessary\n" + "To permit to the adviser to trade");
gi_284 = TRUE;
return;
}
if (!IsLibrariesAllowed()) {
Message("For normal job of the adviser it is necessary\n" + "To permit import from the external experts");
gi_284 = TRUE;
return;
}
if (!IsTesting()) {
if (IsExpertEnabled()) Message("The adviser will be started by the following ticks");
else Message("Off the button \"To permit start of the advisers\"");
}
for (int l_index_0 = 0; l_index_0 < 256; l_index_0++) gsa_296[l_index_0] = CharToStr(l_index_0);
GetAvtor();
GetLogoType();
return (0);
}
int deinit() {
if (!IsTesting()) Comment("");
GetDellName();
return (0);
}
int start() {
string ls_16;
double ld_128;
double l_lots_0 = 0;
if (Lots > 0.0) l_lots_0 = Lots;
else l_lots_0 = GetLot();
if (gi_280) {
Message("Critical mistake! The adviser IS STOPPED!");
return;
}
if (gi_284) {
Message("The adviser was not possible to initialize!");
return;
}
if (!IsTesting()) {
//if (gi_276 > 0 && gi_276 != AccountNumber()) {
// Comment("Trade on the bill: " + AccountNumber() + " IS FORBIDDEN!");
// return;
//}
Comment("");
}
double ld_8 = (AccountEquity() - AccountBalance()) / (AccountBalance() / 100.0);
if (ld_8 < gd_288) gd_288 = ld_8;
if (ShowComment) {
ls_16 = "CurTime=" + TimeToStr(TimeCurrent(), TIME_MINUTES) + " TakeProfit=" + TakeProfit + " StopLoss=" + StopLoss + " Lots=" + DoubleToStr(l_lots_0, 2)
+ "\n+------------------------------+"
+ "\n Balance=" + DoubleToStr(AccountBalance(), 2)
+ "\n Equity=" + DoubleToStr(AccountEquity(), 2)
+ "\n Profit=" + DoubleToStr(AccountEquity() - AccountBalance(), 3) + " $"
+ "\n Profit=" + DoubleToStr(100.0 * (AccountEquity() / AccountBalance() - 1.0), 3) + " %"
+ "\n DrawDown Persent=" + DoubleToStr(gd_288, 2) + "%"
+ "\n Slippage=" + DoubleToStr(Slippage * GetSlippage(), 0)
+ "\n+------------------------------+";
Comment(ls_16);
} else Comment("");
Label("ytg_str_561", DoubleToStr(AccountNumber(), 0), 4, 5, 120, 10, "Arial", Lime);
Label("ytg_str_562", DoubleToStr(gi_276, 0), 4, 5, 140, 10, "Arial", Lime);
GetYTG();
double ld_24 = MarketInfo(Symbol(), MODE_STOPLEVEL) / GetPont();
double ld_32 = ld_24 * GetPoint();
if (StopLoss > 0 && StopLoss < ld_24) Alert("Parameter *StopLoss* is given not correctly");
if (TakeProfit > 0 && TakeProfit < ld_24) Alert("Parameter *TakeProfit* is given not correctly");
if (StopLoss_Lock > 0 && StopLoss_Lock < ld_24) Alert("Parameter *StopLoss_Lock* is given not correctly");
if (otstyp * GetPoint() == 0.0 || otstyp * GetPoint() < ld_32) Alert("Parameter *otstyp* is given not correctly");
double ld_40 = 0;
double ld_48 = 0;
if (Lock_TRL) {
SimpleTrailing(Symbol(), -1, MN_s);
SimpleTrailing(Symbol(), -1, MN_b);
}
if (Traling && !ExistPositions(Symbol(), OP_BUY, MN_b)) SimpleTrailing(Symbol(), OP_SELL, MagicNumber);
if (Traling && !ExistPositions(Symbol(), OP_SELL, MN_s)) SimpleTrailing(Symbol(), OP_BUY, MagicNumber);
int l_digits_56 = Digits;
double ld_60 = 100;
if (l_digits_56 == 3 || l_digits_56 >= 5) ld_60 = 1000;
int li_68 = 1000.0 * l_lots_0 * TakeProfit_Av / ld_60;
double ld_72 = GetProfitOpenPosInCurrency(Symbol(), OP_BUY, MagicNumber) + GetProfitOpenPosInCurrency(Symbol(), OP_SELL, MN_s);
double ld_80 = GetProfitOpenPosInCurrency(Symbol(), OP_SELL, MagicNumber) + GetProfitOpenPosInCurrency(Symbol(), OP_BUY, MN_b);
if (ExistPositions(Symbol(), OP_SELL, MN_s) && ld_72 > li_68) {
ClosePositions(Symbol(), OP_BUY, MagicNumber);
ClosePositions(Symbol(), OP_SELL, MN_s);
DeleteOrders(Symbol(), OP_SELLSTOP, MN_s);
}
if (ExistPositions(Symbol(), OP_BUY, MN_b) && ld_80 > li_68) {
ClosePositions(Symbol(), OP_SELL, MagicNumber);
ClosePositions(Symbol(), OP_BUY, MN_b);
DeleteOrders(Symbol(), OP_BUYSTOP, MN_b);
}
double l_minlot_88 = MarketInfo(Symbol(), MODE_MINLOT);
double l_maxlot_96 = MarketInfo(Symbol(), MODE_MAXLOT);
double ld_104 = NormalizeDouble(l_lots_0 * koef_lot, LotPoint());
if (ld_104 <= l_lots_0) ld_104 = NormalizeDouble(l_lots_0 + l_minlot_88, LotPoint());
double ld_112 = NormalizeDouble(Ask + otstyp * GetPoint(), Digits);
double ld_120 = NormalizeDouble(Bid - otstyp * GetPoint(), Digits);
if (AVERAGES) {
if (GetOrderOpenPrice(Symbol(), -1, MN_b) - Ask > (pips_prosadka + otstyp + GetCount(Symbol(), OP_BUY, MN_b)) * GetPoint() * exponents) {
ld_128 = GetLotLastOrder(Symbol(), -1, MN_b);
ld_104 = NormalizeDouble(koef_lot * ld_128, LotPoint());
if (ld_104 <= ld_128) ld_104 = NormalizeDouble(ld_128 + l_minlot_88, LotPoint());
if (ld_104 > l_maxlot_96) ld_104 = NormalizeDouble(l_maxlot_96, LotPoint());
SetOrder(Symbol(), OP_BUYSTOP, ld_104, ld_112, 0, 0, MN_b, 0);
}
if (Bid - GetOrderOpenPrice(Symbol(), -1, MN_s) > (pips_prosadka + otstyp + GetCount(Symbol(), OP_SELL, MN_s)) * GetPoint() * exponents && GetOrderOpenPrice(Symbol(), -1, MN_s) > 0.0) {
ld_128 = GetLotLastOrder(Symbol(), -1, MN_s);
ld_104 = NormalizeDouble(koef_lot * ld_128, LotPoint());
if (ld_104 <= ld_128) ld_104 = NormalizeDouble(ld_128 + l_minlot_88, LotPoint());
if (ld_104 > l_maxlot_96) ld_104 = NormalizeDouble(l_maxlot_96, LotPoint());
SetOrder(Symbol(), OP_SELLSTOP, ld_104, ld_120, 0, 0, MN_s, 0);
}
}
double ld_136 = 0;
if (Lock) {
if (PriceOpenLastPos(Symbol(), OP_BUY, MagicNumber) - Ask > Lock_pips * GetPoint() && !ExistPositions(Symbol(), OP_SELL, MN_s)) {
ld_136 = NormalizeDouble(GetLotLastPos(0, OP_BUY, MagicNumber) * koef_lot_lock, LotPoint());
if (StopLoss_Lock > 0) ld_40 = Bid + StopLoss_Lock * GetPoint();
else ld_40 = 0;
OpenPosition(Symbol(), OP_SELL, ld_136, ld_40, ld_48, MN_s, "腩?徉 |