// /
//
#property copyright “FOREXLAB”
#property link “FOREXLAB”
//#include <stdlib.mqh>
#import “stdlib.ex4”
string IntegerToHexString(int a0); // 90267E7BE5477D1C3601D9A426F82FA1
#import “wininet.dll”
int InternetOpenA(string a0, int a1, string a2, string a3, int a4);
int InternetOpenUrlA(int a0, string a1, string a2, int a3, int a4, int a5);
int InternetReadFile(int a0, string a1, int a2, int& a3[]);
int InternetCloseHandle(int a0);
int InternetConnectA(int a0, string a1, int a2, string a3, string a4, int a5, int a6, int a7);
bool HttpSendRequestA(int a0, string a1, int a2, int& a3[], int a4);
bool HttpAddRequestHeadersA(int a0, string a1, int a2, int a3);
int HttpOpenRequestA(int a0, string a1, string a2, string a3, string a4, string& a5[], int a6, int a7);
#import
int Gia_76[] = {33, 42, 39, 40, 41, 59, 58, 64, 38, 61, 43, 36, 47, 63, 35, 91, 93};
//extern string LiveForexAccountNumber = “”;
//extern string Emailaddress = “”;
//extern string Contact = “kingask2013@gmail.com or Skype: xperya”;
//extern string Web = “Buy this EA at: http://mt4robots.blogspot.com”;
extern string Important1 = “Use default setting with leverage 1:500!”;
extern string Important2 = “Use on any time frame. But do NOT move between time frames.”;
extern string DemoInfo = “To use it in demo make sure you open a demo account right from your MT4!”;
extern string Currency = “Gold and Any Currency Pairs”;
extern string EA_Setting = “—— EA Setting ——“;
extern int MaxSpreads_Points = 1000;
int G_magic_156 = 99999;
int G_magic_160;
extern bool AutomaticCalculateMagic = TRUE;
extern bool Enabel_ECN_Broker = TRUE;
extern bool Enable_5Digit_Broker = TRUE;
extern bool KeepTrading = TRUE;
extern string Hidden_Pending_Setting = “—— Hidden Pending Setting ——“;
extern int Hidden_Pending_Distane_Pips = 10;
extern bool Close_PendingIfNotInTrade = TRUE;
extern double Close_PendingAfterMinutes = 0.3;
string Gs_unused_204 = ” —– News Setting —–“;
int Gi_unused_212 = 2;
bool Gi_216 = FALSE;
bool Gi_220 = TRUE;
int Gi_224 = 3;
int Gi_228 = 5;
int Gi_232 = 0;
bool Gi_236 = TRUE;
bool Gi_240 = TRUE;
bool Gi_244 = FALSE;
bool Gi_248 = FALSE;
bool Gi_252 = FALSE;
bool Gi_256 = FALSE;
bool Gi_260 = FALSE;
bool Gi_264 = FALSE;
bool Gi_268 = FALSE;
int Gi_272 = 1;
int Gi_276 = 1;
bool Gi_280 = TRUE;
bool Gi_284 = FALSE;
bool Gi_288 = TRUE;
int Gi_292 = 1;
int Gi_296 = 20;
int Gi_300 = 20;
extern string Profit_Settings = ” —– Trarget Profit and Steps Setting —–“;
extern double TotalProfit_Target = 0.01;
extern double TotalProfit_Step_Target = 0.01;
extern int Keep_TradeOpen = 0;
extern string Lot_Settings = ” —– Lots size & Auto Lots Setting —–“;
extern double LotSize = 0.1;
extern double MaxLot = 90.0;
extern bool AutoLot = FALSE;
extern double Amount_Per_baseLot = 15.0;
int G_slippage_368 = 3;
string Gs_buyline_372 = “buyline”;
string Gs_sellline_380 = “sellline”;
int G_datetime_388;
double Gd_392;
double Gd_400;
double Gd_408;
double Gd_416;
int G_count_424 = 0;
int Gi_428;
string Gsa_432[];
bool Gi_436 = TRUE;
double Gd_448;
double Gd_456;
bool Gi_464 = FALSE;
bool Gi_468 = TRUE;
bool Gi_472 = FALSE;
/*
int f0_9(string As_0, string &A_str_concat_8) {
int Li_16 = InternetOpenA(“Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)”, 0, “0”, “0”, 0);
int Li_20 = InternetOpenUrlA(Li_16, As_0, “0”, 0, -2080374528, 0);
if (Li_20 == 0) return (0);
int Lia_24[] = {1};
string Ls_28 = “”;
while (true) {
if (InternetReadFile(Li_20, Ls_28, 128, Lia_24) <= 0 || Lia_24[0] == 0) break;
A_str_concat_8 = StringConcatenate(A_str_concat_8, StringSubstr(Ls_28, 0, Lia_24[0]));
}
InternetCloseHandle(Li_20);
InternetCloseHandle(Li_16);
return (1);
}
*/
int init()
{
// string str_concat_0;
if (Enable_5Digit_Broker) {
Hidden_Pending_Distane_Pips = 10 * Hidden_Pending_Distane_Pips;
G_slippage_368 = 10 * G_slippage_368;
}
Gi_428 = TimeCurrent() – 5;
f0_6();
if (AutomaticCalculateMagic) G_magic_160 = f0_12();
else G_magic_160 = G_magic_156;
/*
int Li_8 = 0;
bool Li_12 = FALSE;
Li_8 = f0_9(“http://mt4robots.info/admin/usercheck.php?Email=” + Emailaddress + “&Account=” + LiveForexAccountNumber, str_concat_0);
if (Li_8 <= 0) Print(“Get function no conection”);
if (StringFind(str_concat_0, “1”, 0) >= 0) Li_12 = TRUE;
if ((!IsDemo()) && Li_12 == FALSE) {
Alert(“If you want use this EA for free please contact kingask2013@gmail.com or Skype: xperya”);
Gi_436 = FALSE;
}
*/
if (ObjectFind(Gs_buyline_372) != -1) ObjectDelete(Gs_buyline_372);
if (ObjectFind(Gs_sellline_380) != -1) ObjectDelete(Gs_sellline_380);
return (0);
}
int deinit() {
if (ObjectFind(Gs_buyline_372) != -1) ObjectDelete(Gs_buyline_372);
if (ObjectFind(Gs_sellline_380) != -1) ObjectDelete(Gs_sellline_380);
return (0);
}
int start() {
int icustom_0;
int Li_4;
int Li_8;
int Li_12;
double Ld_16;
double Ld_24;
if (Gi_436) {
if (Gi_216 && Gi_468) {
if (Gi_220) {
icustom_0 = iCustom(NULL, 0, “FFCal_04”, Gi_272, Gi_276, Gi_280, Gi_284, 1, Gi_236, Gi_240, Gi_256, Gi_260, Gi_252, Gi_244, Gi_264, Gi_248, Gi_268, Gi_288, Gi_292,
Gi_296, Gi_300, 1, 0);
if (icustom_0 >= Gi_224 && icustom_0 <= Gi_228 && (!Gi_464)) {
//Print(“make set”);
Gd_448 = Ask + Hidden_Pending_Distane_Pips * Point;
Gd_456 = Bid – Hidden_Pending_Distane_Pips * Point;
f0_14(Gs_buyline_372, Gd_448);
f0_14(Gs_sellline_380, Gd_456);
G_datetime_388 = TimeCurrent();
Gi_464 = TRUE;
}
} else {
icustom_0 = iCustom(NULL, 0, “FFCal_04”, Gi_272, Gi_276, Gi_280, Gi_284, 1, Gi_236, Gi_240, Gi_256, Gi_260, Gi_252, Gi_244, Gi_264, Gi_248, Gi_268, Gi_288, Gi_292,
Gi_296, Gi_300, 1, 1);
if (icustom_0 <= Gi_232 && (!Gi_464)) {
//Print(“make set”);
Gd_448 = Ask + Hidden_Pending_Distane_Pips * Point;
Gd_456 = Bid – Hidden_Pending_Distane_Pips * Point;
f0_14(Gs_buyline_372, Gd_448);
f0_14(Gs_sellline_380, Gd_456);
G_datetime_388 = TimeCurrent();
Gi_464 = TRUE;
}
}
} else {
if (!Gi_464) {
//Print(“make set”);
Gd_448 = Ask + Hidden_Pending_Distane_Pips * Point;
Gd_456 = Bid – Hidden_Pending_Distane_Pips * Point;
f0_14(Gs_buyline_372, Gd_448);
f0_14(Gs_sellline_380, Gd_456);
G_datetime_388 = TimeCurrent();
Gi_464 = TRUE;
}
}
if (!(Gi_464)) return (0);
Li_4 = f0_13();
Li_8 = f0_0();
Li_12 = f0_3();
if (Li_4 == 0 && Li_8 == 0) {
if (NormalizeDouble(Ask – Bid, Digits) < NormalizeDouble(MaxSpreads_Points * Point, Digits))
if (Ask >= Gd_448) f0_8();
if (Bid <= Gd_456) f0_10();
}
if (Li_4 == 1 && Li_8 == 0) f0_1();
if (Close_PendingIfNotInTrade) {
if (TimeCurrent() >= G_datetime_388 + 60.0 * Close_PendingAfterMinutes) {
if (Li_12 == 0) {
//Print(“1”);
if (ObjectFind(Gs_buyline_372) != -1) ObjectDelete(Gs_buyline_372);
if (ObjectFind(Gs_sellline_380) != -1) ObjectDelete(Gs_sellline_380);
Gi_464 = FALSE;
if (Li_8 > 0) {
if (KeepTrading) Gi_468 = TRUE;
else Gi_468 = FALSE;
}
}
}
}
if (Li_12 == 0) {
if (Li_8 > 0) {
//Print(“2”);
if (ObjectFind(Gs_buyline_372) != -1) ObjectDelete(Gs_buyline_372);
if (ObjectFind(Gs_sellline_380) != -1) ObjectDelete(Gs_sellline_380);
Gi_464 = FALSE;
if (KeepTrading) Gi_468 = TRUE;
else Gi_468 = FALSE;
}
} else {
Ld_16 = f0_5();
if (f0_7() == TRUE) {
Ld_24 = f0_11();
if (!Gi_472) {
Gd_392 = TotalProfit_Target * Ld_16;
Gd_408 = Gd_392;
Gd_416 = TotalProfit_Step_Target * Ld_16;
Gi_472 = TRUE;
}
if (Ld_24 > Gd_392) {
Gd_392 = Ld_24;
Print(“trade profit “, Gd_392);
if (G_count_424 > 0) Gd_400 = Gd_392 – Gd_416;
}
if (G_count_424 == 0 && Gd_392 – Gd_408 >= Gd_416) {
Gd_400 = Gd_392 – Gd_416;
Print(“profit for close “, Gd_400);
Print(“add step “);
G_count_424++;
}
if (G_count_424 > 0 && Ld_24 <= Gd_400) {
f0_2();
Print(“close with profit”, Gd_400);
G_count_424 = 0;
Gi_472 = FALSE;
}
}
}
return (0);
}
}
void f0_14(string A_name_0, double Ad_8) {
string name_16 = A_name_0;
if (ObjectFind(name_16) != -1) {
ObjectMove(name_16, 0, Time[0], Ad_8);
return;
}
ObjectCreate(name_16, OBJ_HLINE, 0, 0, Ad_8);
ObjectSet(name_16, OBJPROP_COLOR, Blue);
ObjectSet(name_16, OBJPROP_STYLE, STYLE_SOLID);
ObjectSet(name_16, OBJPROP_WIDTH, 1);
ObjectSet(name_16, OBJPROP_BACK, TRUE);
}
void f0_2() {
while (f0_3() > 0) {
for (int pos_0 = 0; pos_0 < OrdersTotal(); pos_0++) {
if (OrderSelect(pos_0, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol() == Symbol() && OrderType() <= OP_SELL && OrderMagicNumber() == G_magic_160) {
if (OrderType() == OP_BUY) OrderClose(OrderTicket(), OrderLots(), Bid, G_slippage_368, Black);
if (OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), Ask, G_slippage_368, Black);
}
}
}
}
}
int f0_5() {
int Li_ret_0 = NormalizeDouble(f0_4() / MarketInfo(Symbol(), MODE_MINLOT), 0);
return (Li_ret_0);
}
int f0_0() {
int count_0 = 0;
for (int pos_4 = 0; pos_4 < OrdersHistoryTotal(); pos_4++) {
if (OrderSelect(pos_4, SELECT_BY_POS, MODE_HISTORY)) {
if (OrderSymbol() == Symbol() && OrderType() <= OP_SELL)
if (OrderMagicNumber() == G_magic_160 && OrderOpenTime() >= G_datetime_388) count_0++;
}
}
return (count_0);
}
void f0_1() {
for (int pos_0 = 0; pos_0 < OrdersTotal(); pos_0++) {
if (OrderSelect(pos_0, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol() == Symbol() && OrderType() <= OP_SELL && OrderMagicNumber() == G_magic_160) {
if (OrderType() == OP_BUY) {
if (Bid <= Gd_456)
if (OrderClose(OrderTicket(), OrderLots(), Bid, G_slippage_368, Black)) break;
}
if (OrderType() == OP_SELL) {
if (Ask >= Gd_448)
if (OrderClose(OrderTicket(), OrderLots(), Ask, G_slippage_368, Black)) break;
}
}
}
}
}
int f0_3() {
int count_0 = 0;
for (int pos_4 = 0; pos_4 < OrdersTotal(); pos_4++) {
if (OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol() == Symbol() && OrderType() <= OP_SELL)
if (OrderMagicNumber() == G_magic_160) count_0++;
}
}
return (count_0);
}
int f0_13() {
int count_0 = 0;
for (int pos_4 = 0; pos_4 < OrdersTotal(); pos_4++) {
if (OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol() == Symbol() && OrderType() <= OP_SELL)
if (OrderMagicNumber() == G_magic_160 && OrderOpenTime() >= G_datetime_388) count_0++;
}
}
return (count_0);
}
void f0_8() {
int error_4;
int ticket_0 = 0;
bool Li_8 = TRUE;
while (Li_8) {
RefreshRates();
ticket_0 = OrderSend(Symbol(), OP_BUY, f0_4(), NormalizeDouble(Ask, Digits), G_slippage_368, 0, 0, “”, G_magic_160, 16711680);
Sleep(200);
if (ticket_0 > 0) Li_8 = FALSE;
else {
error_4 = GetLastError();
if (error_4 == 129/* INVALID_PRICE */ || error_4 == 138/* REQUOTE */) {
Sleep(200);
RefreshRates();
continue;
}
Li_8 = FALSE;
}
}
if (ticket_0 <= 0) Print(GetLastError());
}
void f0_10() {
int error_4;
int ticket_0 = 0;
bool Li_8 = TRUE;
while (Li_8) {
RefreshRates();
ticket_0 = OrderSend(Symbol(), OP_SELL, f0_4(), NormalizeDouble(Bid, Digits), G_slippage_368, 0, 0, “”, G_magic_160, 255);
Sleep(200);
if (ticket_0 > 0) Li_8 = FALSE;
else {
error_4 = GetLastError();
if (error_4 == 129/* INVALID_PRICE */ || error_4 == 138/* REQUOTE */) {
Sleep(200);
RefreshRates();
continue;
}
Li_8 = FALSE;
}
}
if (ticket_0 <= 0) Print(GetLastError());
}
double f0_4() {
double Ld_ret_0;
if (!AutoLot) Ld_ret_0 = LotSize;
else Ld_ret_0 = MathFloor(AccountEquity() / Amount_Per_baseLot) * MarketInfo(Symbol(), MODE_MINLOT);
if (Ld_ret_0 < MarketInfo(Symbol(), MODE_MINLOT)) Ld_ret_0 = MarketInfo(Symbol(), MODE_MINLOT);
if (Ld_ret_0 > MarketInfo(Symbol(), MODE_MAXLOT)) Ld_ret_0 = MarketInfo(Symbol(), MODE_MAXLOT);
if (Ld_ret_0 > MaxLot) Ld_ret_0 = MaxLot;
if (MarketInfo(Symbol(), MODE_MINLOT) == 0.1) Ld_ret_0 = NormalizeDouble(Ld_ret_0, 1);
if (MarketInfo(Symbol(), MODE_MINLOT) == 0.01) Ld_ret_0 = NormalizeDouble(Ld_ret_0, 2);
return (Ld_ret_0);
}
int f0_7() {
int datetime_0 = 0;
for (int pos_4 = 0; pos_4 < OrdersTotal(); pos_4++) {
if (OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol() == Symbol() && OrderMagicNumber() == G_magic_160 && OrderType() <= OP_SELL)
if (OrderOpenTime() > datetime_0 && OrderOpenTime() > Gi_428) datetime_0 = OrderOpenTime();
}
}
if (datetime_0 != 0) {
if (TimeCurrent() – datetime_0 > Keep_TradeOpen) return (1);
return (0);
}
return (0);
}
double f0_11() {
double Ld_ret_0 = 0;
for (int pos_8 = 0; pos_8 < OrdersTotal(); pos_8++) {
if (OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES))
if (OrderSymbol() == Symbol() && OrderMagicNumber() == G_magic_160 && OrderType() <= OP_SELL) Ld_ret_0 = Ld_ret_0 + OrderProfit() + OrderSwap() + OrderCommission();
}
return (Ld_ret_0);
}
int f0_12() {
int Li_ret_0 = 0;
int arr_size_4 = ArraySize(Gsa_432);
for (int index_8 = 0; index_8 < arr_size_4; index_8++)
if (Gsa_432[index_8] == Symbol()) Li_ret_0 = G_magic_156 + index_8;
return (Li_ret_0);
}
void f0_6() {
int Li_4;
int file_0 = FileOpenHistory(“symbols.raw”, FILE_BIN|FILE_READ);
if (file_0 >= 0) {
Li_4 = FileSize(file_0) / 1936;
ArrayResize(Gsa_432, Li_4);
for (int index_8 = 0; index_8 < Li_4; index_8++) {
Gsa_432[index_8] = FileReadString(file_0, 12);
FileSeek(file_0, 1924, SEEK_CUR);
}
}
}
相关资源
暂无评论...