Auto-Profit_3.0.3_medium
Auto-Profit_3.0.3_medium

Auto-Profit_3.0.3_medium

更新日期:
2022-11-03
分类标签:
语言:
中文
平台:
没限制

41 人已下载 手机查看

Auto-Profit_3.0.3_medium

#property copyright “Copyright ?2012, invest-system.net”
#property link “invest-system.net”

//int g_acc_number_76 =
double g_maxlot_80 = 0.0;
string gs_88 = “AP_v.3.0”;
double gd_96 = 2.0;
string gs_104 = “AutoP_v.3.0″;
int gi_unused_112 = 1;
//extern string __1__ = ” 汤幸韧 1 – 怅? 2 – 恹觌.”;
extern int MMType = 1;
bool gi_128 = TRUE;
//extern string __2__ = “祉铈栩咫?耠邃. 腩蜞”;
extern double LotMultiplikator = 1.667;
double gd_148;
double g_slippage_156 = 5.0;
//extern string __3__ = “磬鬣朦睇?腩?”;
//extern string _____ = “true – 镱耱?眄, false – 铗 徉豚眈?;
extern bool LotConst_or_not = TRUE;
extern double Lot = 0.01;
extern double RiskPercent = 30.0;
double gd_200;
//extern string __4__ = “镳栳??矬黻蜞?- 倚”;
extern double TakeProfit = 5.0;
extern int TP_modify_mode = 0;
extern double TP_modify_start = 0;
extern double TP_modify_rate = 0;
double gd_224;
double g_pips_232 = 0.0;
double gd_240 = 10.0;
double gd_248 = 10.0;
//extern string __5__ = “疣耨蝾龛???铕溴疣扈”;
extern double Step = 5.0;
extern int Step_modify_mode = 0;
extern double Step_modify_start = 0;
extern double Step_modify_rate = 0;
extern int Trendstep_mode = 0;
extern double Trendstep_start = 5;
double gd_272;
//extern string __6__ = “汤X 觐?忸 铕溴痤?;
extern int MaxTrades = 30;
//extern string __7__ = “毋疣龛麇龛?镱蝈瘘”;
extern bool UseEquityStop = FALSE;
extern double TotalEquityRisk = 20.0;
bool gi_312 = FALSE;
bool gi_316 = FALSE;
bool gi_320 = FALSE;
double gd_324 = 48.0;
bool gi_332 = FALSE;
int gi_336 = 2;
int gi_340 = 16;
//extern string __8__ = “蠕屙蜩翳赅蝾?铕溴疣”;
extern int Magic = 1;
int gi_356;
//extern string __9__ = “腩泐蜩??恹忸?溧眄”;
extern bool ShowTableOnTesting = FALSE;
//extern string _ = “(true-怅?,false-恹觌.)”;
double g_price_380;
double gd_388;
double gd_unused_396;
double gd_unused_404;
double g_price_412;
double g_bid_420;
double g_ask_428;
double gd_436;
double gd_444;
double gd_452;
bool gi_460;
int g_time_464 = 0;
int gi_468;
int gi_472 = 0;
double gd_476;
int g_pos_484 = 0;
int gi_488;
double gd_492 = 0.0;
bool gi_500 = FALSE;
bool gi_504 = FALSE;
bool gi_508 = FALSE;
int gi_512;
bool gi_516 = FALSE;
int g_datetime_520 = 0;
int g_datetime_524 = 0;
double gd_528;
double gd_536;
int g_fontsize_544 = 14;
int g_color_548 = Gold;
int g_color_552 = Orange;
int g_color_556 = Gray;
int gi_unused_560 = 5197615;
extern int Use_Medium = 0;
extern int Ent_sens = 1;
extern int Medium_TF_A = 0;
extern int Medium_sens_A = 38;
extern int Medium_TF_B = 0;
extern int Medium_sens_B = 38;
extern bool Use_spread_limit = FALSE;
extern int Spread_limit = 0;
extern int Breakeven_mode = 0;
extern double Breakeven_start = 5;
extern int Cutout_mode = 0;
extern double Cutout_point = 5;
extern bool ShowInfo = FALSE;
int oc;
string trendstep;
string usemedium;
string MediumTFA;
string MediumTFB;
string breakeven;
string cutout;
string spreadlimit;
string tpmodifystatus;
string stepmodifystatus;

void init() {
gd_452 = MarketInfo(Symbol(), MODE_SPREAD) * Point;
if(Digits == 5)
{
Ent_sens*=10;
}
switch(Trendstep_mode)
{
case 0:
{
trendstep = “OFF”;
break;
}
case 1:
{
trendstep = “Tredstep start on “+Trendstep_start+” order”;
break;
}
case 2:
{
trendstep = “Tredstep start in “+Trendstep_start+” lots”;
break;
}
}

if(Medium_TF_A == 0)
{MediumTFA = “Current”;}
else{MediumTFA = Medium_TF_A;}
if(Medium_TF_B == 0)
{MediumTFB = “Current”;}
else{MediumTFB = Medium_TF_B;}

switch(Use_Medium)
{
case 0:
usemedium = “Standard”;
break;
case 1:
usemedium = “1 Medium, sensitivity “+Medium_sens_A+” and timeframe “+ MediumTFA;
break;
case 2:
usemedium = “2 Mediums, sensitivitys “+Medium_sens_A+”and “+Medium_sens_B+” ,timeframes “+ MediumTFA+” and”+MediumTFB;
}
switch(Breakeven_mode)
{
case 0:
breakeven = “OFF”;
break;
case 1:
breakeven = “Breakeven start on “+Breakeven_start+” order”;
break;
case 2:
breakeven = “Breakeven start in “+Breakeven_start+” lots”;
break;
}
switch(Cutout_mode)
{
case 0:
cutout = “OFF”;
break;
case 1:
cutout = “Cutout start on “+Cutout_point+” order”;
break;
case 2:
cutout = “Cutout start in “+Cutout_point+” lots”;
break;
}
if(Use_spread_limit)
{
spreadlimit = “Spread limit is “+Spread_limit+” pips”;
}
else {spreadlimit = “OFF”;}
switch(TP_modify_mode)
{
case 0:
tpmodifystatus = “OFF”;
break;
case 1:
tpmodifystatus = “TP modify start on “+TP_modify_start+” order”;
break;
case 2:
tpmodifystatus = “TP modify start in “+TP_modify_start+” lots”;
break;
}
switch(Step_modify_mode)
{
case 0:
stepmodifystatus = “OFF”;
break;
case 1:
stepmodifystatus = “Step modify start on “+Step_modify_start+” order”;
break;
case 2:
stepmodifystatus = “TP modify start in “+Step_modify_start+” lots”;
break;
}

}

