-
Notifications
You must be signed in to change notification settings - Fork 1
/
Swap Indicator.mq4
63 lines (55 loc) · 2.51 KB
/
Swap Indicator.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
#property strict
#property copyright "Forexnew.org"
#property link "https://forexnew.org"
#property version "1.0"
#property description "Swap indicator for Metatrader 4"
extern int Font_Size = 11;
extern int Space = 30;
extern color Font_Color = DeepSkyBlue;
string Font_Style = "Arial Black";
double swap_long,swap_short;
int spread;
int init()
{
IndicatorShortName("Swap monitor ("+Symbol()+")");
return(0);
}
int start()
{
spread=MarketInfo(Symbol(),13);
swap_long=NormalizeDouble(MarketInfo(Symbol(),18),2);
swap_short=NormalizeDouble(MarketInfo(Symbol(),19),2);
ObjectCreate("Swap monitor1", OBJ_LABEL, WindowFind("Swap monitor ("+Symbol()+")"), 0, 0);
ObjectSetText("Swap monitor1","Spread : "+DoubleToStr(spread ,0), Font_Size, Font_Style, Font_Color);
ObjectSet("Swap monitor", OBJPROP_CORNER, 0);
ObjectSet("Swap monitor1", OBJPROP_XDISTANCE, 20);
ObjectSet("Swap monitor1", OBJPROP_YDISTANCE, Space);
ObjectSet("Swap monitor1", OBJPROP_HIDDEN, true);
ObjectCreate("Swap monitor2", OBJ_LABEL, WindowFind("Swap monitor ("+Symbol()+")"), 0, 0);
ObjectSetText("Swap monitor2","Buy Swap : "+DoubleToStr( swap_long ,2), Font_Size, Font_Style, Font_Color);
ObjectSet("Swap monitor2", OBJPROP_CORNER, 0);
ObjectSet("Swap monitor2", OBJPROP_XDISTANCE, 20);
ObjectSet("Swap monitor2", OBJPROP_YDISTANCE, Space+Space);
ObjectSet("Swap monitor2", OBJPROP_HIDDEN, true);
ObjectCreate("Swap monitor3", OBJ_LABEL, WindowFind("Swap monitor ("+Symbol()+")"), 0, 0);
ObjectSetText("Swap monitor3","Sell Swap : "+DoubleToStr( swap_short ,2), Font_Size, Font_Style, Font_Color);
ObjectSet("Swap monitor3", OBJPROP_CORNER, 0);
ObjectSet("Swap monitor3", OBJPROP_XDISTANCE, 20);
ObjectSet("Swap monitor3", OBJPROP_YDISTANCE, Space+Space+Space);
ObjectSet("Swap monitor3", OBJPROP_HIDDEN, true);
ObjectCreate("Swap monitor4", OBJ_LABEL, 0, 0, 0);
ObjectSetText("Swap monitor4","Copyright: ForexNew.org - Free Opensource",9, "Arial", DeepSkyBlue);
ObjectSet("Swap monitor4", OBJPROP_CORNER, 2);
ObjectSet("Swap monitor4", OBJPROP_XDISTANCE, 10);
ObjectSet("Swap monitor4", OBJPROP_YDISTANCE, 10);
ObjectSet("Swap monitor4", OBJPROP_SELECTABLE, false);
ObjectSet("Swap monitor4", OBJPROP_HIDDEN, true);
return(0);
}
void OnDeinit(const int reason)
{
ObjectsDeleteAll(0,"Swap monitor1");
ObjectsDeleteAll(0,"Swap monitor2");
ObjectsDeleteAll(0,"Swap monitor3");
ObjectsDeleteAll(0,"Swap monitor4");
}