-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathNO13_6.mq4
108 lines (104 loc) · 13.5 KB
/
NO13_6.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
//+--------------------------------------------------------------------------------------------------+
//| NO13_1.mq4 |
//| Strategiya muallifi: .... |
//| Dasturchi: Nematillo Ochilov |
//+--------------------------------------------------------------------------------------------------+
#property copyright "Nematillo Ochilov MQL4"// |
#property link "https://t.me/MQLUZ"// |
//+--------------------------------------------------------------------------------------------------+
//| Tashqi sozlamalar |
//+--------------------------------------------------------------------------------------------------+
//extern double Lots = 0.1;// Savdo hajmi
extern int Slippage=10;// Oraliq farq (spreed) o'zgarishi |
extern int MA=1000;// Moving Average Period |
//+--------------------------------------------------------------------------------------------------+
//| Ochiq savdo miqdorlarini aniqlash funksiyalari |
//+--------------------------------------------------------------------------------------------------+
double OOP;
double Lot[14] = {0.01, 0.02, 0.03, 0.05, 0.08, 0.13, 0.21, 0.34, 0.54, 0.89, 1.44, 2.33, 3.77, 6.10};
int step = 1;
double minus() {
double m = 0;
for(int i = 0; i < OrdersTotal(); i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol() == Symbol()) {
if (OrderType() == OP_BUY) {if (m > OrderProfit()) m = OrderProfit() / OrderLots();}
if (OrderType() == OP_SELL) {if (m > OrderProfit()) m = OrderProfit() / OrderLots();}
}
}
}
return(m);
}
void satr(string _name, string text, uint x, uint y, color rang){
long chart_ID = ChartID();
//string _name = IntegerToString(chart_ID);
ObjectCreate(chart_ID,_name,OBJ_LABEL,0,0,0);
ObjectSetInteger(chart_ID,_name,OBJPROP_COLOR,rang);
ObjectSetString(chart_ID,_name,OBJPROP_TEXT,text);
ObjectSet(chart_ID,OBJPROP_XDISTANCE,x);
ObjectSet(chart_ID,OBJPROP_YDISTANCE,y);
ChartRedraw(chart_ID);
Sleep(600);
}
//+------------------------------------------------------------------------------------------------------+
int start()// |
{// |
//+--------------------------------------------------------------------------------------------------+
//| Ichki sozlamalar |
//+--------------------------------------------------------------------------------------------------+
//| Texnik ko'rsatgichlar sozlamasi |
//+--------------------------------------------------------------------------------------------------+
double SMA=iMA(NULL,0,MA,0,0,0,0); // |
double narx=MarketInfo(Symbol(),MODE_BID); //iMA(NULL,0,1,0,0,0,0);
//+--------------------------------------------------------------------------------------------------+
//| Sotish yoki sotib olishni aniqlash qismi |
//+--------------------------------------------------------------------------------------------------+
double min = minus();
satr("0", "Eng katta zarardagi savdo: " + DoubleToString(min), 250, 50, clrWhite);
if (0 < OrdersTotal()) {
if (AccountFreeMargin() > AccountBalance()*0.5) {
if ((SMA > narx) && (OOP > narx)) {
int ticket_s = OrderSend(Symbol(), OP_SELL, Lot[step], Bid, Slippage, 0, 0, "NO savdo ", 0, 0, Red);
if (ticket_s < 0) {Print("OrderSend SELLda muammo: ", GetLastError());}
else {OOP -= 100 * Point; step+=1;}
}
else if ((SMA < narx) && (OOP < narx)) {
int ticket_b = OrderSend(Symbol(), OP_BUY, Lot[step], Ask, Slippage, 0, 0, "NO savdo ", 0, 0, Aqua);
if (ticket_b < 0) {Print("OrderSend BUYda muammo: ", GetLastError());}
else {OOP += 100 * Point; step+=1;}
}
}
if (min < -50) {
for (int cb = OrdersTotal(); cb >= 0; cb--) {
if (OrderSelect(cb, SELECT_BY_POS, MODE_TRADES ) == true){
if (OrderType() == OP_BUY){
if (!OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,Blue))
Print("OrderClose OP_BUYda muammo: ", GetLastError());
}
if (OrderType() == OP_SELL){
if (!OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,Red))
Print("OrderClose OP_SELLda muammo: ", GetLastError());
}
}
}
}
return(0);}
//+--------------------------------------------------------------------------------------------------+
//| Sotish yoki sotib olish |
//+--------------------------------------------------------------------------------------------------+
else if (1 > OrdersTotal()) {double Lots=0.01; step = 1;
if ((SMA > narx + 90 * Point) && (SMA < narx + 110 - Point)) {
OOP = Bid - 100 * Point;
if (!OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, 0, 0, "NO savdo ", 77777, 0, Aqua))
Print("OrderSend BUYda muammo: ", GetLastError());
}
else if ((SMA < narx - 90 * Point) && (SMA > narx - 110 * Point)) {
OOP = Ask + 100 * Point;
if (!OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, 0, 0, "NO savdo ", 77777, 0, Red))
Print("OrderSend SELLda muammo: ", GetLastError());
}
}
return(0);}
//+--------------------------------------------------------------------------------------------------+
//| Tugadi |
//+--------------------------------------------------------------------------------------------------+