int deinit() {
return (0);
}

int start() {

if(Cutout_mode == 1&&f0_16()>=Cutout_point)
{
for (g_pos_484 = OrdersTotal() – 1; g_pos_484 >= 0; g_pos_484–) {
if(OrderSelect(g_pos_484, SELECT_BY_POS, MODE_TRADES));
else Print(“OrderSelect ERROR in 194 string,cutout by order count function”);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != gi_356) continue;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == gi_356) {
if (OrderType() == OP_BUY || OrderType() == OP_SELL)
{
if(OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),g_slippage_156,Yellow));
else Print(“OrderClose ERROR in 200 string,cutout by order count function”);
}
}
}

}

if(Breakeven_mode == 1&&f0_16()>=Breakeven_start)
{
breakeven();
}
else if(Breakeven_mode == 2&& Tot_lot()>=Breakeven_start)
{
breakeven();
}

bool st = FALSE;
bool SPRL = FALSE;
double order_lots_52;
double order_lots_60;
double iclose_68;
double iclose_76;
int li_unused_0 = MarketInfo(Symbol(), MODE_STOPLEVEL);
int li_unused_4 = MarketInfo(Symbol(), MODE_SPREAD);
double point_8 = MarketInfo(Symbol(), MODE_POINT);
double bid_16 = MarketInfo(Symbol(), MODE_BID);
double ask_24 = MarketInfo(Symbol(), MODE_ASK);
int li_unused_32 = MarketInfo(Symbol(), MODE_DIGITS);
if (g_maxlot_80 == 0.0) g_maxlot_80 = MarketInfo(Symbol(), MODE_MAXLOT);
double minlot_36 = MarketInfo(Symbol(), MODE_MINLOT);
double lotstep_44 = MarketInfo(Symbol(), MODE_LOTSTEP);
/* if (AccountNumber() != g_acc_number_76 && (!IsDemo())) {
Comment(“杨忮蝽桕 祛驽?疣犷蜞螯 蝾朦觐 磬 聍蛤?” + g_acc_number_76 + “, 潆 徨耧豚蝽钽?镱潢膻麇龛 ?漯筱铎?聍蛤?镥疱殇栩?磬 襦轵 invest-system.net”);
Sleep(1000);
Print(“杨忮蝽桕 祛驽?疣犷蜞螯 蝾朦觐 磬 聍蛤?” + g_acc_number_76 + “, 潆 镱潢膻麇龛 ?漯筱铎?聍蛤?镳铊滂蝈 磬 襦轵 invest-system.net”);
return;
}*/
if (((!IsOptimization()) && !IsTesting() && (!IsVisualMode())) || (ShowTableOnTesting && IsTesting() && (!IsOptimization()))) {
f0_13();

}
double MDA1 = iCustom(Symbol(),Medium_TF_A,”medium”,Medium_sens_A,1,1);
double MDA1_2 = iCustom(Symbol(),Medium_TF_A,”medium”,Medium_sens_A,1,2);
double MDA2 = iCustom(Symbol(),Medium_TF_A,”medium”,Medium_sens_A,2,1);
double MDA2_2 = iCustom(Symbol(),Medium_TF_A,”medium”,Medium_sens_A,2,2);
double MDA3 = iCustom(Symbol(),Medium_TF_A,”medium”,Medium_sens_A,5,1);
//——————————————————————–
double MDB1 = iCustom(Symbol(),Medium_TF_B,”medium”,Medium_sens_B,1,1);
double MDB1_2 = iCustom(Symbol(),Medium_TF_B,”medium”,Medium_sens_B,1,2);
double MDB2 = iCustom(Symbol(),Medium_TF_B,”medium”,Medium_sens_B,2,1);
double MDB2_2 = iCustom(Symbol(),Medium_TF_B,”medium”,Medium_sens_B,2,2);
double MDB3 = iCustom(Symbol(),Medium_TF_B,”medium”,Medium_sens_B,5,1);

 

if (LotConst_or_not) gd_200 = Lot;
else gd_200 = AccountBalance() * RiskPercent / 100.0 / 10000.0;
if (gd_200 < minlot_36) Print(“朽聍弪睇?腩? ” + gd_200 + ” 戾睃 扈龛爨朦眍 漕矬耱桁钽?潆 蝾疸钼腓 ” + minlot_36);
if (gd_200 > g_maxlot_80 && g_maxlot_80 > 0.0) Print(“朽聍弪睇?腩? ” + gd_200 + ” 犷朦 爨犟桁嚯?漕矬耱桁钽?潆 蝾疸钼腓 ” + g_maxlot_80);
gd_148 = LotMultiplikator;
if(f0_16() == 0)
{
gd_224 = TakeProfit;
}

