-
Notifications
You must be signed in to change notification settings - Fork 1
/
exp_Lego_4_Beta.mq4
executable file
·1253 lines (1049 loc) · 48.4 KB
/
exp_Lego_4_Beta.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
//+-------------------------------------------------------------------+
//| Build_Own_Strategy!.mq4 |
//| © 2007 v0 - AutoGrapf.dp.ua | // It was shared for MQL4 book. So, there are no any reserved copyrights except open source since beginning.
//| v1 2010 Seletsky R.V. aka Romari | // Also shared on MQL4.com . R is for Roman... I guess.
//| v2,v3 - by 26_994 | // All are shared.
//| v4 2011 Yakov Gloodun aka 26_994 |// Yes, it's my name. And sorry me for my English - my mother teaches it.
//+-------------------------------------------------------------------+
//-----------------------------------------------------------------------------------------------------------+
// Èíñòðóêöèÿ ïî ïðèìåíåíèþ - â êîäå |
//-----------------Paramethers--------------------------------------------------------------------- 1 -------+
// Íîâè÷êàì - ëó÷øå ïîïðîáóéòå äîñòàòü íà MQL4.com ÷òî-íèáóäü ñ ðåéòèíãîì "10.0" èç ãîòîâûõ ñîâåòíèêîâ (ñàìûå êîììåíòèðóåìûå! ÷òîáû ãàðàíòèÿ)
extern string Instructsia = "...çäåñü è âíóòðè";
extern string ShiftTunes = "Øèôò (áàð). Íà âñå èíäèêàòîðû, êðîìå 2ÌÀ è ïîëüçîâàòåëüñêèõ";
extern double GeneralShift = 0; // 0 - íåçàêðûòûé áàð, 1 - çàêðûòûé.
extern string Implemented_Indicators = "Çàâîäñêèå èíäèêàòîðû. 12 øòóê. Ïðîíóìåðîâàíû";
extern string WARNING1 = "ÑÂÎÉÑÒÂÀ ÈÍÄÈÊÀÒÎÐÀ ÍÀÑÒÐÀÈÂÀÞÒÑß Â ÊÎÍÑÎËÈ";
extern string WARNING2 = "ÓÁÅÄÈÒÅÑÜ, ×ÒÎ ÈÍÄÈÊÀÒÎÐÛ ÏÎÑÒÀÂËÅÍÛ ÏÐÀÂÈËÜÍÎ,";
extern string WARNING3 = "ÈÍÀ×Å ÑÒÐÀÒÅÃÈß ÁÓÄÅÒ ÈÑÏÎÐ×ÅÍÀ";
extern string Note_Âñåì = " Êîíñîëü òðåáóåò íåáîëüøîãî êîäåðñêîãî ÷óòüÿ èëè ÷üåé-òî ïîìîùè";
extern string The_List_Of = " ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----";
extern string Indicators1 = " Òðåíäîâûå èíäèêàòîðû îòñåèâàþò øóìû! Ìåæäó âõîäîì è îæèäàíèåì! ";
extern string Indicators2 = " Îñöèëëÿòîðû - âûáèðàþò ìåæäó ïîêóïêîé èëè ïðîäàæåé! ";
extern string Indicators3 = " Òðåíäîâûå ËÎÂßÒ ÑÈËÓ - Îñöèëëÿòîðû ÂÛÁÈÐÀÞÒ ÏÓÒÜ. ";
extern string Indicators4 = " ";
extern string Indicator_1 = "2MA (MACD 0-line-mode æå)";
extern bool otkr_MA =false;
extern bool zakr_MA =false; // Ïåðåñå÷åíèå _äâóõ_ ñêîëüçÿùèõ. Ïðÿìî êàê MACD-"íóëåâàÿ ëèíèÿ".
extern double MA1 =4;
extern double MA2 =67;
extern double Shift_1 =1; // Øèôò - ýòî áàð, íà êîòîðûé îïèðàåòñÿ ñîâåòíèê. 1 - ñâåæåçàêðûâøèéñÿ, 0 - òåêóùèé, 3 - òðè ñâå÷è íàçàä...
extern double Shift_2 =1;
extern double MA_type =1; //0 - Simple, 1 - Expotential, 2 - Smoothed, 3 - Linear Weighed. Most people are using EMA.
extern string Indicator_2 = "Êëàññèêà - Ñòîõàñòè÷åñêèé Îñöèëëÿòîð.";
extern bool otkr_Stoh =false;//
extern bool zakr_Stoh =false;
extern double per_K=5;
extern double per_D=3;
extern double slow=3;
extern double zoneBUY=20;
extern double zoneSELL=80; //Ñòàðàÿ òåìà - íèêòî íå ëþáèò íàñòðàèâàòü óðîâíè ïî îòäåëüíîñòè.
extern string Indicator_3 = "---- Awesome (std) ----"; // Îçíà÷àåò std, ðàçóìååòñÿ, standard. Ýòî îçíà÷àåò, ÷òî èíäèêàòîð... íå íàñòðàèâàëñÿ âàìè. Ïîìåòêà. Ìåíÿ â ïëàíå âûêëàäûâàíèÿ êóñêîâ êîäà ìîæåòå íå æäàòü.
extern bool otkr_AO =false;
extern bool zakr_AO =false;
extern string StdDev = "--- StdDev (std) ----"; //Òî æå ñàìîå, ÷òî è ïîëîñû Áîëëèíäæåðà - òîëüêî â îòä. îêíå.
extern bool otkr_StdDev=false;
extern bool zakr_StdDev=false;
extern double StdDevMAPeriod =14;
extern double StdDevMAShift =0;
extern double StdDevLimitToOpen =0.0025;
extern double StdDevLimitToClose =0.0025;// Íåáîëüøîé òðþê - âû ìîæåòå ïîñòàâèòü ToClose âûøå, ÷åì ToOpen.
extern string Indicator_4 = "---- Demarker (std) ---- ";
extern bool otkr_Dema =false;
extern bool zakr_Dema =false;
extern double DeMa_period=14;
extern double niz_ur=0.3;
extern double verx_ur=0.7;
extern string Indicator_5 = "---- CCI (std) ---- ";
extern bool otkr_CCI =false;
extern bool zakr_CCI =false;
extern double CCI_period=14;
extern double CCI_Level=100; // What, if we want 95?
extern string Indicator_6 = "---- RSI (std) ----";
extern bool otkr_RSI =false;
extern bool zakr_RSI =false;
extern double RSI_Period =14;
extern double RSI_High=70;
extern double RSI_Low=30;
extern string Indicator_7 = "---- MACD (std) ---- ";
extern bool otkr_MACD =false;
extern bool zakr_MACD =false;
extern double MACD_Fast=9;
extern double MACD_Slow=26; // MACD uses SIGNAL line
extern double MACD_Signal=14; // because you have 2 MA Cross system
extern string Indicator_8 = "---- OsMA (std) ---- ";
extern bool otkr_OsMA =false;
extern bool zakr_OsMA =false;
extern double OsMA_Fast=9;
extern double OsMA_Slow=26; // SIGNAL line (Well, you can also try Zignal.com as a platform - expenseful lux look is a sort of guaranty. Yes, I've made an ad here - Anon MMMMMMMMMI)
extern double OsMA_Signal=14; // because you have 2 MA Cross system
extern string Indicator_9 = "---- WPR aka %R (std) ---- ";//Williams Percent Range
extern bool otkr_WPR = false;
extern bool zakr_WPR = false;
extern double WPR_Period = 14;
extern string Indicator_10 = "---- MFI (std) ---- ";
extern bool otkr_MFI = false;
extern bool zakr_MFI = false;
extern double MFI_Period=14;
extern double MFI_High =70;
extern double MFI_Low =30;
extern string Indicator_11 = "---- ADX (std) ----"; //Main Line 30/70
extern bool otkr_ADX = false;
extern bool zakr_ADX = false;
extern double ADX_Period=14;
extern string Indicator_12 = "---- SAR (std) ---- ";
extern bool otkr_SAR = false;
extern bool zakr_SAR = false;
extern double SAR_Step =0.02;
extern double SAR_MaxStep =0.2;
extern string Custom_Indicator_û_0 = " __________________ ";
extern string Custom_Indicator_û_1 = "Ïîëüçîâàòåëüñêèå èíäèêàòîðû";
extern string Custom_Indicator_û_2 = "Ïðåäïîëàãàåòñÿ, ÷òî îíè íàñòðîåíû ÷åðåç ðåäàêòèðîâíàèå êîäà.";
extern string Custom_Indicator_û_3 = "Âñ¸ ïðîñòî - ìåíÿåòå Name_X íà íàçâàíèå ñâîåãî èíäèêàòîðà";
extern string Custom_Indicator_û_4 = " ";
extern string IndName1 = "Name1";
extern bool otkr_Custom_1 = false;
extern bool zakr_Custom_1 = false;
extern double Shift1 =0;
extern string IndName2 = "Name2";
extern bool otkr_Custom_2 = false;
extern bool zakr_Custom_2 = false;
extern double Shift2 =0;
extern string IndName3 = "ZigZag - òåïåðü ïîíÿòíî, êàê?"; // Ïîíÿòíî êàê? :)
extern bool otkr_Custom_3 = false;
extern bool zakr_Custom_3 = false;
extern double Shift3 =0;
extern string IndName4 = "Name4";
extern bool otkr_Custom_4 = false;
extern bool zakr_Custom_4 = false;
extern double Shift4 =0;
extern string IndName5 = "Name5";
extern bool otkr_Custom_5 = false;
extern bool zakr_Custom_5 = false;
extern double Shift5 =0;
extern string IndName6 = "Name6";
extern bool otkr_Custom_6 = false;
extern bool zakr_Custom_6 = false;
extern double Shift6 =0;
extern string IndName7 = "Name7";
extern bool otkr_Custom_7 = false;
extern bool zakr_Custom_7 = false;
extern double Shift7 =0;
extern string IndName8 = "Name8";
extern bool otkr_Custom_8 = false;
extern bool zakr_Custom_8 = false;
extern double Shift8 =0;
extern string Void1 = " ";
extern string Void2 = " ";
extern string __Non_Indicator__AKA__ = "...çäåñü è âíóòðè";
extern string __Îáùèå_Ïàðàìåòðû__ = "---- __Îáùèå_Ïàðàìåòðû__ ---- ";
extern double StopLoss =100;
extern double TakeProfit =994; // ÒakeÐrofit íå ìîæåò áûòü íå èñïîëüçîâàí :)
extern double Slippage = 2; // Slippage. Ïðîñêàëüçûâàíèå.
extern string ID_of_EA = "Îíî æå MagicNumber, îíî æå íîìåðíîé çíàê";
extern double __ID_of_EA = 219249; // ZIGZAG æå. "Çàâîäñêîé èäåíòèôèêàòîð"
extern string Block_of_Stakes = "---- Stake tuning ----";
extern string Bl_1 = "1 - FixLot, 2 - Martigail, 3 - Percental";
extern string Bl_2 = "Ìàðòèí-à æä¸ò íîâîé ñäåëêè, à íå ïåðåáèâàåò ñòàðóþ";
extern string Bl_3 = "IK is a miltiplies for Martingail-taktic. Normally=2";
extern double StakeMode =1; //
extern double Lts1 =0.1; // Fixlot
extern double IK =2; // Multiplying Lts1 * IK (if the previous deal was fail). Normally, Martingail is ThisDealLots = PrevDealLots * 2, so...
extern double Percents =5;
extern double RiskPipsForPercents=100; // Äóáëèêàòîð ñòîï-ëîññà. Âàæåí â ñëó÷àå èñïîëüçîâàíèÿ òðåéëà.
extern bool Pause1800 =true; // Ïàóçà, ÷òîáû íå âèëÿòü ñäåëêàìè òóäà-ñþäà. Ïîë-÷àñà (îäèí áàð íà Ì30, ïîë-áàðà íà Í1)
extern string ATR = "---- ---- ---- ----";
extern string Ïðåäíàçíà÷åíèå_ATR = "ATR ìîæíî èñïîëüçîâàòü äëÿ óñòàíîâêè TP è SL."; // Actually, never tuned by me properly.
extern string ________________ = "ATR_Multiply íàñòðàèâàåò ìíîæèòåëü ÷óâñòâèòåëüíîñòè";
extern string __By_26_994_____ = "Íàïðèìåð, åñëè Multiply=0.9, òî ðåàêöèÿ - 0.9 ïèïñîâ íà 0.0001 ATR";
extern double ATR_Period =14;
extern double ATR_Multiply = 0.9;
extern double ATR_Reach =0.0014;
extern bool ATR_SL = false;
extern bool ATR_TP = false;
//+------------------------------------------------------------------+
//------
bool Work=true;
bool OrderSal;
string Symb; // Èìÿ ïàðû (íàïðèìåð - EURUSD èëè GBPJPY)
//----------------------------------------------------------- 2 -----
int start()
{
int
Total, // Êîëè÷åñòâî îðäåðîâ â îêíå
Tip=-1, // Òèï âûáðàí. îðäåðà (B=0,S=1)
Ticket; // Íîìåð îðäåðà
double
Lot, // Êîëè÷. ëîòîâ â âûáðàí.îðäåðå
Lts, // Êîëè÷. ëîòîâ â îòêðûâ.îðäåðå
lot,
Min_Lot, // Ìèíèìàëüíîå êîëè÷åñòâî ëîòîâ
Step, // Øàã èçìåíåíèÿ ðàçìåðà ëîòà
Free, // Òåêóùèå ñâîáîäíûå ñðåäñòâà
One_Lot, // Ñòîèìîñòü îäíîãî ëîòà
Price, // Öåíà âûáðàííîãî îðäåðà
SL, // SL âûáðàííîãî îðäåðà
TP, // TP âûáðàííîãî îðäåðà
//--
MA_By,MA_Sell,Stoh_By,Stoh_Sell,AO_By,AO_Sell,StdDev_By,StdDev_Sell,AC_By,AC_Sell,Cls_MA_Sell,Cls_MA_By,Cls_Stoh_Sell,Cls_Stoh_By,
Cls_AO_Sell,Cls_AO_By,Cls_StdDev_By,Cls_StdDev_Sell,Cls_AC_Sell,Cls_AC_By,Dema_By,Cls_Dema_Sell,Dema_Sell,Cls_Dema_By,CCI_By,CCI_Sell,Cls_WPR_Sell,Cls_CCI_By,Cls_CCI_Sell,
RSI_By,RSI_Sell,Cls_RSI_Sell,Cls_RSI_By,MFI_By,MFI_Sell,Cls_MFI_Sell,Cls_MFI_By,WPR_By,WPR_Sell,Cls_WRP_Sell,Cls_WPR_By, //äîáàâëåííîå.
MACD_By,MACD_Sell,Cls_MACD_Sell,Cls_MACD_By,OsMA_By,OsMA_Sell,Cls_OsMA_Sell,Cls_OsMA_By,ADX_By,ADX_Sell,Cls_ADX_Sell,Cls_ADX_By,SAR_By,SAR_Sell,Cls_SAR_Sell,Cls_SAR_By,
Custom_1__By, Custom_1__Sell, Cls_Custom_1__By, Cls_Custom_1__Sell,Custom_2__By, Custom_2__Sell, Cls_Custom_2__By, Cls_Custom_2__Sell,
Custom_3__By, Custom_3__Sell, Cls_Custom_3__By, Cls_Custom_3__Sell,Custom_4__By, Custom_4__Sell, Cls_Custom_4__By, Cls_Custom_4__Sell,
Custom_5__By, Custom_5__Sell, Cls_Custom_5__By, Cls_Custom_5__Sell,Custom_6__By, Custom_6__Sell, Cls_Custom_6__By, Cls_Custom_6__Sell,
Custom_7__By, Custom_7__Sell, Cls_Custom_7__By, Cls_Custom_7__Sell,Custom_8__By, Custom_8__Sell, Cls_Custom_8__By, Cls_Custom_8__Sell;
bool
Modific=true,
Ans =false, // Îòâåò ñåðâåðà ïîñëå çàêðûòèÿ
Cls_B=false, // Êðèòåðèé äëÿ çàêðûòèÿ Buy
Cls_S=false, // Êðèòåðèé äëÿ çàêðûòèÿ Sell
Opn_B=false, // Êðèòåðèé äëÿ îòêðûòèÿ Buy
Opn_S=false, // Êðèòåðèé äëÿ îòêðûòèÿ Sell
S_Bar=false; // Êðèòåðèé äëÿ Sleep Bar (ïîëó÷àñîâàÿ ïàóçà, ÷òîáû íå ñòðàäàòü ëèøíèìè ñäåëêàìè)
// Comment // Áëîê êîììåíòàðèåâ â îêíå. Îòêëþ÷åíî (íî ìîæíî âêëþ÷èòü, ïðîñòî ñòåðåâ çäåñü //øå÷êè)
// (
// "TIME: ",TimeToStr(TimeCurrent()),
// "\n",
// "Order-s paramethers (##,TP,SL,LOT): |",OrderTicket(),"|",OrderStopLoss(),"|",OrderTakeProfit(),"|",OrderLots(),"|",
// "\n",
// "ID_Number: ", ID_of_EA,
// "\n",
// "StakeType, #:",StakeMode,
// "\n",
// "% for #3: ",Percents,
// "\n",
// "StopOut: ", AccountStopoutLevel(),
// "\n",
// "Spread: ", MarketInfo(Symbol(),MODE_SPREAD),
// "\n",
// "Leverage, 1 to: ",AccountLeverage(),
// "\n",
// "Broker", TerminalCompany( ) ,
// "\n",
// "\n",
// "\n", // ìåæäó "\n", ïèõàþòñÿ íîâûå ÷èñëà äëÿ îòîáðàæåíèÿ.
// "\n"
// ); // Ðåñóðñû åñòü î÷åíü æàäíî, ïîòîìó è îòêëþ÷èë.
// Íà ðåàëå ìîæíî è ñòåðåòü ýòè //-øêè, ÷òîáû âêëþ÷èòü â ëåâîì óãëó ýêðàíà êðàñîòó äîï. öèôåðîê :)
//-------------------- Pause after closed order. ------------------ 3 -
int time0 = 0; // Îáüÿâëÿåì íåîáõîäèìûå ïåðåìåííûå
for(int t0 = OrdersHistoryTotal();t0>=0;t0--) // Ïåðåáèðàåì âñå çàêðûòûå îðäåðà
if(OrderSelect(t0, SELECT_BY_POS,MODE_HISTORY )==true) // Åñëè îðäåð ñ òàêèì íîìåðîì (i) â ñïèñêå çàêðûòûõ îðäåðîâ åñòü ( íå ïóòàòü ñ òèêåòîì)
{
if( iTime(NULL,0,0)-OrderOpenTime() <1800 && Pause1800==true) //Óñëîâèÿ ïàóçû
{
S_Bar=true; // Äåéñòâèÿ iTime(NULL,0,1)
Alert("Ïåðåêóð. 994 ñåêóíäû.");
}
// return(0);
}
//-------------------- Pre-Work Sorting-------------------------- 3.5 -
if(Work==false) // Critical error
{
Alert("Îòêëþ÷åíî, ïîòîìó ÷òî ÊÐÈÒÈ×ÅÑÊÀß ÎØÈÁÊÀ.");
return; // Exit from start()
}
//------------------------------Ó÷¸ò îðäåðîâ--------------------------------- 4 --
Symb=Symbol(); // Íàçâàíèå ôèí.èíñòð.
Total=0; // Êîëè÷åñòâî îðäåðîâ
for(int i=1; i<=OrdersTotal(); i++) // Öèêë ïåðåáîðà îðäåð
{
if (OrderSelect(i-1,SELECT_BY_POS)==true) // Åñëè åñòü ñëåäóþùèé
{ // Àíàëèç îðäåðîâ:
if (OrderSymbol()!=Symb)continue; // Íå íàø ôèí. èíñòðóì
Total++; // Ñ÷¸ò÷èê ðûíî÷í. îðä
if (Total>1) // Íå áîëåå îäíîãî îðä -- Ïîääåðæêà îòëîæåííûõ!
{
Alert("Íåñêîëüêî ðûíî÷íûõ îðäåðîâ. Ýêñïåðò íå ðàáîòàåò.");
return; // Âûõîä èç start()
}
Ticket=OrderTicket(); // Íîìåð âûáðàíí. îðä.
Tip =OrderType(); // Òèï âûáðàííîãî îðä.
Price =OrderOpenPrice(); // Öåíà âûáðàíí. îðä.
SL =OrderStopLoss(); // SL âûáðàííîãî îðä.
TP =OrderTakeProfit(); // TP âûáðàííîãî îðä.
Lot =OrderLots(); // Êîëè÷åñòâî ëîòîâ
}
}
//---------------------------Òîðãîâûå êðèòåðèè------------------------------------ 5 --
//---------------------------Òîðãîâûå êðèòåðèè------------------------------------ 5 --
//ATR for TP and SL is here------------------------------
if(ATR_SL==true && iATR(NULL,0,ATR_Period,1)>=ATR_Reach)
StopLoss=iATR(NULL,0,ATR_Period,0)*ATR_Multiply/0.0001; //Çäåñü ìû èìååì ìîäèôèêàòîð òåéêà è ñòîïà.
if(ATR_TP==true && iATR(NULL,0,ATR_Period,1)>=ATR_Reach)
TakeProfit=iATR(NULL,0,ATR_Period,0)*ATR_Multiply/0.0001;
// Êðàòêàÿ èíñòðóêöèÿ ïî èíäèêàòîðàì:
//(iXXXX(NULL,0,bla,bla,bla)>??????) - òàê óñòðîåíî óðàâíåíèÿ èíäèêàòîðà.
// iXXXX - ñàìî íàçâàíèå, (NULL,0,bla,bla,bla) - åãî óñëîâèÿ, ?????? - òî, ñ ÷åì ñðàâíèâàåì.
// È åù¸. Çàêðûâàéòå ñêîáêè â óðàâíåíèè ïðàâèëüíî - íåçàêðûòàÿ ëåâàÿ ñêîáêà çàñòàâëÿåò ðûòüñÿ ïî âñåé ïðîãðàììå.
// Èòàê.
// Äëÿ ëåâîé ÷àñòè - íå òðîãàòü íè÷åãî íå íàäî (èìåííî â ýòîì âñÿ ñóòü)
// Äëÿ ïðàâîé - ñìîòðèòå:
//
// if(iAO(NULL,0,1)<iAO(NULL,0,2)) - ïðèìåð â ñòèëå "áîëüøå\ìåíüøå ïðåäûäóùåãî áàðà".
// if(iAO(NULL,0,1)<iAO(NULL,0,2) && iAO(NULL,0,2)>iAO(NULL,0,3)) - óæå "êðþê" - "0,2" áîëüøå è "0,1" è "0,3"
// Åñëè ÷òî, ýòî ïîðÿäêîâûå ÷èñëà - 1-ûé, 2-îé è 3-èé îò ïîñëåäíåãî áàðà. Íóëåâîé 0,0 - òîò, êîòîðûé åù¸ íå çàêðûëñÿ.
//
// if(iSAR(NULL,0,SAR_Step,SAR_MaxStep,1)>Close[0]) - ýòî óæå ïðèìåð ïåðåñå÷åíèÿ ñ öåíîé (Close[0]).
// Ñëîâà Close è Open çàðåçåðèðîâàíû äëÿ öåí. [0] - ýòî òîò æå "øèôò".
// Ìåòîä òîëüêî äëÿ èíäèêàòîðîâ, êîòîðûå "íà ãðàôèêå".
//
// if (iRSI(NULL,0,RSI_Period,0,1)>RSI_High) - ýòî óæå çàêðûòèå ïî óðîâíþ (0; 50; õõõõõõõ; niz_ur; ÷òî óãîäíî)
// Ýòî óæå äëÿ èíäèêàòîðîâ â îòäåëüíîì îêíå.
//MAs------------------------------------
if(otkr_MA==true)
{
if(iMA(NULL,0,MA1,Shift_1,MA_type,PRICE_CLOSE,GeneralShift)>iMA(NULL,0,MA2,Shift_2,MODE_SMA,PRICE_CLOSE,GeneralShift+1))
{
MA_By =true;// Normally SMA, but here is my edit.
}
if(iMA(NULL,0,MA1,Shift_1,MA_type,PRICE_CLOSE,GeneralShift)<iMA(NULL,0,MA2,Shift_2,MODE_SMA,PRICE_CLOSE,GeneralShift+1))
{
MA_Sell =true;
}
}
if(zakr_MA==true)
{
if(iMA(NULL,0,MA1,Shift_1,MA_type,PRICE_CLOSE,GeneralShift)>iMA(NULL,0,MA2,Shift_2,MODE_SMA,PRICE_CLOSE,GeneralShift+1))
{
Cls_MA_Sell=true;
}
if(iMA(NULL,0,MA1,Shift_1,MA_type,PRICE_CLOSE,GeneralShift)<iMA(NULL,0,MA2,Shift_2,MODE_SMA,PRICE_CLOSE,GeneralShift+1))
{
Cls_MA_By=true;
}
}
//Ñòîõàñòèê-------------------------------
if(otkr_Stoh==true)
{
if(iStochastic(NULL,0,per_K,per_D,slow,MODE_LWMA,1,1,GeneralShift)>iStochastic(NULL,0,per_K,per_D,slow,MODE_LWMA,1,2,GeneralShift)
&& iStochastic(NULL,0,per_K,per_D,slow,MODE_LWMA,1,1,GeneralShift)<zoneBUY)
{
Stoh_By =true;
}
if(iStochastic(NULL,0,per_K,per_D,slow,MODE_LWMA,1,1,GeneralShift)<iStochastic(NULL,0,per_K,per_D,slow,MODE_LWMA,1,2,GeneralShift)
&& iStochastic(NULL,0,per_K,per_D,slow,MODE_LWMA,1,1,GeneralShift)>zoneSELL)
{
Stoh_Sell =true;
}
}
if(zakr_Stoh==true)
{
if(iStochastic(NULL,0,per_K,per_D,slow,MODE_LWMA,1,1,GeneralShift)>iStochastic(NULL,0,per_K,per_D,slow,MODE_LWMA,1,2,GeneralShift)
&& iStochastic(NULL,0,per_K,per_D,slow,MODE_LWMA,1,1,GeneralShift)<zoneBUY)
{
Cls_Stoh_Sell=true;
}
if(iStochastic(NULL,0,per_K,per_D,slow,MODE_LWMA,1,1,GeneralShift)<iStochastic(NULL,0,per_K,per_D,slow,MODE_LWMA,1,2,GeneralShift)
&& iStochastic(NULL,0,per_K,per_D,slow,MODE_LWMA,1,1,GeneralShift)>zoneSELL)
{
Cls_Stoh_By=true;
}
}
//Awesome--------------------------------
if(otkr_AO==true)
{
if(iAO(NULL,0,GeneralShift)<iAO(NULL,0,GeneralShift+1)&&iAO(NULL,0,GeneralShift)<0)
{
AO_By =true;
}
if(iAO(NULL,0,GeneralShift)>iAO(NULL,0,GeneralShift+1)&&iAO(NULL,0,GeneralShift)>0)
{
AO_Sell =true;
}
}
if(zakr_AO==true)
{
if(iAO(NULL,0,GeneralShift)>iAO(NULL,0,GeneralShift+1)&&iAO(NULL,0,GeneralShift)<0)
{
Cls_AO_Sell=true;
}
if(iAO(NULL,0,GeneralShift)<iAO(NULL,0,GeneralShift+1)&&iAO(NULL,0,GeneralShift)>0)
{
Cls_AO_By=true;
}
}
//StdDev(Standard Deviation)-------------
if(otkr_StdDev==true)
{
if(iStdDev(NULL,0,StdDevMAPeriod,StdDevMAShift,1,0,GeneralShift)>StdDevLimitToOpen)
{
StdDev_By=true;
}
if(iStdDev(NULL,0,StdDevMAPeriod,StdDevMAShift,1,0,GeneralShift)>StdDevLimitToOpen)
{
StdDev_Sell=true; // What? This "wait or not".
}
}
if(zakr_StdDev==true)
{
if(iStdDev(NULL,0,StdDevMAPeriod,StdDevMAShift,1,0,GeneralShift)<StdDevLimitToClose)
{
Cls_AO_Sell=true;
}
if(iStdDev(NULL,0,StdDevMAPeriod,StdDevMAShift,1,0,GeneralShift)<StdDevLimitToClose)
{
Cls_AO_By=true;
}
}
//Demarker----------------------------
if(otkr_Dema==true)
{
if (iDeMarker(NULL, 0, DeMa_period, GeneralShift)<niz_ur)
{
Dema_By =true;
}
if (iDeMarker(NULL, 0, DeMa_period, GeneralShift)>verx_ur)
{
Dema_Sell =true;
}
}
if(zakr_Dema==true)
{
if (iDeMarker(NULL, 0, DeMa_period, GeneralShift)<niz_ur)
{
Cls_Dema_Sell=true;
}
if (iDeMarker(NULL, 0, DeMa_period, GeneralShift)>verx_ur)
{
Cls_Dema_By=true;
}
}
//CCI:------------------
if(otkr_CCI==true)
{
if (iCCI(NULL, 0,CCI_period,PRICE_MEDIAN,GeneralShift)>CCI_Level)
{
CCI_By =true;
}
if (iCCI(NULL, 0,CCI_period,PRICE_MEDIAN,GeneralShift)<-CCI_Level)
{
CCI_Sell =true;
}
}
if(zakr_CCI==true)
{
if (iCCI(NULL, 0,CCI_period,PRICE_MEDIAN,GeneralShift)<-CCI_Level) // Not hook.
{
Cls_CCI_Sell=true;
}
if (iCCI(NULL, 0,CCI_period,PRICE_MEDIAN,GeneralShift)>CCI_Level)
{
Cls_CCI_By=true;
}
}
//RSI---------------------------------------------------------------------
if(otkr_RSI==true)
{
if (iRSI(NULL,0,RSI_Period,0,GeneralShift)>RSI_High)
{
RSI_By=true;
}
if (iRSI(NULL,0,RSI_Period,0,GeneralShift)<RSI_Low)
{
RSI_Sell=true;
}
}
if(zakr_RSI==true)
{
if (iRSI(NULL,0,RSI_Period,0,GeneralShift)>RSI_High)
{
Cls_RSI_Sell=true;
}
if (iRSI(NULL,0,RSI_Period,0,GeneralShift)<RSI_Low)
{
Cls_RSI_By=true;
}
}
//MFI-------------------------------
if(otkr_MFI==true)
{
if (iMFI(NULL,0,MFI_Period,GeneralShift)>MFI_High)
{
MFI_By=true;
}
if (iMFI(NULL,0,MFI_Period,GeneralShift)<MFI_Low)
{
MFI_Sell=true;
}
}
if(zakr_MFI==true)
{
if (iMFI(NULL,0,MFI_Period,GeneralShift)>MFI_High/2+MFI_Low/2) // òóò çàêðûòèå ïî ñåðåäèíå
{
Cls_MFI_Sell=true;
}
if (iMFI(NULL,0,MFI_Period,GeneralShift)<MFI_High/2+MFI_Low/2)
{
Cls_MFI_By=true;
}
}
//WPR--------------------------------
if(otkr_WPR==true)
{
if (iWPR(NULL,0,WPR_Period,GeneralShift)>-20)
{
WPR_By=true;
}
if (iWPR(NULL,0,WPR_Period,GeneralShift)<-80)
{
WPR_Sell=true;
}
}
if(zakr_WPR==true)
{
if (iWPR(NULL,0,WPR_Period,GeneralShift)>-20) // I hope you get it.
{
Cls_WPR_Sell=true;
}
if (iWPR(NULL,0,WPR_Period,GeneralShift)<-80)
{
Cls_WPR_By=true;
}
}
//MACD-------------------------------
if(otkr_MACD==true)
{
if (iMACD(NULL,0,MACD_Fast,MACD_Slow,MACD_Signal,1,1,GeneralShift)>0)
{
MACD_By=true;
}
if (iMACD(NULL,0,MACD_Fast,MACD_Slow,MACD_Signal,1,1,GeneralShift)<0)
{
MACD_Sell=true;
}
}
if(zakr_MACD==true)
{
if (iMACD(NULL,0,MACD_Fast,MACD_Slow,MACD_Signal,1,1,GeneralShift)>0)
{
Cls_MACD_Sell=true;
}
if (iMACD(NULL,0,MACD_Fast,MACD_Slow,MACD_Signal,1,1,GeneralShift)<0)
{
Cls_MACD_By=true;
}
}
//OsMA-------------------------------
if(otkr_OsMA==true)
{
if (iOsMA(NULL,0,MACD_Fast,MACD_Slow,MACD_Signal,1,GeneralShift)>0.001) // Òàê ìîæíî è "ïóñòóþ çîíó" ïîñòàâèòü
{
MACD_By=true;
}
if (iOsMA(NULL,0,MACD_Fast,MACD_Slow,MACD_Signal,1,GeneralShift)<-0.001)// Óäîáíî - ôëåò "ïðîëåòàåò".
{
MACD_Sell=true;
}
}
if(zakr_OsMA==true)
{
if (iOsMA(NULL,0,MACD_Fast,MACD_Slow,MACD_Signal,1,GeneralShift)>0)// À òóò - íåò. Óäîáíî!
{
Cls_MACD_Sell=true;
}
if (iOsMA(NULL,0,MACD_Fast,MACD_Slow,MACD_Signal,1,GeneralShift)<0)
{
Cls_MACD_By=true;
}
}
//ADX-------------------------------
if(otkr_ADX==true)
{
if (iADX(NULL,0,ADX_Period,1,0,GeneralShift)>70)
{
ADX_By=true;
}
if (iADX(NULL,0,ADX_Period,1,0,GeneralShift)<30)
{
ADX_Sell=true;
}
}
if(zakr_ADX==true)
{
if (iADX(NULL,0,ADX_Period,1,0,GeneralShift)>70)
{
Cls_ADX_Sell=true;
}
if (iADX(NULL,0,ADX_Period,1,0,GeneralShift)<30)
{
Cls_ADX_By=true;
}
}
//SAR-------------------------------
if(otkr_SAR==true)
{
if(iSAR(NULL,0,SAR_Step,SAR_MaxStep,GeneralShift)>Close[0])
{
SAR_By=true;
}
if(iSAR(NULL,0,SAR_Step,SAR_MaxStep,GeneralShift)<Close[0])
{
SAR_Sell=true;
}
}
if(zakr_SAR==true)
{
if (iSAR(NULL,0,SAR_Step,SAR_MaxStep,GeneralShift)>Close[0])
{
Cls_SAR_Sell=true;
}
if(iSAR(NULL,0,SAR_Step,SAR_MaxStep,GeneralShift)<Close[0])
{
Cls_SAR_By=true;
}
}
// A-a-a-nd the custom indicators. I bet you were searching for some newbie-for possibility to use custom indicators.
//--------Custom_1__------------------
if(otkr_Custom_1==true)
{
if(iCustom(NULL,0,IndName1,0,Shift1)>0) // You know, you're supposed to find and tune tune the custom indicator by yourself.
{ // I mean, all the tunes are saved in code (as basiccal\standard)
Custom_1__By=true; // As a rule, the custom inds don't need any tunes... mostly...
} // Well, if any problems, you just need to edit an indicator simply by changing the digits "in case".
//"Theese \/ ones" // Snippet: between name ("ZZ") and last two (,0,0)) digits you can put variables
if(iCustom(NULL,0,IndName1,0,Shift1)<0)
{
Custom_1__Sell=true;
}
}
if(zakr_Custom_1==true)
{
if(iCustom(NULL,0,IndName1,0,Shift1)<0)
{
Cls_Custom_1__By=true;// _1__ , because there were up to 16 custom inds aviliable - you could find _10_, _16_, _9__...
}
if(iCustom(NULL,0,IndName1,0,Shift1)>0)
{
Cls_Custom_1__Sell=true;
}
}
//--------Custom_2__------------------
if(otkr_Custom_2==true)
{
if(iCustom(NULL,0,IndName2,0,Shift2)>0)
{
Custom_2__By=true;
}
if(iCustom(NULL,0,IndName2,0,Shift2)<0)
{
Custom_2__Sell=true;
}
}
if(zakr_Custom_2==true)
{
if(iCustom(NULL,0,IndName2,0,Shift2)<0) // Lamest ever :)
{
Cls_Custom_2__By=true;
}
if(iCustom(NULL,0,IndName2,0,Shift2)>0)
{
Cls_Custom_2__Sell=true;
}
}
//--------Custom_3__------------------
if(otkr_Custom_3==true)
{
if(iCustom(NULL,0,IndName3,0,Shift3)>0)
{
Custom_3__By=true;
}
if(iCustom(NULL,0,IndName3,0,Shift3)<0)
{
Custom_3__Sell=true;
}
}
if(zakr_Custom_3==true)
{
if(iCustom(NULL,0,IndName3,0,Shift3)<0)
{
Cls_Custom_3__By=true;
}
if(iCustom(NULL,0,IndName3,0,Shift3)>0)
{
Cls_Custom_3__Sell=true;
}
}
//--------Custom_4__------------------
if(otkr_Custom_4==true)
{
if(iCustom(NULL,0,IndName4,0,Shift4)>0) // Çàìåíà: Íàçâàíèå çàãðóæåííîãî èíäèêàòîðà íà ìåñòî áèðþçîâîé íàäïèñè.
{
Custom_4__By=true;
}
if(iCustom(NULL,0,IndName4,0,Shift4)<0)
{
Custom_4__Sell=true;
}
}
if(zakr_Custom_4==true)
{
if(iCustom(NULL,0,IndName4,0,Shift4)<0)
{
Cls_Custom_4__By=true;
}
if(iCustom(NULL,0,IndName4,0,Shift4)>0)
{
Cls_Custom_4__Sell=true;
}
}
//--------Custom_5__------------------
if(otkr_Custom_5==true)
{
if(iCustom(NULL,0,IndName5,0,Shift5)>0) // Çàìåíà: Íàçâàíèå çàãðóæåííîãî èíäèêàòîðà íà ìåñòî áèðþçîâîé íàäïèñè.
{
Custom_5__By=true;
}
if(iCustom(NULL,0,IndName5,0,Shift5)<0)
{
Custom_5__Sell=true;
}
}
if(zakr_Custom_5==true)
{
if(iCustom(NULL,0,IndName5,0,Shift5)<0)
{
Cls_Custom_5__By=true;
}
if(iCustom(NULL,0,IndName5,0,Shift5)>0)
{
Cls_Custom_5__Sell=true;
}
}
//--------Custom_6__------------------
if(otkr_Custom_6==true)
{
if(iCustom(NULL,0,IndName6,0,Shift6)>0) // Çàìåíà: Íàçâàíèå çàãðóæåííîãî èíäèêàòîðà íà ìåñòî áèðþçîâîé íàäïèñè.
{
Custom_6__By=true;
}
if(iCustom(NULL,0,IndName6,0,Shift6)<0)
{
Custom_6__Sell=true;
}
}
if(zakr_Custom_6==true)
{
if(iCustom(NULL,0,IndName6,0,Shift6)<0)
{
Cls_Custom_6__By=true;
}
if(iCustom(NULL,0,IndName6,0,Shift6)>0)
{
Cls_Custom_6__Sell=true;
}
}
//--------Custom_7__------------------
if(otkr_Custom_7==true)
{
if(iCustom(NULL,0,IndName7,0,Shift7)>0) // Çàìåíà: Íàçâàíèå çàãðóæåííîãî èíäèêàòîðà íà ìåñòî áèðþçîâîé íàäïèñè.
{
Custom_7__By=true;
}
if(iCustom(NULL,0,IndName7,0,Shift7)<0)
{
Custom_7__Sell=true;
}
}
if(zakr_Custom_7==true)
{
if(iCustom(NULL,0,IndName7,0,Shift7)<0)
{
Cls_Custom_7__By=true;
}
if(iCustom(NULL,0,IndName7,0,Shift7)>0)
{
Cls_Custom_7__Sell=true;
}
}
//--------Custom_8__------------------
if(otkr_Custom_8==true)
{
if(iCustom(NULL,0,IndName8,0,Shift8)>0) // Çàìåíà: Íàçâàíèå çàãðóæåííîãî èíäèêàòîðà íà ìåñòî áèðþçîâîé íàäïèñè.
{
Custom_8__By=true;
}
if(iCustom(NULL,0,IndName8,0,Shift8)<0)
{
Custom_8__Sell=true;
}
}
if(zakr_Custom_8==true)
{
if(iCustom(NULL,0,IndName8,0,Shift8)<0)
{
Cls_Custom_8__By=true;
}
if(iCustom(NULL,0,IndName8,0,Shift8)>0)
{
Cls_Custom_8__Sell=true;
}
}
//--------------------------------Open Buy and Sell------------------------------------------ 7 ----//
if (MA_By ==true||otkr_MA==false &&
Stoh_By ==true||otkr_Stoh==false&&
AO_By ==true||otkr_AO==false &&
StdDev_By ==true||otkr_StdDev==false&&
Dema_By ==true||otkr_Dema==false&&
CCI_By ==true||otkr_CCI==false &&
RSI_By ==true||otkr_RSI==false &&
MFI_By ==true||otkr_MFI==false &&
WPR_By ==true||otkr_WPR==false &&
MACD_By==true||otkr_MACD==false &&
OsMA_By==true||otkr_OsMA==false &&
ADX_By ==true||otkr_ADX==false &&
SAR_By ==true||otkr_SAR==false &&
Custom_1__By==true||otkr_Custom_1==false&&
Custom_2__By==true||otkr_Custom_2==false&&
Custom_3__By==true||otkr_Custom_3==false&&
Custom_4__By==true||otkr_Custom_4==false&&
Custom_5__By==true||otkr_Custom_5==false&&
Custom_6__By==true||otkr_Custom_6==false&&
Custom_7__By==true||otkr_Custom_7==false&&
Custom_8__By==true||otkr_Custom_8==false
)
{
Opn_B=true;
}
//---------
if (
MA_Sell==true||otkr_MA==false &&
Stoh_Sell ==true||otkr_Stoh==false &&
AO_Sell ==true||otkr_AO==false &&
StdDev_Sell==true||otkr_StdDev==false &&
Dema_Sell ==true||otkr_Dema==false &&
CCI_Sell ==true||otkr_CCI==false &&
RSI_Sell ==true||otkr_RSI==false &&
MFI_Sell ==true||otkr_MFI==false &&
WPR_Sell ==true||otkr_WPR==false &&
MACD_Sell==true||otkr_MACD==false &&
OsMA_Sell==true||otkr_OsMA==false &&
ADX_Sell ==true||otkr_ADX==false &&
SAR_Sell ==true||otkr_SAR==false &&
Custom_1__Sell==true||otkr_Custom_1==false&&
Custom_2__Sell==true||otkr_Custom_2==false&&
Custom_3__Sell==true||otkr_Custom_3==false&&
Custom_4__Sell==true||otkr_Custom_4==false&&
Custom_5__Sell==true||otkr_Custom_5==false&&
Custom_6__Sell==true||otkr_Custom_6==false&&
Custom_7__Sell==true||otkr_Custom_7==false&&
Custom_8__Sell==true||otkr_Custom_8==false
)
{
Opn_S=true;
}
//--------------------------------Closing-----------------------------------------------//
if (Cls_MA_By ==true||zakr_MA==false &&
Cls_Stoh_By==true||zakr_Stoh==false&&
Cls_AO_By ==true||zakr_AO==false &&
Cls_StdDev_By==true||zakr_StdDev==false &&
Cls_Dema_By==true||zakr_Dema==false&&