-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathForexDerivative2_14.mq4
5778 lines (5707 loc) · 224 KB
/
ForexDerivative2_14.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
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#property copyright "Quantum Globe Inc."
#property link "http://www.forexderivative.com/"
/*
#import "ForexDerivative.dll"
int Func1(string a0, string a1);
void Func2(double& a0[], int a1, string a2);
int Func3(int a0);
#import
*/
int gia_76[];
string gs_unused_80 = "1.0.0";
bool gi_88;
int gi_92 = 0;
int g_timeframe_96 = PERIOD_M1;
int gi_100 = 2;
double gd_104 = 0.5;
double gd_112 = 2.0;
double gd_120 = 1.3;
double gd_128 = 1.3;
double gd_136 = 20.0;
double gd_144 = 4.0;
double gd_152 = 2.0;
double gd_160 = 1.0;
int gi_168 = 1;
int gi_172 = 1;
int gi_176 = 0;
int gi_180 = 0;
int gi_184 = 1;
int gi_188 = 10;
int gi_192 = 30;
int gi_196 = 10;
int gi_200 = 10;
int gi_204 = 100;
int gi_208 = 100;
int gi_212;
int g_timeframe_216 = PERIOD_M5;
int gi_220 = 1;
int gi_224 = 10;
double gda_228[];
double gd_232 = 0.8;
int gi_240 = 60;
int gi_244 = 70;
int gi_248 = 500;
int gi_252;
double gd_256 = 1.0;
double gd_264 = 0.3;
double gd_272 = 0.75;
int gi_280 = 2;
int gi_284 = 1;
double gd_288 = 2.0;
int gi_296 = 10;
int gi_300 = 1;
int gi_304 = 4;
int gi_308 = 2;
int gi_312;
int g_timeframe_316;
int g_period_320;
int g_ma_method_324 = MODE_EMA;
int gi_328;
double gd_332;
int g_period_340 = 15;
int gi_344 = 4;
int g_timeframe_348;
double gd_352 = 0.0;
double gd_360 = 0.0;
int gi_unused_368 = 40;
int gi_unused_372 = 1;
int gi_376 = 20;
int gi_380 = 0;
int gi_384 = 0;
double gd_388 = 10.0;
double gd_396 = 15.0;
int gi_404 = 10;
int gi_408 = 10;
double gd_412 = 1.0;
double gd_420 = 1.0;
int gi_428 = 8;
int gi_432 = 8;
int gi_unused_436 = 15;
int gi_unused_440 = 40;
double gd_444 = 4.0;
double gd_452 = 2.0;
double gd_460 = 5000.0;
int gi_468 = 1;
int gi_472 = 1;
int gi_476 = 1;
int gi_480 = 2;
double gd_484 = 15.0;
double g_period_492;
double gd_500 = 10.0;
double g_period_508;
int gi_516 = 1;
int g_timeframe_520;
int gi_524 = -10;
double g_period_528 = 100.0;
double gd_536 = 12.0;
double gd_544 = 10.0;
int gi_552 = 1;
int g_timeframe_556;
int g_ma_method_560 = MODE_EMA;
int g_period_564 = 14;
int gi_568 = 4;
int g_timeframe_572;
double gd_576 = 0.0;
double gd_584 = 0.0;
int g_timeframe_592 = PERIOD_M5;
int g_timeframe_596 = PERIOD_M15;
double gd_600 = 0.5;
double gd_608 = 0.25;
double gd_616 = 0.25;
double gd_624 = 2.0;
double gd_632 = 2.0;
int gi_640 = 0;
int gi_644 = 1;
int gi_648 = 20;
int gi_652 = 2;
int gi_656 = 1;
double gd_660 = 0.1;
int gi_668 = 0;
double gd_672 = 125.0;
double gd_680;
double gd_688 = 2.0;
double gd_696;
double gd_704 = 0.8;
int gi_712 = 0;
double gd_716 = 0.5;
int gi_724 = 1;
double gd_728 = 3.0;
double gd_736 = 0.3;
int gi_744 = 0;
int gi_748 = 12;
double gd_752;
double gd_760 = 0.9;
double gd_768 = 0.382;
int gi_776 = 2;
int gi_780 = 55;
double gd_784 = 30.0;
double gd_792 = 24.0;
double gd_unused_800 = 0.0;
double gd_unused_808 = 24.0;
int gi_unused_816 = 0;
int gi_820 = 1;
int gi_824 = 50;
int gi_828 = 0;
int gi_832 = 0;
//extern string KEY = "";
extern int MoneyManagement = 1;
double gd_848 = 1.0;
double gd_856 = 1.0;
double gd_864 = 1.0;
double gd_unused_872 = 0.1;
double gd_880 = 87878.0;
double gd_888 = 37841.0;
double gd_896 = 6748155.0;
double gd_904 = 100.0;
double gd_912 = 2000.0;
double gd_920 = 10000.0;
double gd_928 = 50000.0;
extern double FixLotSize = 1.0;
double gd_944 = 5.0;
double gd_952 = 2.0;
double gd_960 = 1232.0;
double gd_968 = 78.0;
double gd_976 = 192.0;
double gd_984 = 4786.0;
extern bool ProfitProtect = TRUE;
int g_bool_996;
double gd_1000 = 0.5;
double gd_1008 = 0.0;
double gd_1016 = 0.0;
double gd_1024 = 60.0;
extern bool Hedging = FALSE;
extern bool DisplayOnChart = TRUE;
extern bool EmailNotification = FALSE;
int gia_1044[][4];
int gia_1048[][4];
int gia_1052[][4];
int gia_1056[3];
double gda_1060[3];
string gsa_1064[3];
bool gi_1068 = FALSE;
extern bool ECN_TradeExecution = FALSE;
extern string INFO = "FOREX DERIVATIVE 2.0 v1.4";
bool gi_1084 = FALSE;
double gd_1088 = 6.0;
double gd_1096 = 6.0;
double gd_1104 = 7.0;
double gd_1112 = 7.0;
bool gi_1120;
bool gi_1124;
string gsa_1128[6];
bool gi_1132;
double gd_1136;
double gd_1144;
bool gi_1152;
bool gba_1156[];
double gda_1160[];
double gda_1164[];
bool gba_1168[];
double gda_1172[];
bool gba_1176[];
bool gi_1180;
double gd_1184;
bool gi_1192;
double gd_1196;
double gd_1204;
bool gi_1212;
double gd_1216;
bool gi_1224;
double gd_1228;
bool gi_1244;
bool gi_1248;
double gd_1252;
int gi_1260;
double gd_1264;
bool gi_1272;
bool gi_1276;
int gi_1280;
bool gi_1284 = FALSE;
double gd_unused_1288;
int gi_unused_1304;
bool gi_1308;
double gd_1312;
int gi_1320;
double gd_unused_1324;
double g_ima_on_arr_1332;
double g_ima_on_arr_1340;
int gi_1348 = 5000;
double g_ima_on_arr_1352;
int gia_1360[4];
int gi_1364;
int gi_1368;
double gda_1372[];
double gda_1376[];
int gia_1380[4];
int gia_1384[4];
int g_datetime_1392 = 0;
int g_datetime_1396 = 0;
int g_datetime_1400 = 0;
int g_datetime_1404 = 0;
int g_year_1408 = 0;
int g_datetime_1412 = 0;
bool gi_1416;
int gi_unused_1420;
bool gi_1424;
double gd_1428;
bool gi_1436;
double gd_1440;
double gd_unused_1448;
double gda_1456[];
int gi_1460;
int gi_1464;
int gi_unused_1468 = 200;
bool gi_1472;
int gi_1476;
int gi_1480;
int g_count_1484;
int g_count_1488;
double gd_1492;
double gd_1500;
int gi_1508;
double gd_1512;
int g_count_1520;
double gd_1524;
int gi_unused_1532 = 10;
bool gba_1536[];
double gda_1540[];
double gda_1544[];
double gda_1548[];
double gda_1552[];
double gda_1556[];
double gda_1560[];
int gia_1564[];
int gia_1568[];
int gi_1572;
bool gba_1576[];
int gia_1580[];
int gia_1584[];
int gia_1588[];
int gia_1592[];
double gda_1596[];
double gda_1600[];
double gda_1604[][3][3];
int gia_1608[];
double gd_1612;
double gd_1620;
double gd_1628;
double gd_1636;
double gd_1644;
double gd_1652;
double gd_1660;
double gd_1668;
double gd_1676;
double gd_1684;
double gd_1692;
double gd_1700;
bool gi_1708;
bool gi_1712;
bool gi_1716;
bool gi_1720;
int g_count_1724;
int g_count_1728;
int g_count_1732;
int g_count_1736;
int gi_1740;
int g_count_1744;
int g_count_1748;
int g_count_1752;
int g_count_1756;
double gd_1760;
double gd_1768;
double gd_1776;
double gd_1784;
double gd_1792;
double gd_1800;
double gd_1808;
bool gi_1816;
int gi_unused_1820;
double gd_1824;
double gd_1832;
double gd_1840;
double gd_1848;
int g_file_1856;
int g_file_1860;
int g_file_1864;
int g_file_1868;
double g_minlot_1872;
bool gi_1880;
bool gi_1884;
int gi_unused_1888;
int g_error_1892;
string gs_1896;
double gd_unused_1912;
int g_count_1920;
int gi_1924 = D'18.05.2009 12:00';
bool gi_1928;
bool gi_1932;
int gi_1936;
bool gi_1940 = TRUE;
bool gi_1944 = FALSE;
int gi_1948 = 0;
int gia_1952[4];
double gda_1956[];
double gda_1960[];
double gda_1964[];
double gda_1968[];
double gda_1972[];
double gda_1976[];
double gda_1980[];
double gda_1984[];
int gia_1988[4];
int gia_1992[4];
int gi_1996 = 500;
int gi_unused_2000 = 1800;
double gd_unused_2004 = 0.0;
double gd_unused_2012 = 0.0;
int gia_2020[];
bool gba_unused_2024[];
double gd_2028;
double gd_unused_2036;
int gi_2044;
int g_count_2048;
double gda_2052[][4];
string gs_unused_2056 = "V1_0_0";
int gi_2064 = 10;
double gd_2068 = 4.0;
double gd_2076 = 25.0;
string gs_unused_2084 = "OrderReliable fname unset";
int gi_unused_2092 = 0/* NO_ERROR */;
void FindLevels(int ai_0) {
int li_4;
int li_8;
int li_12;
int li_16;
double ld_20;
int li_40;
double ld_52;
double ld_64;
double ld_72;
double ld_80;
string ls_unused_88;
double lda_96[];
double lda_100[];
int li_116;
int lia_120[4];
int lia_124[4];
int li_136;
double ld_140;
int li_28 = 0;
int li_112 = 0;
if (ai_0 == 395790116) {
li_4 = gi_428;
li_8 = gi_380;
li_12 = gd_388;
li_16 = gi_404;
ld_20 = gd_412;
for (int l_index_104 = 0; l_index_104 < 4; l_index_104++) lia_124[l_index_104] = gia_1380[l_index_104];
} else {
if (ai_0 == 395790115) {
li_4 = gi_432;
li_8 = gi_384;
li_12 = gd_396;
li_16 = gi_408;
ld_20 = gd_420;
for (l_index_104 = 0; l_index_104 < 4; l_index_104++) lia_124[l_index_104] = gia_1384[l_index_104];
}
}
lia_120[0] = 4200;
lia_120[1] = 21000;
lia_120[2] = 259200;
lia_120[3] = 5184000;
gia_1952[0] = 1000;
gia_1952[1] = 1000;
gia_1952[2] = 1000;
gia_1952[3] = 1000;
li_28 = 0;
ArrayResize(lda_100, 1);
ArrayInitialize(lda_100, 0);
for (l_index_104 = li_8; l_index_104 < 4; l_index_104++) {
li_116 = gia_1952[l_index_104];
if (TimeCurrent() - lia_124[l_index_104] >= lia_120[l_index_104]) {
for (int li_60 = li_16; li_60 >= 2.5; li_60 = li_60 - 2.5) {
ld_64 = li_60 / 10000.0 * ld_20;
ld_72 = NormalizeDouble(iLow(NULL, gia_1360[l_index_104], iLowest(NULL, gia_1360[l_index_104], MODE_LOW, li_116, 0)), 4);
ld_80 = NormalizeDouble(iHigh(NULL, gia_1360[l_index_104], iHighest(NULL, gia_1360[l_index_104], MODE_HIGH, li_116, 0)), 4);
ArrayResize(gia_2020, (ld_80 - ld_72) / 0.0001 + 1.0);
ArrayInitialize(gia_2020, 0);
ArrayResize(lda_96, 1);
ArrayInitialize(lda_96, 0);
li_112 = 0;
for (double ld_128 = ld_72; ld_128 <= ld_80; ld_128 += 0.0001) {
li_136 = (ld_128 - ld_72) / 0.0001;
for (int li_48 = 1; li_48 < li_116; li_48++)
if (ld_128 > NormalizeDouble(iLow(NULL, gia_1360[l_index_104], li_48), 4) && ld_128 < NormalizeDouble(iHigh(NULL, gia_1360[l_index_104], li_48), 4)) gia_2020[li_136]++;
}
ld_140 = ld_64 / 0.0001;
for (ld_128 = ld_72 + ld_64; ld_128 <= ld_80 - ld_64; ld_128 += 0.0001) {
li_136 = (ld_128 - ld_72) / 0.0001;
if (gia_2020[li_136] == gia_2020[ArrayMinimum(gia_2020, 2.0 * ld_140, li_136 - ld_64 / 0.0001)] && gia_2020[li_136 - 1] != gia_2020[ArrayMinimum(gia_2020, 2.0 * ld_140, li_136 - ld_64 / 0.0001)] &&
gia_2020[ArrayMaximum(gia_2020, 2.0 * ld_140, li_136 - ld_64 / 0.0001)] - gia_2020[ArrayMinimum(gia_2020, 2.0 * ld_140, li_136 - ld_64 / 0.0001)] > li_60) {
ArrayResize(lda_96, li_112 + 1);
lda_96[li_112] = ld_72 + li_136 / 10000.0;
gd_2028 = ld_72 + li_136 / 10000.0;
gd_unused_2036 = lda_96[li_112];
li_112++;
}
}
if (li_112 >= li_4) break;
}
if (ld_72 != NormalizeDouble(iLow(NULL, gia_1360[l_index_104], 0), 4)) {
ArrayResize(lda_96, li_112 + 1);
lda_96[li_112] = ld_72;
li_112++;
}
if (ld_80 != NormalizeDouble(iHigh(NULL, gia_1360[l_index_104], 0), 4)) {
ArrayResize(lda_96, li_112 + 1);
lda_96[li_112] = ld_80;
li_112++;
}
if (ai_0 == 395790116) {
switch (gia_1360[l_index_104]) {
case 1:
ArrayResize(gda_1956, li_112);
ArrayCopy(gda_1956, lda_96, 0, 0, WHOLE_ARRAY);
break;
case 5:
ArrayResize(gda_1960, li_112);
ArrayCopy(gda_1960, lda_96, 0, 0, WHOLE_ARRAY);
break;
case 60:
ArrayResize(gda_1964, li_112);
ArrayCopy(gda_1964, lda_96, 0, 0, WHOLE_ARRAY);
break;
case 1440:
ArrayResize(gda_1968, li_112);
ArrayCopy(gda_1968, lda_96, 0, 0, WHOLE_ARRAY);
}
gia_1380[l_index_104] = TimeCurrent();
gia_1992[l_index_104] = li_112;
} else {
if (ai_0 == 395790115) {
switch (gia_1360[l_index_104]) {
case 1:
ArrayResize(gda_1972, li_112);
ArrayCopy(gda_1972, lda_96, 0, 0, WHOLE_ARRAY);
break;
case 5:
ArrayResize(gda_1976, li_112);
ArrayCopy(gda_1976, lda_96, 0, 0, WHOLE_ARRAY);
break;
case 60:
ArrayResize(gda_1980, li_112);
ArrayCopy(gda_1980, lda_96, 0, 0, WHOLE_ARRAY);
break;
case 1440:
ArrayResize(gda_1984, li_112);
ArrayCopy(gda_1984, lda_96, 0, 0, WHOLE_ARRAY);
}
gia_1384[l_index_104] = TimeCurrent();
gia_1988[l_index_104] = li_112;
}
}
}
}
li_28 = 0;
if (ai_0 == 395790116) {
if (li_8 <= 0) {
ArrayResize(lda_100, li_28 + gia_1992[0]);
ArrayCopy(lda_100, gda_1956, li_28, 0, WHOLE_ARRAY);
li_28 += gia_1992[0];
}
if (li_8 <= 1) {
ArrayResize(lda_100, li_28 + gia_1992[1]);
ArrayCopy(lda_100, gda_1960, li_28, 0, WHOLE_ARRAY);
li_28 += gia_1992[1];
}
if (li_8 <= 2) {
ArrayResize(lda_100, li_28 + gia_1992[2]);
ArrayCopy(lda_100, gda_1964, li_28, 0, WHOLE_ARRAY);
li_28 += gia_1992[2];
}
if (li_8 <= 3) {
ArrayResize(lda_100, li_28 + gia_1992[3]);
ArrayCopy(lda_100, gda_1968, li_28, 0, WHOLE_ARRAY);
li_28 += gia_1992[3];
}
} else {
if (ai_0 == 395790115) {
if (li_8 <= 0) {
ArrayResize(lda_100, li_28 + gia_1988[0]);
ArrayCopy(lda_100, gda_1972, li_28, 0, WHOLE_ARRAY);
li_28 += gia_1988[0];
}
if (li_8 <= 1) {
ArrayResize(lda_100, li_28 + gia_1988[1]);
ArrayCopy(lda_100, gda_1976, li_28, 0, WHOLE_ARRAY);
li_28 += gia_1988[1];
}
if (li_8 <= 2) {
ArrayResize(lda_100, li_28 + gia_1988[2]);
ArrayCopy(lda_100, gda_1980, li_28, 0, WHOLE_ARRAY);
li_28 += gia_1988[2];
}
if (li_8 <= 3) {
ArrayResize(lda_100, li_28 + gia_1988[3]);
ArrayCopy(lda_100, gda_1984, li_28, 0, WHOLE_ARRAY);
li_28 += gia_1988[3];
}
}
}
double ld_156 = NormalizeDouble(iClose(NULL, 0, 0), 4);
double ld_164 = MathRound(ld_156 / 0.0001 / 1000.0);
ArrayResize(lda_100, li_28 + 3);
lda_100[li_28] = 1000.0 * ld_164 / 10000.0 + gi_1996 / 10000.0;
lda_100[li_28 + 1] = 1000.0 * ld_164 / 10000.0;
lda_100[li_28 + 2] = 1000.0 * ld_164 / 10000.0 - gi_1996 / 10000.0;
li_28 += 3;
ArraySort(lda_100);
if (li_28 > 0) {
ArrayResize(lda_96, li_28);
ArrayInitialize(lda_96, 0);
}
int li_44 = 0;
for (int l_index_36 = 0; l_index_36 < li_28; l_index_36++) {
ld_52 = lda_100[l_index_36];
li_40 = 1;
while (l_index_36 < li_28 && MathAbs(lda_100[l_index_36] - (lda_100[l_index_36 + 1])) < gi_376 * li_12 / 10000.0) {
ld_52 += lda_100[l_index_36 + 1];
li_40++;
l_index_36++;
}
if (li_40 != 0) lda_96[li_44] = ld_52 / li_40;
li_44 += 1;
}
li_28 = li_44;
ArrayResize(lda_96, li_28);
ArrayResize(lda_100, li_28);
ArrayInitialize(lda_100, 0);
ArrayCopy(lda_100, lda_96, 0, 0, WHOLE_ARRAY);
if (ai_0 == 395790116) {
gi_1364 = li_28;
ArrayResize(gda_1372, gi_1364);
ArrayInitialize(gda_1372, 0);
ArrayCopy(gda_1372, lda_100, 0, 0, WHOLE_ARRAY);
return;
}
if (ai_0 == 395790115) {
gi_1368 = li_28;
ArrayResize(gda_1376, gi_1368);
ArrayInitialize(gda_1376, 0);
ArrayCopy(gda_1376, lda_100, 0, 0, WHOLE_ARRAY);
}
}
void FindTP_SR(int ai_0, int ai_4) {
double ld_8;
double ld_16;
double ld_24;
double ld_32;
bool li_40;
bool li_44;
int li_48;
double ld_56;
double ld_64;
bool li_72;
bool li_76;
double ld_80;
if (ai_4 == 395790116) ld_80 = gd_444;
else
if (ai_4 == 395790115) ld_80 = gd_452;
if (ai_4 == 395790116) {
ld_8 = NormalizeDouble(iClose(NULL, 0, 0), 4);
if (ai_0 == 1) ld_16 = ld_8 + gd_460 / 10000.0;
else ld_16 = ld_8 - gd_460 / 10000.0;
if (ld_16 > gda_1372[gi_1364 - 1]) {
li_44 = TRUE;
ld_32 = gda_1372[gi_1364 - 1];
} else {
if (ld_16 < gda_1372[0]) {
li_40 = TRUE;
ld_24 = gda_1372[0];
} else {
for (int li_52 = 0; li_52 < gi_1364; li_52 += 1) {
if (ld_16 > gda_1372[li_52] && ld_16 <= gda_1372[li_52 + 1]) {
li_48 = li_52;
break;
}
}
ld_24 = gda_1372[li_48 + 1];
ld_32 = gda_1372[li_48];
li_40 = TRUE;
li_44 = TRUE;
}
}
} else {
if (ai_4 == 395790115) {
ld_8 = NormalizeDouble(iClose(NULL, 0, 0), 4);
if (ld_8 > gda_1376[gi_1368 - 1]) {
li_44 = TRUE;
ld_32 = gda_1376[gi_1368 - 1];
} else {
if (ld_8 < gda_1376[0]) {
li_40 = TRUE;
ld_24 = gda_1376[0];
} else {
for (li_52 = 0; li_52 < gi_1368; li_52 += 1) {
if (ld_8 > gda_1376[li_52] && ld_8 <= gda_1376[li_52 + 1]) {
li_48 = li_52;
break;
}
}
ld_24 = gda_1376[li_48 + 1];
ld_32 = gda_1376[li_48];
li_40 = TRUE;
li_44 = TRUE;
}
}
}
}
if (ai_4 == 395790115) {
if (ai_0 == 1 && li_40 == TRUE) {
if (ld_24 - ld_8 > ld_80 * gi_376 / 10000.0) {
ld_56 = ld_24 - ld_80 * gi_376 / 10000.0;
li_72 = TRUE;
li_76 = FALSE;
ld_64 = ld_24 + ld_80 * gi_376 / 10000.0;
} else {
if (gi_184 == 3) {
li_72 = FALSE;
ld_56 = ld_24 - ld_80 * gi_376 / 10000.0;
li_76 = TRUE;
ld_64 = ld_24 + ld_80 * gi_376 / 10000.0;
gi_1320 = 1;
} else {
ld_56 = ld_24;
li_72 = TRUE;
li_76 = FALSE;
ld_64 = 0;
}
}
} else {
if (ai_0 == 2 && li_44 == TRUE) {
if (ld_8 - ld_32 > ld_80 * gi_376 / 10000.0) {
ld_56 = ld_32 + ld_80 * gi_376 / 10000.0;
li_72 = TRUE;
li_76 = FALSE;
ld_64 = ld_32 - ld_80 * gi_376 / 10000.0;
} else {
if (gi_184 == 3) {
li_72 = FALSE;
ld_56 = ld_32 + ld_80 * gi_376 / 10000.0;
li_76 = TRUE;
ld_64 = ld_32 - ld_80 * gi_376 / 10000.0;
gi_1320 = 2;
} else {
ld_56 = ld_32;
li_72 = TRUE;
li_76 = FALSE;
ld_64 = ld_32 - ld_80 * gi_376 / 10000.0;
}
}
} else {
li_72 = FALSE;
li_76 = FALSE;
}
}
gi_1192 = li_72;
gd_1196 = ld_56;
gd_1312 = ld_64;
gi_1308 = li_76;
return;
}
if (ai_4 == 395790116) {
if (ai_0 == 1 && li_40 == TRUE) {
if (ld_24 - ld_8 > ld_80 * gi_376 / 10000.0) {
ld_56 = ld_24 - ld_80 * gi_376 / 10000.0;
li_72 = TRUE;
li_76 = FALSE;
ld_64 = ld_24 + ld_80 * gi_376 / 10000.0;
} else {
li_72 = FALSE;
ld_56 = ld_24 - ld_80 * gi_376 / 10000.0;
li_76 = TRUE;
ld_64 = ld_24 + ld_80 * gi_376 / 10000.0;
gi_1260 = 1;
}
} else {
if (ai_0 == 2 && li_44 == TRUE) {
if (ld_8 - ld_32 > ld_80 * gi_376 / 10000.0) {
ld_56 = ld_32 + ld_80 * gi_376 / 10000.0;
li_72 = TRUE;
li_76 = FALSE;
ld_64 = ld_32 - ld_80 * gi_376 / 10000.0;
} else {
li_72 = FALSE;
ld_56 = ld_32 + ld_80 * gi_376 / 10000.0;
li_76 = TRUE;
ld_64 = ld_32 - ld_80 * gi_376 / 10000.0;
gi_1260 = 2;
}
} else {
if (ai_0 == 1) {
ld_56 = ld_8 + gd_460 / 10000.0 - ld_80 * gi_376 / 10000.0;
li_72 = TRUE;
li_76 = FALSE;
ld_64 = ld_8 + gd_460 / 10000.0 + ld_80 * gi_376 / 10000.0;
} else {
if (ai_0 == 2) {
ld_56 = ld_8 - gd_460 / 10000.0 + ld_80 * gi_376 / 10000.0;
li_72 = TRUE;
li_76 = FALSE;
ld_64 = ld_8 - gd_460 / 10000.0 - ld_80 * gi_376 / 10000.0;
} else {
li_72 = FALSE;
li_76 = FALSE;
}
}
}
}
gi_1132 = li_72;
gd_1136 = ld_56;
gd_1252 = ld_64;
gi_1248 = li_76;
}
}
void CheckStateSingleShot() {
gi_1120 = gi_1124;
switch (gi_1124) {
case 1:
if (Transition_Exit_SingleShot() != 1) return;
gi_1120 = FALSE;
gi_1308 = FALSE;
return;
case 0:
if (Transition_Entry_SingleShot() == 1) {
gi_1120 = TRUE;
return;
}
return;
}
}
int CheckEntrySingleShot() {
if (gi_1120 == TRUE && gi_1120 != gi_1124) {
if (gi_92 == 0) {
if (Transition_Entry_SingleShot() != 1) return (0);
gi_2044 = CheckSingleShotDirection(0);
if (gi_2044 == 1) return (1);
if (gi_2044 != 2) return (0);
return (2);
}
if (gi_92 == 1) {
if (gi_2044 == 1) return (1);
if (gi_2044 == 2) return (2);
}
}
return (0);
}
int Transition_Entry_SingleShot() {
bool li_4;
bool li_8;
bool li_12;
bool li_16;
int li_24;
int li_28;
int li_32;
double ld_36;
double l_ima_on_arr_44;
double ld_52;
double ld_60;
double ld_68;
double ld_76;
int l_highest_84;
int l_lowest_88;
int li_92;
double ld_96;
double ld_104;
int li_112;
int li_116;
bool li_ret_0 = FALSE;
if (SecureCallATR(0, g_timeframe_96, 1000, 0) == 0.0) return (0);
if (gi_92 == 0) {
li_4 = FALSE;
ld_52 = NormalizeDouble(iHigh(NULL, g_timeframe_96, iHighest(NULL, g_timeframe_96, MODE_HIGH, gi_100, 0)), 4);
ld_60 = NormalizeDouble(iLow(NULL, g_timeframe_96, iLowest(NULL, g_timeframe_96, MODE_LOW, gi_100, 0)), 4);
ld_68 = ld_52 - ld_60;
if (ld_68 > gd_104 * gi_100 * SecureCallATR(0, g_timeframe_96, 1000, 0) && CheckNoGap(0, gi_100, ld_68, g_timeframe_96, 0.3) == 1) li_4 = TRUE;
else return (0);
if (gi_168 == 0) li_8 = TRUE;
else {
li_8 = TRUE;
if (gi_168 == 2) li_24 = 1;
else li_24 = gi_100 - 1;
for (int li_20 = 0; li_20 < li_24; li_20++) {
gi_2044 = CheckSingleShotDirection(li_20);
if (gi_2044 == 0) {
li_8 = FALSE;
return (0);
}
if (li_20 >= 1 && li_32 != gi_2044) {
li_8 = FALSE;
return (0);
}
li_32 = gi_2044;
}
}
if (gi_172 == 0) li_12 = TRUE;
else {
li_12 = TRUE;
if (gi_172 == 2) li_24 = 1;
else li_24 = gi_100 - 1;
for (li_20 = 1; li_20 < li_24; li_20++) {
ld_36 = CheckSingleShotExpansion(li_20);
if (ld_36 < gd_120) {
li_12 = FALSE;
return (0);
}
}
}
if (gi_176 == 0) li_16 = TRUE;
else {
li_16 = TRUE;
if (g_timeframe_96 == PERIOD_M1) l_ima_on_arr_44 = g_ima_on_arr_1332;
else l_ima_on_arr_44 = g_ima_on_arr_1340;
if (gi_176 == 1 || gi_176 == 2) {
if (gi_176 == 2) li_24 = 1;
else li_24 = gi_100 - 1;
for (li_20 = 1; li_20 <= li_24; li_20++) {
if (iVolume(NULL, g_timeframe_96, li_20) < gd_128 * l_ima_on_arr_44) {
li_16 = FALSE;
return (0);
}
}
} else {
if (gi_176 == 3) {
ld_96 = CalculateVolumeMovementStrength(gi_100 - 1, 0, g_timeframe_96);
ld_104 = gd_128 * l_ima_on_arr_44 * gi_100;
if (ld_96 < ld_104) {
li_16 = FALSE;
return (0);
}
}
}
}
} else {
if (gi_92 == 1) {
li_4 = FALSE;
l_highest_84 = iHighest(NULL, g_timeframe_96, MODE_HIGH, gi_100, 0);
ld_52 = NormalizeDouble(iHigh(NULL, g_timeframe_96, l_highest_84), 4);
l_lowest_88 = iLowest(NULL, g_timeframe_96, MODE_LOW, gi_100, 0);
ld_60 = NormalizeDouble(iLow(NULL, g_timeframe_96, l_lowest_88), 4);
ld_68 = ld_52 - ld_60;
if (CheckNoGap(0, gi_100, ld_68, g_timeframe_96, 0.3) == 1) {
ld_76 = gd_104 * gi_100 * SecureCallATR(0, g_timeframe_96, 1000, 0);
li_112 = iClose(NULL, g_timeframe_96, 0) - ld_60 > ld_76;
li_116 = ld_52 - iClose(NULL, g_timeframe_96, 0) > ld_76;
if (li_112 == 1 && li_116 == 0) {
gi_2044 = 1;
li_92 = l_lowest_88;
li_4 = TRUE;
} else {
if (li_112 == 0 && li_116 == 1) {
gi_2044 = 2;
li_92 = l_highest_84;
li_4 = TRUE;
} else return (0);
}
} else return (0);
if (gi_168 == 0) li_8 = TRUE;
else {
li_8 = TRUE;
if (gi_168 == 2) li_24 = 1;
else li_24 = li_92;
for (li_20 = 0; li_20 < li_24; li_20++) {
li_28 = CheckSingleShotDirection(li_20);
if (li_28 != gi_2044) {
li_8 = FALSE;
return (0);
}
}
}
if (gi_172 == 0) li_12 = TRUE;
else {
li_12 = TRUE;
if (gi_172 == 2) li_24 = 1;
else li_24 = li_92;
for (li_20 = 1; li_20 < li_24; li_20++) {
ld_36 = CheckSingleShotExpansion(li_20);
if (ld_36 < gd_120) {
li_12 = FALSE;
return (0);
}
}
}
if (gi_176 == 0) li_16 = TRUE;
else {
li_16 = TRUE;
if (g_timeframe_96 == PERIOD_M1) l_ima_on_arr_44 = g_ima_on_arr_1332;
else l_ima_on_arr_44 = g_ima_on_arr_1340;
if (gi_176 == 1 || gi_176 == 2) {
if (gi_176 == 2) li_24 = 1;
else li_24 = li_92;
for (li_20 = 1; li_20 <= li_24; li_20++) {
if (iVolume(NULL, g_timeframe_96, li_20) < gd_128 * l_ima_on_arr_44) {
li_16 = FALSE;
return (0);
}
}
} else {
if (gi_176 == 3) {
ld_96 = CalculateVolumeMovementStrength(li_92, 0, g_timeframe_96);
ld_104 = gd_128 * l_ima_on_arr_44 * (li_92 + 1);
if (ld_96 < ld_104) {
li_16 = FALSE;
return (0);
}
}
}
}
}
}
li_ret_0 = li_4 && li_8 && li_12 && li_16;
return (li_ret_0);
}
int Transition_Exit_SingleShot() {
bool li_ret_0 = FALSE;
double ld_4 = NormalizeDouble(iHigh(NULL, g_timeframe_96, iHighest(NULL, g_timeframe_96, MODE_HIGH, gd_112 * gi_100, 0)), 4);
double ld_12 = NormalizeDouble(iLow(NULL, g_timeframe_96, iLowest(NULL, g_timeframe_96, MODE_LOW, gd_112 * gi_100, 0)), 4);
double ld_20 = ld_4 - ld_12;
if (ld_20 < gd_104 * gi_100 * SecureCallATR(0, g_timeframe_96, 1000, 0)) li_ret_0 = TRUE;
return (li_ret_0);
}
int CheckSingleShotDirection(int ai_0) {
int li_ret_4;
if (NormalizeDouble(iHigh(NULL, g_timeframe_96, ai_0), 4) > NormalizeDouble(iHigh(NULL, g_timeframe_96, ai_0 + 1), 4) && NormalizeDouble(iLow(NULL, g_timeframe_96, ai_0), 4) > NormalizeDouble(iLow(NULL, g_timeframe_96, ai_0 +
1), 4)) li_ret_4 = 1;
else {
if (NormalizeDouble(iHigh(NULL, g_timeframe_96, ai_0), 4) < NormalizeDouble(iHigh(NULL, g_timeframe_96, ai_0 + 1), 4) && NormalizeDouble(iLow(NULL, g_timeframe_96, ai_0), 4) < NormalizeDouble(iLow(NULL, g_timeframe_96, ai_0 +
1), 4)) li_ret_4 = 2;
else li_ret_4 = 0;
}
return (li_ret_4);
}
double CheckSingleShotExpansion(int ai_0) {
double ld_ret_36;
double ld_4 = NormalizeDouble(iHigh(NULL, g_timeframe_96, ai_0), 4);
double ld_12 = NormalizeDouble(iLow(NULL, g_timeframe_96, ai_0), 4);
double ld_20 = NormalizeDouble(iHigh(NULL, g_timeframe_96, ai_0 + 1), 4);
double ld_28 = NormalizeDouble(iLow(NULL, g_timeframe_96, ai_0 + 1), 4);
if (ld_20 - ld_28 == 0.0) ld_ret_36 = 10000;
else ld_ret_36 = (ld_4 - ld_12) / (ld_20 - ld_28);
return (ld_ret_36);
}