if(f0_16() == 0)
{
gd_272 = Step;
}
gi_356 = Magic;
string ls_84 = “false”;
string ls_92 = “false”;
if (gi_332 == FALSE || ((gi_332 && (gi_340 > gi_336 && (Hour() >= gi_336 && Hour() <= gi_340))) || (gi_336 > gi_340 && (!(Hour() >= gi_340 && Hour() <= gi_336))))) ls_84 = “true”;
if (gi_332 && ((gi_340 > gi_336 && (!(Hour() >= gi_336 && Hour() <= gi_340))) || (gi_336 > gi_340 && (Hour() >= gi_340 && Hour() <= gi_336)))) ls_92 = “true”;
if (gi_316) f0_18(gd_240, gd_248, g_price_412);
if (gi_320) {
if (TimeCurrent() >= gi_468) {
f0_3();
Print(“Closed All due to TimeOut”);
}
}
if (g_time_464 == Time[0]) return (0);
g_time_464 = Time[0];

double ld_100 = f0_5();
if (UseEquityStop) {
if (ld_100 < 0.0 && MathAbs(ld_100) > TotalEquityRisk / 100.0 * f0_7()) {
f0_3();
Print(“Closed All due to Stop Out”);
gi_516 = FALSE;
}
}
if(oc>f0_16()&&Breakeven_mode>0)
{gi_516 = TRUE;}
gi_488 = f0_16();
if (gi_488 == 0) gi_460 = FALSE;
for (g_pos_484 = OrdersTotal() – 1; g_pos_484 >= 0; g_pos_484–) {
if(OrderSelect(g_pos_484, SELECT_BY_POS, MODE_TRADES));
else Print(“OrderSelect ERROR in 293 string”);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != gi_356) continue;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == gi_356) {
if (OrderType() == OP_BUY) {
gi_504 = TRUE;
gi_508 = FALSE;
order_lots_52 = OrderLots();
break;
}
}
if (OrderSymbol() == Symbol() && OrderMagicNumber() == gi_356) {
if (OrderType() == OP_SELL) {
gi_504 = FALSE;
gi_508 = TRUE;
order_lots_60 = OrderLots();
break;
}
}
}

if(li_unused_4>Spread_limit&&Use_spread_limit)
{
Print(“Current spread exceeded spread limit “,Spread_limit);
SPRL = TRUE;
}

switch(Trendstep_mode)
{
case 0:
{
if (gi_488 > 0 && gi_488 <= MaxTrades&&SPRL ==FALSE) {
RefreshRates();
gd_436 = f0_2();
gd_444 = f0_6();
if (gi_504 && gd_436 – Ask >= MathRound(gd_272) * Point) gi_500 = TRUE;
if (gi_508 && Bid – gd_444 >= MathRound(gd_272) * Point) gi_500 = TRUE;
}
break;
}
case 1:
{
if (gi_488 > 0 && gi_488 <= MaxTrades&&SPRL ==FALSE) {
RefreshRates();
gd_436 = f0_2();
gd_444 = f0_6();
if (gi_504 && gd_436 – Ask >= MathRound(gd_272) * Point&&gi_488<Trendstep_start)
{
gi_500 = TRUE;
}
else if (gi_504 && gd_436 – Ask >= MathRound(gd_272) * Point&&gi_488>=Trendstep_start&&(MDA1<MDA2&&MDA3==1&& MDA1-MDA1_2>=Ent_sens*Point&&MDA1!=MDA1_2))
{
gi_500 = TRUE;
}
if (gi_508 && Bid – gd_444 >= MathRound(gd_272) * Point&&gi_488<Trendstep_start)
{
gi_500 = TRUE;
}
else if (gi_508 && Bid – gd_444 >= MathRound(gd_272) * Point&&gi_488>=Trendstep_start&&(MDA1>MDA2&& MDA3 == -1&& MDA2_2-MDA2>=Ent_sens*Point&&MDA2!=MDA2_2))
{
gi_500 = TRUE;
}
}
break;
}
case 2:
{
if (gi_488 > 0 && gi_488 <= MaxTrades&&SPRL ==FALSE) {
RefreshRates();
gd_436 = f0_2();
gd_444 = f0_6();
if (gi_504 && gd_436 – Ask >= MathRound(gd_272) * Point&&Tot_lot()<Trendstep_start)
{
gi_500 = TRUE;
}
else if (gi_504 && gd_436 – Ask >= MathRound(gd_272) * Point&&Tot_lot()>=Trendstep_start>=Trendstep_start&&(MDA1<MDA2&&MDA3==1&& MDA1-MDA1_2>=Ent_sens*Point&&MDA1!=MDA1_2))
{
gi_500 = TRUE;
}
if (gi_508 && Bid – gd_444 >= MathRound(gd_272) * Point&&Tot_lot()<Trendstep_start)
{
gi_500 = TRUE;
}
else if (gi_508 && Bid – gd_444 >= MathRound(gd_272) * Point&&Tot_lot()>=Trendstep_start&&(MDA1>MDA2&& MDA3 == -1&& MDA2_2-MDA2>=Ent_sens*Point&&MDA2!=MDA2_2))
{
gi_500 = TRUE;
}
}
break;
}
}

