-
Notifications
You must be signed in to change notification settings - Fork 2
/
NO8.mq4
104 lines (95 loc) · 3.79 KB
/
NO8.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
//+------------------------------------------------------------------+
//| .mq4 |
//| Strategiya muallifi: |
//| Dasturchi: Nematillo Ochilov |
//+------------------------------------------------------------------+
#property copyright "Nematillo Ochilov MQL4"
#property link "https://t.me/Nematillo_Ochilov"
extern double Lots=0.01;
extern int TakeProfit=100;
extern int StopLoss=600;
extern int MagicNumber=1;
//+------------------------------------------------------------------+
//| 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);
// Stop-lossni hisoblash
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 opb=NormalizeDouble(190,Digits);
double ops=NormalizeDouble(190,Digits);
double tslb=NormalizeDouble(OrderOpenPrice()+opb*Point,Digits);
double tsls=NormalizeDouble(OrderOpenPrice()-ops*Point,Digits);
double narx=MarketInfo(Symbol(),MODE_ASK); // hozirgi narx |
double SMA=iMA(NULL,0,62,190,0,0,0);
double SMA10=iMA(NULL,0,10,0,0,0,0);
double MACD_SIGNAL=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,0);
double RSI0=iRSI(NULL,0,16,PRICE_OPEN,0);
double RSI1=iRSI(NULL,0,16,PRICE_OPEN,1);
double Bands=iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_MAIN,0);
double TOP=OrderOpenPrice();
double TSL=OrderStopLoss();
//-------------------------------------------------------------------+
// savdo taktikasi
// 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 (RSI0 < 50)
{
if (!OrderClose(OrderTicket(),OrderLots(),Bid,3,Green))
Print("OrderClose BUYda muammo: ",GetLastError());
}
}
if (OrderType()==OP_SELL)
{
if (RSI0 > 50)
{
if (!OrderClose(OrderTicket(),OrderLots(),Ask,3,Red))
Print("OrderClose SELLda muammo: ",GetLastError());
}
}
}
}
}
}
if (OrdersTotal() < 1)
{
if ((SMA10 > Bands) && (MACD_SIGNAL > 0) && (RSI0 > 60)) //(narx > SMA) && (narx < SMA) &&
{
if (!OrderSend(Symbol(),OP_BUY,Lots,Ask,3,slb,tpb,"NO savdo ",MagicNumber,0,Aqua))
Print("OrderSend BUYda muammo: ",GetLastError());
}
if ((SMA10 < Bands) && (MACD_SIGNAL < 0) && (RSI0 < 40))
{
if (!OrderSend(Symbol(),OP_SELL,Lots,Bid,3,sls,tps,"NO savdo ",MagicNumber,0,Red))
Print("OrderSend SELLda muammo: ",GetLastError());
}
}
return(0);
}