-
Notifications
You must be signed in to change notification settings - Fork 1
/
热寂v1.2(onlysell).mq4
110 lines (95 loc) · 6.26 KB
/
热寂v1.2(onlysell).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
#property copyright "阿斯伯格"
#property link "阿斯伯格"
extern datetime 挂单本地电脑时间;
extern int 挂单价距离当时现价点数 =100;
extern int 挂单有效分钟数 =10;
extern double 挂单下单量;
extern int 挂单止损点数 =70;
extern int 挂单止盈点数;
extern int 挂单成交后移动止损点数;
extern int magic=405215;
datetime dangshi=0;
int sells=0;
int buys=0;
int end =0;
int kaidanok=0;
int kaiguan=0;
int ticket=0;
int init()
{
DrawLabel("will1","sell is better",2,13,"宋体",9,Aqua,0);
dangshi=TimeLocal();
return(0);
}
int deinit()
{
return(0);
}
int start()
{
if(挂单本地电脑时间<dangshi)
if(end ==0)
{
Alert("这个挂单时间已经过了还怎么挂单");
end =1;
}
if(挂单本地电脑时间 <=TimeLocal())
if(end !=1)
{
sells =OrderSend(Symbol() ,OP_SELLSTOP,挂单下单量,Bid-挂单价距离当时现价点数*Point,70,Ask+挂单止损点数*Point,0,0,magic,TimeLocal()+挂单有效分钟数*60,White);
buys =OrderSend(Symbol() ,OP_BUYSTOP,挂单下单量,Ask+挂单价距离当时现价点数*Point,70,Ask-挂单止损点数*Point,0,0,magic,TimeLocal()+挂单有效分钟数*60,White);
}
for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==TRUE)
end =1;
}
if(sells ==-1&&buys ==-1)
end =0;
Comment("sells=",sells,"buys=",buys,"end=",end);
return(0);
}
/*
void yidong()
{
for(int i=0;i<OrdersTotal();i++)//移动止损通用代码,次代码会自动检测buy和sell单并对其移动止损
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
{
if(OrderType()==0 && OrderSymbol()==Symbol() && OrderMagicNumber()==magic)
{
if((Bid-OrderOpenPrice()) >=Point*挂单成交后移动止损点数)
{
if(OrderStopLoss()<(Bid-Point*挂单成交后移动止损点数) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*挂单成交后移动止损点数,0,0,Green);
}
}
}
if(OrderType()==1 && OrderSymbol()==Symbol() && OrderMagicNumber()==magic)
{
if((OrderOpenPrice()-Ask)>=(Point*挂单成交后移动止损点数))
{
if((OrderStopLoss()>(Ask+Point*挂单成交后移动止损点数)) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*挂单成交后移动止损点数,0,0,Red);
}
}
}
}
}
}
*/
void DrawLabel(string name,string text,int X,int Y,string FontName,int FontSize,color FontColor,int zhongxin)
{
if(ObjectFind(name)!=0)
{
ObjectDelete(name);
ObjectCreate(name,OBJ_LABEL,0,0,0);
ObjectSet(name,OBJPROP_CORNER,zhongxin);
ObjectSet(name,OBJPROP_XDISTANCE,X);
ObjectSet(name,OBJPROP_YDISTANCE,Y);
}
// ObjectSetText(name,text,FontSize,FontName,FontColor);
WindowRedraw();
}