if (gi_488 < 1) {
gi_508 = FALSE;
gi_504 = FALSE;
gi_500 = TRUE;
gd_388 = AccountEquity();
}
if (gi_500&&SPRL ==FALSE) {
gd_436 = f0_2();
gd_444 = f0_6();
if (gi_508) {
if (gi_312 || ls_92 == “true”) {
f0_1(0, 1);
gd_476 = NormalizeDouble(gd_148 * order_lots_60, gd_96);
} else gd_476 = f0_14(OP_SELL);
if (gi_128 && ls_84 == “true”) {
gi_472 = gi_488;
if (gd_476 > 0.0) {
RefreshRates();
gi_512 = f0_15(1, gd_476, Bid, g_slippage_156, Ask, 0, 0, Symbol() + “-” + gs_88 + “-” + gi_472, gi_356, 0, HotPink);
if (gi_512 < 0) {
Print(“Error: “, GetLastError());
return (0);
}
gd_444 = f0_6();
gi_500 = FALSE;
gi_516 = TRUE;
st = TRUE;
}
}
} else {
if (gi_504) {
if (gi_312 || ls_92 == “true”) {
f0_1(1, 0);
gd_476 = NormalizeDouble(gd_148 * order_lots_52, gd_96);
} else gd_476 = f0_14(OP_BUY);
if (gi_128 && ls_84 == “true”) {
gi_472 = gi_488;
if (gd_476 > 0.0) {
gi_512 = f0_15(0, gd_476, Ask, g_slippage_156, Bid, 0, 0, Symbol() + “-” + gs_88 + “-” + gi_472, gi_356, 0, Lime);
if (gi_512 < 0) {
Print(“Error: “, GetLastError());
return (0);
}
gd_436 = f0_2();
gi_500 = FALSE;
gi_516 = TRUE;
st=TRUE;
}
}
}
}
}
if(Step_modify_mode>0&&st)
{
if((Step_modify_mode ==1&&f0_16()>=Step_modify_start)||(Step_modify_mode ==2&&Tot_lot()>=Step_modify_start))
{
gd_272*=Step_modify_rate;

}
}
switch(Use_Medium)
{
case 0:
{
if (gi_500 && gi_488 < 1&&SPRL ==FALSE) {
iclose_68 = iClose(Symbol(), 0, 2);
iclose_76 = iClose(Symbol(), 0, 1);
g_bid_420 = Bid;
g_ask_428 = Ask;
if ((!gi_508) && !gi_504 && ls_84 == “true”) {
gi_472 = gi_488;
if (iclose_68 > iclose_76) {
gd_476 = f0_14(OP_SELL);
if (gd_476 > 0.0) {
gi_512 = f0_15(1, gd_476, g_bid_420, g_slippage_156, g_bid_420, 0, 0, Symbol() + “-” + gs_88 + “-” + gi_472, gi_356, 0, HotPink);
if (gi_512 < 0) {
Print(gd_476, “Error: “, GetLastError());
return (0);
}
gd_436 = f0_2();
gi_516 = TRUE;
}
} else {
gd_476 = f0_14(OP_BUY);
if (gd_476 > 0.0) {
gi_512 = f0_15(0, gd_476, g_ask_428, g_slippage_156, g_ask_428, 0, 0, Symbol() + “-” + gs_88 + “-” + gi_472, gi_356, 0, Lime);
if (gi_512 < 0) {
Print(gd_476, “Error: “, GetLastError());
return (0);
}
gd_444 = f0_6();
gi_516 = TRUE;
}
}
}
if (gi_512 > 0) gi_468 = TimeCurrent() + 60.0 * (60.0 * gd_324);
gi_500 = FALSE;
}
break;
}
case 1:
{
if (gi_500 && gi_488 < 1&&SPRL ==FALSE) {
g_bid_420 = Bid;
g_ask_428 = Ask;
if ((!gi_508) && !gi_504 && ls_84 == “true”) {
gi_472 = gi_488;
if (MDA1>MDA2&& MDA3 == -1&& MDA2_2-MDA2>=Ent_sens*Point&&MDA2!=MDA2_2) {
gd_476 = f0_14(OP_SELL);
if (gd_476 > 0.0) {
gi_512 = f0_15(1, gd_476, g_bid_420, g_slippage_156, g_bid_420, 0, 0, Symbol() + “-” + gs_88 + “-” + gi_472, gi_356, 0, HotPink);
if (gi_512 < 0) {
Print(gd_476, “Error: “, GetLastError());
return (0);
}
gd_436 = f0_2();
gi_516 = TRUE;
}
} else if (MDA1<MDA2&&MDA3==1&& MDA1-MDA1_2>=Ent_sens*Point&&MDA1!=MDA1_2) {
gd_476 = f0_14(OP_BUY);
if (gd_476 > 0.0) {
gi_512 = f0_15(0, gd_476, g_ask_428, g_slippage_156, g_ask_428, 0, 0, Symbol() + “-” + gs_88 + “-” + gi_472, gi_356, 0, Lime);
if (gi_512 < 0) {
Print(gd_476, “Error: “, GetLastError());
return (0);
}
gd_444 = f0_6();
gi_516 = TRUE;
}
}
}
if (gi_512 > 0) gi_468 = TimeCurrent() + 60.0 * (60.0 * gd_324);
gi_500 = FALSE;
}
break;
}
case 2:
{
if (gi_500 && gi_488 < 1&&SPRL ==FALSE) {
g_bid_420 = Bid;
g_ask_428 = Ask;
if ((!gi_508) && !gi_504 && ls_84 == “true”) {
gi_472 = gi_488;
if ((MDA1>MDA2&& MDA3 == -1&& MDA2_2-MDA2>=Ent_sens*Point&&MDA2!=MDA2_2)&&(MDB1>MDB2&& MDB3 == -1&& MDB2_2-MDB2>=Ent_sens*Point&&MDB2!=MDB2_2)) {
gd_476 = f0_14(OP_SELL);
if (gd_476 > 0.0) {
gi_512 = f0_15(1, gd_476, g_bid_420, g_slippage_156, g_bid_420, 0, 0, Symbol() + “-” + gs_88 + “-” + gi_472, gi_356, 0, HotPink);
if (gi_512 < 0) {
Print(gd_476, “Error: “, GetLastError());
return (0);
}
gd_436 = f0_2();
gi_516 = TRUE;
}
} else if ((MDA1<MDA2&&MDA3==1&& MDA1-MDA1_2>=Ent_sens*Point&&MDA1!=MDA1_2)&&(MDB1<MDB2&&MDB3==1&& MDB1-MDB1_2>=Ent_sens*Point&&MDB1!=MDB1_2)) {
gd_476 = f0_14(OP_BUY);
if (gd_476 > 0.0) {
gi_512 = f0_15(0, gd_476, g_ask_428, g_slippage_156, g_ask_428, 0, 0, Symbol() + “-” + gs_88 + “-” + gi_472, gi_356, 0, Lime);
if (gi_512 < 0) {
Print(gd_476, “Error: “, GetLastError());
return (0);
}
gd_444 = f0_6();
gi_516 = TRUE;
}
}
}
if (gi_512 > 0) gi_468 = TimeCurrent() + 60.0 * (60.0 * gd_324);
gi_500 = FALSE;
}
break;
}
}

