-
Notifications
You must be signed in to change notification settings - Fork 0
/
email-alert-4-Amibroker.afl
51 lines (41 loc) · 1.68 KB
/
email-alert-4-Amibroker.afl
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
//////////////////////////////////////////////
//Email notifier over Support and Resistance level cross
//Coded by Fahim Morshed - Software Engineer
//Date : 31/08/2022
//////////////////////////////////////////////
_SECTION_BEGIN("Email Alert")
//logscale = ParamToggle("Test Scale", "Off|On", 0 ); //add property of parameters 'Name' & 'Value'
//Use Chart's default options
//SetChartOptions( IIf( logScale==1, 2, 3 ), chartWrapTitle );
// Send Alerts even if Amibroker is minimized or Chart is not active
//RequestTimedRefresh(2, False);
//Chart parameter option for both Buy & Sell
ResistanceAlerts = ParamToggle("Alert for Sell","Disable|Enable",0);
SupportAlerts = ParamToggle("Alert for Purchase","Disable|Enable",0);
drawUPLineValue = Study("UP", GetChartID());
UPLineValueAdj = Prec(drawUPLineValue, 3 );
AdjClosePrice = Prec(LastValue(C), 3);
drawDOWNLineValue = Study("DN", GetChartID());
DOWNLineValueAdj = Prec(drawDOWNLineValue, 3 );
text = Name() + " closed today @ TK. " + AdjClosePrice + " Price is " ;
if(ResistanceAlerts)
{
if(NullCount(UPLineValueAdj))
{
Plot( UPLineValueAdj, "No value set yet", ParamColor( "UP Color", colorCycle ));
} else {
Plot( UPLineValueAdj, "UP alert sets @ ", ParamColor( "UP Color", colorCycle ), ParamStyle("Style") );
}
AlertIf(AdjClosePrice[0] > UPLineValueAdj[0],"EMAIL",text + "High",5,0);
}
if(SupportAlerts)
{
if(NullCount( DOWNLineValueAdj))
{
Plot( DOWNLineValueAdj, "No value set yet", ParamColor( "DOWN Color", colorRed ));
} else {
Plot( DOWNLineValueAdj, "DOWN alert sets @ ", ParamColor( "DOWN Color", colorRed ), ParamStyle("Style") );
}
AlertIf(AdjClosePrice[0] < DOWNLineValueAdj[0],"EMAIL",text + "Low",5,0);
}
_SECTION_END()