forked from NematilloOchilov/NOMQL4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NO4.mq4
128 lines (122 loc) · 4.69 KB
/
NO4.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
//+---------------------------------------------------------------------------+
//| NO4.mq4 |
//| Nematillo Ochilov |
//| Bizni qo'llab-quvvatlash uchun Uzcard karta raqami 8600032937412948 |
//+----------------------------------------------------------------------------+
#property copyright "Nematillo Ochilov MQL4"
#property link "https://t.me/MQLUZ"
extern double Lots=0.01;
extern int TakeProfit=5000;
extern int StopLoss=300;
extern int MagicNumber=1;
extern int Ma1Period=16;
extern int Ma1Shift=1;
extern int Ma1Method=1;
extern int Ma1AppliedPrice=4;
extern int Ma2Period=25;
extern int Ma2Shift=4;
extern int Ma2Method=1;
extern int Ma2AppliedPrice=4;
extern int Ma3Period=150;
extern int Ma3Shift=0;
extern int Ma3Method=0;
extern int Ma3AppliedPrice=2;
//+------------------------------------------------------------------+
//| robotni ishga tushirish qismi |
//+------------------------------------------------------------------+
int init()
{
//----
Alert("Nematillo Ochilov tomonidan yaratilgan robot ishga tushmoqda");
//----
return(0);
}
//+------------------------------------------------------------------+
//|robot faol holatda |
//+------------------------------------------------------------------+
int start()
{
double TP=NormalizeDouble(TakeProfit,Digits);
// stop loss
double SL=NormalizeDouble(StopLoss,Digits);
double S_L=NormalizeDouble(200,Digits);
double SLL=NormalizeDouble(400,Digits);
// Stop-lossni hisoblash
double slbb=NormalizeDouble(Ask-S_L*Point,Digits);
double slss=NormalizeDouble(Bid+S_L*Point,Digits);
double slb=NormalizeDouble(Ask-SL*Point,Digits);
double sls=NormalizeDouble(Bid+SL*Point,Digits);
double tpb=NormalizeDouble(Ask+TP*Point,Digits);
double tps=NormalizeDouble(Bid-TP*Point,Digits);
double tslb=NormalizeDouble(OrderStopLoss()+SLL*Point,Digits);
double tsls=NormalizeDouble(OrderStopLoss()-SLL*Point,Digits);
double WPR0=iWPR(NULL,0,10,0);
double WPR1=iWPR(NULL,0,10,1);
double MA1=iMA(NULL,0,Ma1Period,Ma1Shift,Ma1Method,Ma1AppliedPrice,0); // DarkSkyBlue
double MA2=iMA(NULL,0,Ma2Period,Ma2Shift,Ma2Method,Ma2AppliedPrice,0); // Red
double MA3=iMA(NULL,0,Ma3Period,Ma3Shift,Ma3Method,Ma3AppliedPrice,0); // white
//-------------------------------------------------------------------+
// savdo taktikasi
//-------------------------------------------------------------------+
Comment("Ushbu robotni katta real balansda sinab ko'rmang");
if(OrdersTotal()>0)
{
for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS)==true)
{
if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber)
{
if(OrderType()==OP_BUY)
{
/* if(WPR0>-10)
{
if(!OrderClose(OrderTicket(),OrderLots(),Bid,3,Red))
Print("OrderClose BUYda muammo: ",GetLastError());
}
else */
if(tslb<Ask)
{
if(!OrderModify(OrderTicket(),0,slbb,OrderTakeProfit(),0,Aqua))
Print("OrderModify BUYda muammo: ",GetLastError());
}
}
if(OrderType()==OP_SELL)
{
/* if(WPR0<-90)
{
if(!OrderClose(OrderTicket(),OrderLots(),Ask,3,Red))
Print("OrderClose SELLda muammo: ",GetLastError());
}
else */
if(tsls>Bid)
{
if(!OrderModify(OrderTicket(),0,slss,OrderTakeProfit(),0,Orange))
Print("OrderModify SELLda muammo: ",GetLastError());
}
}
}
}
}
}
else if(OrdersTotal()<1)
{
if((WPR0>-10)&&(WPR0<-9))
{
if((MA1>MA2)&&(MA2>MA3))
{
if(!OrderSend(Symbol(),OP_BUY,Lots,Ask,3,slb,tpb,"NO savdo ",MagicNumber,0,Aqua))
Print("OrderSend BUYda muammo: ",GetLastError());
}
}
if((WPR0>-91)&&(WPR0<-90))
{
if((MA1<MA2)&&(MA2<MA3))
{
if(!OrderSend(Symbol(),OP_SELL,Lots,Bid,3,sls,tps,"NO savdo ",MagicNumber,0,Red))
Print("OrderSend SELLda muammo: ",GetLastError());
}
}
}
return(0);
}