gi_488 = f0_16();
g_price_412 = 0;
double ld_108 = 0;
for (g_pos_484 = OrdersTotal() – 1; g_pos_484 >= 0; g_pos_484–) {
if(OrderSelect(g_pos_484, SELECT_BY_POS, MODE_TRADES));
else Print(“OrderSelect ERROR in 555 string,medium price function”);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != gi_356) continue;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == gi_356) {
if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
g_price_412 += OrderOpenPrice() * OrderLots();
ld_108 += OrderLots();
}
}
}
if(ld_108>=Cutout_point&&Cutout_mode == 2)
{
for (g_pos_484 = OrdersTotal() – 1; g_pos_484 >= 0; g_pos_484–) {
if(OrderSelect(g_pos_484, SELECT_BY_POS, MODE_TRADES));
else Print(“OrderSelect ERROR in 568 string,cutout by lot function”);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != gi_356) continue;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == gi_356) {
if (OrderType() == OP_BUY || OrderType() == OP_SELL)
{
if(OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),g_slippage_156,Yellow));
else Print(“OrderClose ERROR in 574 string,cutout by lot function”);
}
}
}

}
if(TP_modify_mode>0&&st)
{
if((TP_modify_mode ==1&&f0_16()>=TP_modify_start)||(TP_modify_mode ==2&&Tot_lot()>=TP_modify_start))
{
gd_224*=TP_modify_rate;
}
}
if (gi_488 > 0) g_price_412 = NormalizeDouble(g_price_412 / ld_108, Digits);
if (gi_516) {
for (g_pos_484 = OrdersTotal() – 1; g_pos_484 >= 0; g_pos_484–) {
if(OrderSelect(g_pos_484, SELECT_BY_POS, MODE_TRADES));
else Print(“OrderSelect ERROR in 584 string,medium price function”);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != gi_356) continue;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == gi_356) {
if (OrderType() == OP_BUY) {

g_price_380 = g_price_412 + MathRound(gd_224) * Point;
gd_unused_396 = g_price_380;
gd_492 = g_price_412 – g_pips_232 * Point;
gi_460 = TRUE;
}
}
if (OrderSymbol() == Symbol() && OrderMagicNumber() == gi_356) {
if (OrderType() == OP_SELL) {

g_price_380 = g_price_412 – MathRound(gd_224) * Point;
gd_unused_404 = g_price_380;
gd_492 = g_price_412 + g_pips_232 * Point;
gi_460 = TRUE;
}
}
}
}
if (gi_516) {
if (gi_460 == TRUE) {
for (g_pos_484 = OrdersTotal() – 1; g_pos_484 >= 0; g_pos_484–) {
if(OrderSelect(g_pos_484, SELECT_BY_POS, MODE_TRADES));
else Print(“OrderSelect ERROR in 608 string,modify take_profit function”);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != gi_356) continue;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == gi_356) if(OrderModify(OrderTicket(), g_price_412, OrderStopLoss(), g_price_380, 0, Yellow));else Print(“OrderModify ERROR in 610 string,modify take-profit function”);
gi_516 = FALSE;
}
}
}
oc = f0_16();
if(ShowInfo)
{
Comment(“Orders total in terminal: “,OrdersTotal(),”\n”,”Orders total in current window: “, f0_16(),”\n”,”Total series lot :”,Tot_lot(),”\n”,”Trendstep status :”, trendstep,”\n”,”Enter market : “,usemedium,”\n”,”Breakeven status: “,breakeven,”\n”,”Cutout status :”,cutout,”\n”,”Spread limit :”,spreadlimit,”\n”,”TP modify status :”,tpmodifystatus,”\n”,”Step modify status :”,stepmodifystatus );
}
return (0);
}

double f0_11(double ad_0) {
return (NormalizeDouble(ad_0, Digits));
}

int f0_1(bool ai_0 = TRUE, bool ai_4 = TRUE) {
int li_ret_8 = 0;
for (int pos_12 = OrdersTotal() – 1; pos_12 >= 0; pos_12–) {
if (OrderSelect(pos_12, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol() == Symbol() && OrderMagicNumber() == gi_356) {
if (OrderType() == OP_BUY && ai_0) {
RefreshRates();
if (!IsTradeContextBusy()) {
if (!OrderClose(OrderTicket(), OrderLots(), f0_11(Bid), 5, CLR_NONE)) {
Print(“Error close BUY ” + OrderTicket());
li_ret_8 = -1;
}
} else {
if (g_datetime_520 == iTime(NULL, 0, 0)) return (-2);
g_datetime_520 = iTime(NULL, 0, 0);
Print(“Need close BUY ” + OrderTicket() + “. Trade Context Busy”);
return (-2);
}
}
if (OrderType() == OP_SELL && ai_4) {
RefreshRates();
if (!IsTradeContextBusy()) {
if (!(!OrderClose(OrderTicket(), OrderLots(), f0_11(Ask), 5, CLR_NONE))) continue;
Print(“Error close SELL ” + OrderTicket());
li_ret_8 = -1;
continue;
}
if (g_datetime_524 == iTime(NULL, 0, 0)) return (-2);
g_datetime_524 = iTime(NULL, 0, 0);
Print(“Need close SELL ” + OrderTicket() + “. Trade Context Busy”);
return (-2);
}
}
}
}
return (li_ret_8);
}

