-
Notifications
You must be signed in to change notification settings - Fork 1
/
ForexHacked22.mq4
536 lines (516 loc) · 18.6 KB
/
ForexHacked22.mq4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
/*
Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
Website: http://purebeam.biz
E-mail : purebeam@gmail.com
*/
#property copyright "ForexHacked 2.2"
#property link "http://www.ForexHacked.com"
/*#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);
#import*/
extern string User = "Your ForexHacked.com Username";
extern string _________ = "Magic Number Must be UNIQUE for each chart!";
extern int MagicNumber = 133714;
extern double Lots = 0.01;
extern double TakeProfit = 132.0;
extern double Booster = 2.0;
extern int PipStarter = 170;
double gd_124 = 0.0;
int gi_unused_132 = 0;
int gi_136 = 0;
extern int MaxBuyOrders = 9;
extern int MaxSellOrders = 9;
extern bool AllowiStopLoss = FALSE;
extern int iStopLoss = 300;
extern int StartHour = 0;
extern int StartMinute = 0;
extern int StopHour = 23;
extern int StopMinute = 55;
extern int StartingTradeDay = 0;
extern int EndingTradeDay = 7;
extern int slippage = 3;
int gi_184 = 5000;
int gi_188 = 0;
int gi_192 = 0;
extern double StopLossPct = 100.0;
extern double TakeProfitPct = 100.0;
extern bool PauseNewTrades = FALSE;
extern int StoppedOutPause = 600;
double gd_220;
bool gi_236;
int g_period_240 = 7;
int gi_244 = 0;
int g_ma_method_248 = MODE_LWMA;
int g_applied_price_252 = PRICE_WEIGHTED;
double gd_256 = 0.25;
double gd_264 = 0.2;
extern bool SupportECN = TRUE;
extern bool MassHedge = FALSE;
extern double MassHedgeBooster = 1.01;
extern int TradesDeep = 5;
extern string EA_Name = "ForexHacked 2.2";
int g_datetime_300;
double g_point_304;
int gi_312;
bool gi_unused_316 = FALSE;
string gs_dummy_320;
int gi_328;
int gi_332;
int gi_336 = 0;
int gi_340 = 1;
int gi_unused_344 = 3;
int gi_348 = 250;
string gs_352;
bool gi_360;
bool gi_364;
bool gi_368;
bool gi_372;
int g_ticket_376;
int g_cmd_380;
string gs__hedged_384 = " hedged";
int gi_392;
void Log(string as_unused_0) {
if (gi_392 >= 0) {
}
}
int GetLotDigits() {
double ld_4 = MarketInfo(Symbol(), MODE_MINLOT);
for (int l_count_0 = 0; ld_4 < 1.0; l_count_0++) ld_4 = 10.0 * ld_4;
return (l_count_0);
}
double CalcLots(double ad_0) {
double l_minlot_32;
double ld_8 = AccountEquity() - gi_184;
double ld_16 = gi_188;
double ld_24 = gi_192;
if (gi_188 == 0 || gi_192 == 0) l_minlot_32 = ad_0;
else {
ld_16 = gi_184 * ld_16 / 100.0;
Print("tmp=" + ld_8 + ",AccountEquity()=" + AccountEquity() + ",InitEquity=" + gi_184);
ld_24 /= 100.0;
if (ld_8 > 0.0) ld_8 = MathPow(ld_24 + 1.0, ld_8 / ld_16);
else {
if (ld_8 < 0.0) ld_8 = MathPow(1 - ld_24, MathAbs(ld_8 / ld_16));
else ld_8 = 1;
}
l_minlot_32 = NormalizeDouble(ad_0 * ld_8, GetLotDigits());
if (l_minlot_32 < MarketInfo(Symbol(), MODE_MINLOT)) l_minlot_32 = MarketInfo(Symbol(), MODE_MINLOT);
}
if (l_minlot_32 < 0.0) Print("ERROR tmp=" + ld_8 + ",a=" + ld_16 + ",b=" + ld_24 + ",AccountEquity()=" + AccountEquity());
return (l_minlot_32);
}
/*int hSession(bool ai_0) {
string ls_4;
if (gi_328 == 0) {
ls_4 = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)";
gi_328 = InternetOpenA(ls_4, gi_336, "0", "0", 0);
gi_332 = InternetOpenA(ls_4, gi_340, "0", "0", 0);
}
if (ai_0) return (gi_332);
return (gi_328);
}
int GrabWeb(string as_0, string &as_8) {
int lia_24[] = {1};
string ls_28 = "x";
int li_16 = InternetOpenUrlA(hSession(0), as_0, "0", 0, -2080374528, 0);
if (li_16 == 0) return (0);
int li_20 = InternetReadFile(li_16, ls_28, gi_348, lia_24);
if (li_20 == 0) return (0);
int li_36 = lia_24[0];
for (as_8 = StringSubstr(ls_28, 0, lia_24[0]); lia_24[0] != 0; as_8 = as_8 + StringSubstr(ls_28, 0, lia_24[0])) {
li_20 = InternetReadFile(li_16, ls_28, gi_348, lia_24);
if (lia_24[0] == 0) break;
li_36 += lia_24[0];
}
li_20 = InternetCloseHandle(li_16);
if (li_20 == 0) return (0);
return (1);
}*/
int deinit() {
return (0);
}
int init() {
if (Digits == 3) {
gd_124 = 10.0 * TakeProfit;
gi_unused_132 = 10.0 * PipStarter;
gi_136 = 10.0 * iStopLoss;
g_point_304 = 0.01;
} else {
if (Digits == 5) {
gd_124 = 10.0 * TakeProfit;
gi_unused_132 = 10.0 * PipStarter;
gi_136 = 10.0 * iStopLoss;
g_point_304 = 0.0001;
} else {
gd_124 = TakeProfit;
gi_unused_132 = PipStarter;
gi_136 = iStopLoss;
g_point_304 = Point;
}
}
gi_312 = MathRound((-MathLog(MarketInfo(Symbol(), MODE_LOTSTEP))) / 2.302585093);
gi_360 = FALSE;
gi_364 = FALSE;
gi_368 = FALSE;
gi_372 = FALSE;
g_ticket_376 = -1;
gi_236 = FALSE;
g_cmd_380 = -1;
gs_352 = "approved";
Print("init is done");
return (0);
/*if (IsDemo() == TRUE) gs_352 = "approved";
else {
GrabWeb("http://www.ForexHacked.com/query.php?accountnumber=" + AccountNumber() + "&login=" + User, gs_352);
Print("init is done");
return (0);
}
return (0);*/
}
int IsTradeTime() {
int li_8;
if (DayOfWeek() < StartingTradeDay || DayOfWeek() > EndingTradeDay) return (0);
int li_0 = 60 * TimeHour(TimeCurrent()) + TimeMinute(TimeCurrent());
int li_4 = 60 * StartHour + StartMinute;
li_8 = 60 * StopHour + li_8;
if (li_4 == li_8) return (1);
if (li_4 < li_8) {
if (!(li_0 >= li_4 && li_0 < li_8)) return (0);
return (1);
}
if (li_4 > li_8) {
if (!(li_0 >= li_4 || li_0 < li_8)) return (0);
return (1);
}
return (0);
}
double GetLastLotSize(int ai_0) {
for (int l_pos_4 = OrdersTotal() - 1; l_pos_4 >= 0; l_pos_4--) {
if (OrderSelect(l_pos_4, SELECT_BY_POS)) {
if (OrderMagicNumber() == MagicNumber) {
if (StringFind(OrderComment(), gs__hedged_384) == -1) {
Log("GetLastLotSize " + ai_0 + ",OrderLots()=" + OrderLots());
return (OrderLots());
}
}
}
}
Log("GetLastLotSize " + ai_0 + " wasnt found");
return (0);
}
bool OpenBuy(bool ai_0 = FALSE) {
int l_ticket_4;
double l_lots_40;
double l_price_8 = 0;
double l_price_16 = 0;
string ls_24 = "";
bool li_ret_32 = TRUE;
if (TimeCurrent() - g_datetime_300 < 60) return (FALSE);
if (ai_0 && !gi_368) return (FALSE);
if (!GlobalVariableCheck("PERMISSION")) {
GlobalVariableSet("PERMISSION", TimeCurrent());
if (!SupportECN) {
if (ai_0) {
if (OrderSelect(g_ticket_376, SELECT_BY_TICKET)) l_price_16 = OrderTakeProfit() - MarketInfo(Symbol(), MODE_SPREAD) * Point;
} else l_price_8 = Ask + gd_124 * Point;
}
if (ai_0) ls_24 = gs__hedged_384;
if (AllowiStopLoss == TRUE) l_price_16 = Ask - gi_136 * Point;
if (ai_0) l_lots_40 = NormalizeDouble(GetLastLotSize(1) * MassHedgeBooster, 2);
else l_lots_40 = CalcLots(gd_220);
if (!SupportECN) l_ticket_4 = OrderSend(Symbol(), OP_BUY, l_lots_40, Ask, slippage, l_price_16, l_price_8, EA_Name + ls_24, MagicNumber, 0, Green);
else {
l_ticket_4 = OrderSend(Symbol(), OP_BUY, l_lots_40, Ask, slippage, 0, 0, EA_Name + ls_24, MagicNumber, 0, Green);
Sleep(1000);
OrderModify(l_ticket_4, OrderOpenPrice(), l_price_16, l_price_8, 0, Black);
}
g_datetime_300 = TimeCurrent();
if (l_ticket_4 != -1) {
if (!ai_0) {
g_ticket_376 = l_ticket_4;
Log("BUY hedgedTicket=" + g_ticket_376);
} else {
Log("BUY Hacked_ticket=" + l_ticket_4);
g_cmd_380 = 0;
}
} else {
Log("failed sell");
li_ret_32 = FALSE;
}
}
GlobalVariableDel("PERMISSION");
return (li_ret_32);
}
bool OpenSell(bool ai_0 = FALSE) {
int l_ticket_4;
double l_lots_36;
double l_price_8 = 0;
double l_price_16 = 0;
string ls_24 = "";
bool li_ret_32 = TRUE;
if (TimeCurrent() - g_datetime_300 < 60) return (FALSE);
if (ai_0 && !gi_372) return (FALSE);
if (!GlobalVariableCheck("PERMISSION")) {
GlobalVariableSet("PERMISSION", TimeCurrent());
if (!SupportECN) {
if (ai_0) {
if (OrderSelect(g_ticket_376, SELECT_BY_TICKET)) l_price_16 = OrderTakeProfit() + MarketInfo(Symbol(), MODE_SPREAD) * Point;
} else l_price_8 = Bid - gd_124 * Point;
}
if (ai_0) ls_24 = gs__hedged_384;
if (AllowiStopLoss == TRUE) l_price_16 = Bid + gi_136 * Point;
if (ai_0) l_lots_36 = NormalizeDouble(GetLastLotSize(0) * MassHedgeBooster, 2);
else l_lots_36 = CalcLots(gd_220);
if (!SupportECN) l_ticket_4 = OrderSend(Symbol(), OP_SELL, l_lots_36, Bid, slippage, l_price_16, l_price_8, EA_Name + ls_24, MagicNumber, 0, Pink);
else {
l_ticket_4 = OrderSend(Symbol(), OP_SELL, l_lots_36, Bid, slippage, 0, 0, EA_Name + ls_24, MagicNumber, 0, Pink);
Sleep(1000);
OrderModify(l_ticket_4, OrderOpenPrice(), l_price_16, l_price_8, 0, Black);
}
g_datetime_300 = TimeCurrent();
if (l_ticket_4 != -1) {
if (!ai_0) {
g_ticket_376 = l_ticket_4;
Log("SELL hedgedTicket=" + g_ticket_376);
} else {
Log("SELL Hacked_ticket=" + l_ticket_4);
g_cmd_380 = 1;
}
} else {
Log("failed sell");
li_ret_32 = FALSE;
}
}
GlobalVariableDel("PERMISSION");
return (li_ret_32);
}
void ManageBuy() {
int l_datetime_0 = 0;
double l_ord_open_price_4 = 0;
double l_ord_lots_12 = 0;
double l_ord_takeprofit_20 = 0;
int l_cmd_28 = -1;
int l_ticket_32 = 0;
int l_pos_36 = 0;
int l_count_40 = 0;
for (l_pos_36 = 0; l_pos_36 < OrdersTotal(); l_pos_36++) {
if (OrderSelect(l_pos_36, SELECT_BY_POS, MODE_TRADES)) {
if (OrderMagicNumber() == MagicNumber && OrderType() == OP_BUY) {
l_count_40++;
if (OrderOpenTime() > l_datetime_0) {
l_datetime_0 = OrderOpenTime();
l_ord_open_price_4 = OrderOpenPrice();
l_cmd_28 = OrderType();
l_ticket_32 = OrderTicket();
l_ord_takeprofit_20 = OrderTakeProfit();
}
if (OrderLots() > l_ord_lots_12) l_ord_lots_12 = OrderLots();
}
}
}
int li_44 = MathRound(MathLog(l_ord_lots_12 / Lots) / MathLog(Booster)) + 1.0;
if (li_44 < 0) li_44 = 0;
gd_220 = NormalizeDouble(Lots * MathPow(Booster, li_44), gi_312);
if (li_44 == 0 && StrategySignal() == 1 && IsTradeTime()) {
if (OpenBuy())
if (MassHedge) gi_360 = TRUE;
} else {
if (l_ord_open_price_4 - Ask > PipStarter * g_point_304 && l_ord_open_price_4 > 0.0 && l_count_40 < MaxBuyOrders) {
if (!(OpenBuy())) return;
if (!(MassHedge)) return;
gi_360 = TRUE;
return;
}
}
for (l_pos_36 = 0; l_pos_36 < OrdersTotal(); l_pos_36++) {
OrderSelect(l_pos_36, SELECT_BY_POS, MODE_TRADES);
if (OrderMagicNumber() != MagicNumber || OrderType() != OP_BUY || OrderTakeProfit() == l_ord_takeprofit_20 || l_ord_takeprofit_20 == 0.0) continue;
OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), l_ord_takeprofit_20, 0, Pink);
Sleep(1000);
}
}
int StrategySignal() {
double l_isar_0 = iSAR(NULL, 0, gd_256, gd_264, 0);
double l_ima_8 = iMA(NULL, 0, g_period_240, gi_244, g_ma_method_248, g_applied_price_252, 0);
if (l_isar_0 > l_ima_8) return (-1);
if (l_isar_0 < l_ima_8) return (1);
return (0);
}
void ManageSell() {
int l_datetime_0 = 0;
double l_ord_open_price_4 = 0;
double l_ord_lots_12 = 0;
double l_ord_takeprofit_20 = 0;
int l_cmd_28 = -1;
int l_ticket_32 = 0;
int l_pos_36 = 0;
int l_count_40 = 0;
for (l_pos_36 = 0; l_pos_36 < OrdersTotal(); l_pos_36++) {
if (OrderSelect(l_pos_36, SELECT_BY_POS, MODE_TRADES)) {
if (OrderMagicNumber() == MagicNumber && OrderType() == OP_SELL) {
l_count_40++;
if (OrderOpenTime() > l_datetime_0) {
l_datetime_0 = OrderOpenTime();
l_ord_open_price_4 = OrderOpenPrice();
l_cmd_28 = OrderType();
l_ticket_32 = OrderTicket();
l_ord_takeprofit_20 = OrderTakeProfit();
}
if (OrderLots() > l_ord_lots_12) l_ord_lots_12 = OrderLots();
}
}
}
int li_44 = MathRound(MathLog(l_ord_lots_12 / Lots) / MathLog(Booster)) + 1.0;
if (li_44 < 0) li_44 = 0;
gd_220 = NormalizeDouble(Lots * MathPow(Booster, li_44), gi_312);
if (li_44 == 0 && StrategySignal() == -1 && IsTradeTime()) {
if (OpenSell())
if (MassHedge) gi_364 = TRUE;
} else {
if (Bid - l_ord_open_price_4 > PipStarter * g_point_304 && l_ord_open_price_4 > 0.0 && l_count_40 < MaxSellOrders) {
if (!(OpenSell())) return;
if (!(MassHedge)) return;
gi_364 = TRUE;
return;
}
}
for (l_pos_36 = 0; l_pos_36 < OrdersTotal(); l_pos_36++) {
if (OrderSelect(l_pos_36, SELECT_BY_POS, MODE_TRADES)) {
if (OrderMagicNumber() == MagicNumber && OrderType() == OP_SELL) {
if (OrderTakeProfit() == l_ord_takeprofit_20 || l_ord_takeprofit_20 == 0.0) continue;
OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), l_ord_takeprofit_20, 0, Pink);
}
}
}
}
int start() {
double l_ord_takeprofit_20;
double l_price_28;
double l_price_36;
if (gs_352 != "approved") {
Comment("Access denied!",
"\nMake you inputed your correct ForexHacked.com username into the EA paramaters",
"\nMake sure you login to http://www.ForexHacked.com/membership/login.php and input your forex account number in your profile settings");
return (0);
}
int l_count_4 = 0;
int l_count_8 = 0;
for (int l_pos_12 = 0; l_pos_12 < OrdersTotal(); l_pos_12++) {
if (OrderSelect(l_pos_12, SELECT_BY_POS, MODE_TRADES)) {
if (OrderMagicNumber() == MagicNumber) {
if (StringFind(OrderComment(), gs__hedged_384) == -1) {
if (OrderType() == OP_BUY) l_count_4++;
else
if (OrderType() == OP_SELL) l_count_8++;
}
}
}
}
if (l_count_4 >= TradesDeep) {
if (!gi_372) {
Log("Allow long hedge! trades=" + l_count_4 + ",TradesDeep=" + TradesDeep);
gi_372 = TRUE;
}
}
if (l_count_8 >= TradesDeep) {
if (!gi_368) {
Log("Allow short hedge! trades=" + l_count_8 + ",TradesDeep=" + TradesDeep);
gi_368 = TRUE;
}
}
bool li_16 = FALSE;
if ((100 - StopLossPct) * AccountBalance() / 100.0 >= AccountEquity()) {
Log("AccountBalance=" + AccountBalance() + ",AccountEquity=" + AccountEquity());
gi_236 = TRUE;
li_16 = TRUE;
}
if ((TakeProfitPct + 100.0) * AccountBalance() / 100.0 <= AccountEquity()) gi_236 = TRUE;
if (gi_236) {
for (int l_pos_0 = OrdersTotal() - 1; l_pos_0 >= 0; l_pos_0--) {
if (OrderSelect(l_pos_0, SELECT_BY_POS)) {
if (OrderMagicNumber() == MagicNumber) {
Log("close #" + OrderTicket());
if (!OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), MarketInfo(Symbol(), MODE_SPREAD), White)) {
Log("error");
return (0);
}
}
}
}
gi_236 = FALSE;
if (li_16) {
Sleep(1000 * StoppedOutPause);
li_16 = FALSE;
}
gi_372 = FALSE;
gi_368 = FALSE;
}
if (SupportECN) {
l_ord_takeprofit_20 = 0;
if (OrderSelect(g_ticket_376, SELECT_BY_TICKET)) l_ord_takeprofit_20 = OrderTakeProfit();
for (l_pos_0 = 0; l_pos_0 < OrdersTotal(); l_pos_0++) {
if (OrderSelect(l_pos_0, SELECT_BY_POS)) {
if (OrderMagicNumber() == MagicNumber) {
if (OrderTakeProfit() == 0.0 && StringFind(OrderComment(), gs__hedged_384) == -1) {
if (OrderType() == OP_BUY) OrderModify(OrderTicket(), 0, OrderStopLoss(), OrderOpenPrice() + gd_124 * Point, 0, White);
else
if (OrderType() == OP_SELL) OrderModify(OrderTicket(), 0, OrderStopLoss(), OrderOpenPrice() - gd_124 * Point, 0, White);
} else {
if (StringFind(OrderComment(), gs__hedged_384) != -1 && g_cmd_380 == OrderType()) {
l_price_28 = l_ord_takeprofit_20 - MarketInfo(Symbol(), MODE_SPREAD) * Point;
l_price_36 = l_ord_takeprofit_20 + MarketInfo(Symbol(), MODE_SPREAD) * Point;
if (OrderStopLoss() == 0.0 || (OrderType() == OP_BUY && OrderStopLoss() != l_price_28) || (OrderType() == OP_SELL && OrderStopLoss() != l_price_36)) {
if (OrderType() == OP_BUY) OrderModify(OrderTicket(), 0, l_price_28, OrderTakeProfit(), 0, White);
else
if (OrderType() == OP_SELL) OrderModify(OrderTicket(), 0, l_price_36, OrderTakeProfit(), 0, White);
}
}
}
}
}
}
}
if (Check() != 0) {
ManageBuy();
ManageSell();
if (!PauseNewTrades && IsTradeTime()) {
if (gi_364)
if (OpenBuy(1)) gi_364 = FALSE;
if (gi_360)
if (OpenSell(1)) gi_360 = FALSE;
}
ChartComment();
return (0);
}
return (0);
}
void ChartComment() {
string l_dbl2str_0 = DoubleToStr(balanceDeviation(2), 2);
Comment(" \nForexHacked V2.2 ",
"\nAccount Leverage : " + "1 : " + AccountLeverage(),
"\nAccount Type : " + AccountServer(),
"\nServer Time : " + TimeToStr(TimeCurrent(), TIME_SECONDS),
"\nAccount Equity = ", AccountEquity(),
"\nFree Margin = ", AccountFreeMargin(),
"\nDrawdown : ", l_dbl2str_0, "%\n");
}
int Check() {
return (1);
}
double balanceDeviation(int ai_0) {
double ld_ret_4;
if (ai_0 == 2) {
ld_ret_4 = (AccountEquity() / AccountBalance() - 1.0) / (-0.01);
if (ld_ret_4 > 0.0) return (ld_ret_4);
return (0);
}
if (ai_0 == 1) {
ld_ret_4 = 100.0 * (AccountEquity() / AccountBalance() - 1.0);
if (ld_ret_4 > 0.0) return (ld_ret_4);
return (0);
}
return (0.0);
}