double f0_14(int a_cmd_0) {
double ld_ret_4;
int datetime_12;
switch (MMType) {
case 0:
ld_ret_4 = gd_200;
break;
case 1:
double m = f0_16()-1;
double x;
if(m<0)
{
x=0;
}
else if(m>=0)
{
x = f0_16()-1;
}
ld_ret_4 = NormalizeDouble(gd_200 * MathPow(gd_148, x), gd_96);
Print(“Mult”,ld_ret_4);
break;
case 2:
datetime_12 = 0;
ld_ret_4 = gd_200;
for (int pos_20 = OrdersHistoryTotal() – 1; pos_20 >= 0; pos_20–) {
if (!(OrderSelect(pos_20, SELECT_BY_POS, MODE_HISTORY))) return (-3);
if (OrderSymbol() == Symbol() && OrderMagicNumber() == gi_356) {
if (datetime_12 < OrderCloseTime()) {
datetime_12 = OrderCloseTime();
if (OrderProfit() < 0.0) {
ld_ret_4 = NormalizeDouble(OrderLots() * gd_148, gd_96);
continue;
}
ld_ret_4 = gd_200;
continue;
return (-3);
}
}
}
}
if (AccountFreeMarginCheck(Symbol(), a_cmd_0, ld_ret_4) <= 0.0) return (-1);
if (GetLastError() == 134/* NOT_ENOUGH_MONEY */) return (-2);
return (ld_ret_4);
}

int f0_16() {
int count_0 = 0;
for (int pos_4 = OrdersTotal() – 1; pos_4 >= 0; pos_4–) {
if(OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES));
else Print(“OrderSelect ERROR in 714 string,order count function”);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != gi_356) continue;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == gi_356)
if (OrderType() == OP_SELL || OrderType() == OP_BUY) count_0++;
}
return (count_0);
}

void f0_3() {
for (int pos_0 = OrdersTotal() – 1; pos_0 >= 0; pos_0–) {
if(OrderSelect(pos_0, SELECT_BY_POS, MODE_TRADES));
else Print(“OrderSelect ERROR in 725 string”);
if (OrderSymbol() == Symbol()) {
if (OrderSymbol() == Symbol() && OrderMagicNumber() == gi_356) {
if (OrderType() == OP_BUY) if(OrderClose(OrderTicket(), OrderLots(), Bid, g_slippage_156, Blue));else Print(“OrderClose ERROR in 728 string”);
if (OrderType() == OP_SELL) if(OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_156, Red));else Print(“OrderClose ERROR in 729 string”);
}
Sleep(1000);
}
}
}

int f0_15(int ai_0, double a_lots_4, double a_price_12, int a_slippage_20, double ad_24, int ai_unused_32, int ai_36, string a_comment_40, int a_magic_48, int a_datetime_52, color a_color_56) {
int ticket_60 = 0;
int error_64 = 0;
int count_68 = 0;
int li_72 = 100;
switch (ai_0) {
case 2:
for (count_68 = 0; count_68 < li_72; count_68++) {
ticket_60 = OrderSend(Symbol(), OP_BUYLIMIT, a_lots_4, a_price_12, a_slippage_20, f0_12(ad_24, g_pips_232), f0_17(a_price_12, ai_36), a_comment_40, a_magic_48, a_datetime_52,
a_color_56);
error_64 = GetLastError();
if (error_64 == 0/* NO_ERROR */) break;
if (!((error_64 == 4/* SERVER_BUSY */ || error_64 == 137/* BROKER_BUSY */ || error_64 == 146/* TRADE_CONTEXT_BUSY */ || error_64 == 136/* OFF_QUOTES */))) break;
Sleep(1000);
}
break;
case 4:
for (count_68 = 0; count_68 < li_72; count_68++) {
ticket_60 = OrderSend(Symbol(), OP_BUYSTOP, a_lots_4, a_price_12, a_slippage_20, f0_12(ad_24, g_pips_232), f0_17(a_price_12, ai_36), a_comment_40, a_magic_48, a_datetime_52,
a_color_56);
error_64 = GetLastError();
if (error_64 == 0/* NO_ERROR */) break;
if (!((error_64 == 4/* SERVER_BUSY */ || error_64 == 137/* BROKER_BUSY */ || error_64 == 146/* TRADE_CONTEXT_BUSY */ || error_64 == 136/* OFF_QUOTES */))) break;
Sleep(5000);
}
break;
case 0:
for (count_68 = 0; count_68 < li_72; count_68++) {
RefreshRates();
ticket_60 = OrderSend(Symbol(), OP_BUY, a_lots_4, Ask, a_slippage_20, f0_12(Bid, g_pips_232), f0_17(Ask, ai_36), a_comment_40, a_magic_48, a_datetime_52, a_color_56);
error_64 = GetLastError();
if (error_64 == 0/* NO_ERROR */) break;
if (!((error_64 == 4/* SERVER_BUSY */ || error_64 == 137/* BROKER_BUSY */ || error_64 == 146/* TRADE_CONTEXT_BUSY */ || error_64 == 136/* OFF_QUOTES */))) break;
Sleep(5000);
}
break;
case 3:
for (count_68 = 0; count_68 < li_72; count_68++) {
ticket_60 = OrderSend(Symbol(), OP_SELLLIMIT, a_lots_4, a_price_12, a_slippage_20, f0_0(ad_24, g_pips_232), f0_4(a_price_12, ai_36), a_comment_40, a_magic_48, a_datetime_52,
a_color_56);
error_64 = GetLastError();
if (error_64 == 0/* NO_ERROR */) break;
if (!((error_64 == 4/* SERVER_BUSY */ || error_64 == 137/* BROKER_BUSY */ || error_64 == 146/* TRADE_CONTEXT_BUSY */ || error_64 == 136/* OFF_QUOTES */))) break;
Sleep(5000);
}
break;
case 5:
for (count_68 = 0; count_68 < li_72; count_68++) {
ticket_60 = OrderSend(Symbol(), OP_SELLSTOP, a_lots_4, a_price_12, a_slippage_20, f0_0(ad_24, g_pips_232), f0_4(a_price_12, ai_36), a_comment_40, a_magic_48, a_datetime_52,
a_color_56);
error_64 = GetLastError();
if (error_64 == 0/* NO_ERROR */) break;
if (!((error_64 == 4/* SERVER_BUSY */ || error_64 == 137/* BROKER_BUSY */ || error_64 == 146/* TRADE_CONTEXT_BUSY */ || error_64 == 136/* OFF_QUOTES */))) break;
Sleep(5000);
}
break;
case 1:
for (count_68 = 0; count_68 < li_72; count_68++) {
ticket_60 = OrderSend(Symbol(), OP_SELL, a_lots_4, Bid, a_slippage_20, f0_0(Ask, g_pips_232), f0_4(Bid, ai_36), a_comment_40, a_magic_48, a_datetime_52, a_color_56);
error_64 = GetLastError();
if (error_64 == 0/* NO_ERROR */) break;
if (!((error_64 == 4/* SERVER_BUSY */ || error_64 == 137/* BROKER_BUSY */ || error_64 == 146/* TRADE_CONTEXT_BUSY */ || error_64 == 136/* OFF_QUOTES */))) break;
Sleep(5000);
}
}
return (ticket_60);
}

double f0_12(double ad_0, int ai_8) {
if (ai_8 == 0) return (0);
return (ad_0 – ai_8 * Point);
}

double f0_0(double ad_0, int ai_8) {
if (ai_8 == 0) return (0);
return (ad_0 + ai_8 * Point);
}

double f0_17(double ad_0, int ai_8) {
if (ai_8 == 0) return (0);
return (ad_0 + ai_8 * Point);
}

double f0_4(double ad_0, int ai_8) {
if (ai_8 == 0) return (0);
return (ad_0 – ai_8 * Point);
}

double f0_5() {
double ld_ret_0 = 0;
for (g_pos_484 = OrdersTotal() – 1; g_pos_484 >= 0; g_pos_484–) {
if(OrderSelect(g_pos_484, SELECT_BY_POS, MODE_TRADES));
else Print(“OrderSelect ERROR in 828 string”);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != gi_356) continue;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == gi_356)
if (OrderType() == OP_BUY || OrderType() == OP_SELL) ld_ret_0 += OrderProfit();
}
return (ld_ret_0);
}

void f0_18(int ai_0, int ai_4, double a_price_8) {
int li_16;
double order_stoploss_20;
double price_28;
if (ai_4 != 0) {
for (int pos_36 = OrdersTotal() – 1; pos_36 >= 0; pos_36–) {
if (OrderSelect(pos_36, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol() != Symbol() || OrderMagicNumber() != gi_356) continue;
if (OrderSymbol() == Symbol() || OrderMagicNumber() == gi_356) {
if (OrderType() == OP_BUY) {
li_16 = NormalizeDouble((Bid – a_price_8) / Point, 0);
if (li_16 < ai_0) continue;
order_stoploss_20 = OrderStopLoss();
price_28 = Bid – ai_4 * Point;
if (order_stoploss_20 == 0.0 || (order_stoploss_20 != 0.0 && price_28 > order_stoploss_20)) if(OrderModify(OrderTicket(), a_price_8, price_28, OrderTakeProfit(), 0, Aqua));else Print(“OrderModify ERROR in 850 string”);
}
if (OrderType() == OP_SELL) {
li_16 = NormalizeDouble((a_price_8 – Ask) / Point, 0);
if (li_16 < ai_0) continue;
order_stoploss_20 = OrderStopLoss();
price_28 = Ask + ai_4 * Point;
if (order_stoploss_20 == 0.0 || (order_stoploss_20 != 0.0 && price_28 < order_stoploss_20)) if(OrderModify(OrderTicket(), a_price_8, price_28, OrderTakeProfit(), 0, Red));else Print(“OrderModify ERROR in 857 string”);
}
}
Sleep(1000);
}
}
}
}

double f0_7() {
if (f0_16() == 0) gd_528 = AccountEquity();
if (gd_528 < gd_536) gd_528 = gd_536;
else gd_528 = AccountEquity();
gd_536 = AccountEquity();
return (gd_528);
}

double f0_2() {
double order_open_price_0;
int ticket_8;
double ld_unused_12 = 0;
int ticket_20 = 0;
for (int pos_24 = OrdersTotal() – 1; pos_24 >= 0; pos_24–) {
if(OrderSelect(pos_24, SELECT_BY_POS, MODE_TRADES));
else Print(“OrderSelect ERROR in 881 string”);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != gi_356) continue;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == gi_356 && OrderType() == OP_BUY) {
ticket_8 = OrderTicket();
if (ticket_8 > ticket_20) {
order_open_price_0 = OrderOpenPrice();
ld_unused_12 = order_open_price_0;
ticket_20 = ticket_8;
}
}
}
return (order_open_price_0);
}

double f0_6() {
double order_open_price_0;
int ticket_8;
double ld_unused_12 = 0;
int ticket_20 = 0;
for (int pos_24 = OrdersTotal() – 1; pos_24 >= 0; pos_24–) {
if(OrderSelect(pos_24, SELECT_BY_POS, MODE_TRADES));
else Print(“OrderSelect ERROR in 902 string”);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != gi_356) continue;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == gi_356 && OrderType() == OP_SELL) {
ticket_8 = OrderTicket();
if (ticket_8 > ticket_20) {
order_open_price_0 = OrderOpenPrice();
ld_unused_12 = order_open_price_0;
ticket_20 = ticket_8;
}
}
}
return (order_open_price_0);
}

 

void f0_13() {
double ld_0 = f0_8(0);
string name_8 = gs_104 + “1”;
if (ObjectFind(name_8) == -1) {
ObjectCreate(name_8, OBJ_LABEL, 0, 0, 0);
ObjectSet(name_8, OBJPROP_CORNER, 1);
ObjectSet(name_8, OBJPROP_XDISTANCE, 10);
ObjectSet(name_8, OBJPROP_YDISTANCE, 15);
}
ObjectSetText(name_8, “青疣犷蝾?皴泐漤: ” + DoubleToStr(ld_0, 2), g_fontsize_544, “Courier New”, g_color_548);
ld_0 = f0_8(1);
name_8 = gs_104 + “2”;
if (ObjectFind(name_8) == -1) {
ObjectCreate(name_8, OBJ_LABEL, 0, 0, 0);
ObjectSet(name_8, OBJPROP_CORNER, 1);
ObjectSet(name_8, OBJPROP_XDISTANCE, 10);
ObjectSet(name_8, OBJPROP_YDISTANCE, 33);
}
ObjectSetText(name_8, “青疣犷蝾?怊屦? ” + DoubleToStr(ld_0, 2), g_fontsize_544, “Courier New”, g_color_548);
ld_0 = f0_8(2);
name_8 = gs_104 + “3”;
if (ObjectFind(name_8) == -1) {
ObjectCreate(name_8, OBJ_LABEL, 0, 0, 0);
ObjectSet(name_8, OBJPROP_CORNER, 1);
ObjectSet(name_8, OBJPROP_XDISTANCE, 10);
ObjectSet(name_8, OBJPROP_YDISTANCE, 51);
}
ObjectSetText(name_8, “青疣犷蝾?镱玎怊屦? ” + DoubleToStr(ld_0, 2), g_fontsize_544, “Courier New”, g_color_548);
name_8 = gs_104 + “4”;
if (ObjectFind(name_8) == -1) {
ObjectCreate(name_8, OBJ_LABEL, 0, 0, 0);
ObjectSet(name_8, OBJPROP_CORNER, 1);
ObjectSet(name_8, OBJPROP_XDISTANCE, 10);
ObjectSet(name_8, OBJPROP_YDISTANCE, 76);
}
ObjectSetText(name_8, “拎豚眈 : ” + DoubleToStr(AccountBalance(), 2), g_fontsize_544, “Courier New”, g_color_548);
}

 

double f0_8(int ai_0) {
double ld_ret_4 = 0;
for (int pos_12 = 0; pos_12 < OrdersHistoryTotal(); pos_12++) {
if (!(OrderSelect(pos_12, SELECT_BY_POS, MODE_HISTORY))) break;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
if (OrderCloseTime() >= iTime(Symbol(), PERIOD_D1, ai_0) && OrderCloseTime() < iTime(Symbol(), PERIOD_D1, ai_0) + 86400) ld_ret_4 = ld_ret_4 + OrderProfit() + OrderCommission() + OrderSwap();
}
return (ld_ret_4);
}

void breakeven()
{
double SL = MarketInfo(Symbol(),MODE_STOPLEVEL);
for (int pos_24 = OrdersTotal() – 1; pos_24 >= 0; pos_24–) {
if(OrderSelect(pos_24, SELECT_BY_POS, MODE_TRADES));
else Print(“OrderSelect ERROR in 976 string,breakeven function”);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != gi_356) continue;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == gi_356){
if(OrderType() == OP_BUY)
{
if(Bid – OrderOpenPrice()>=SL*Point&&OrderOpenPrice()!=OrderStopLoss())
{
if(OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,clrAntiqueWhite));
else Print(“OrderModify ERROR in 984 string,breakeven function”);
}
}
else if(OrderType() == OP_SELL)
{
if(OrderOpenPrice() – Ask>=SL*Point&&OrderOpenPrice()!=OrderStopLoss())
{
if(OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0,clrAntiqueWhite));
else Print(“OrderModify ERROR in 991 string,breakeven function”);
}
}

}
}

}

double Tot_lot() {
double ld_ret_0 = 0;
for (g_pos_484 = OrdersTotal() – 1; g_pos_484 >= 0; g_pos_484–) {
if(OrderSelect(g_pos_484, SELECT_BY_POS, MODE_TRADES));
else Print(“OrderSelect ERROR in 1003 string,total lot function”);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != gi_356) continue;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == gi_356)
if (OrderType() == OP_BUY || OrderType() == OP_SELL) ld_ret_0 += OrderLots();
}
return (ld_ret_0);
}

如果你对文件有了解,请帮助投票!

If you are familiar with the file, please help vote!

平均评分 0 / 5. 投票数: 0

到目前为止还没有投票!成为第一位投票人。

相关资源

暂无评论

none
暂无评论...