Miscellaneous
0
Views
0
Downloads
0
Favorites
PriceBoxAlert
#property copyright "Àëåðò ïðè âõîäå â áîêñ. ©+"
#property link "afx000@gmail.com"
#property indicator_chart_window
extern string BoxPrefix = "!";
extern string SoundFileName = "alert2.wav";
extern bool ShowAlert = false;
string lastAlert = "";
int start()
{
bool alert = false;
// èùåì âñå áîêñû
for (int i = 0; i < ObjectsTotal(); i++)
{
string name = ObjectName(i);
if (StringFind(name, BoxPrefix) == 0)
{
if (ObjectType(name) == OBJ_RECTANGLE)
{
datetime time1 = ObjectGet(name, OBJPROP_TIME1);
datetime time2 = ObjectGet(name, OBJPROP_TIME2);
double price1 = ObjectGet(name, OBJPROP_PRICE1);
double price2 = ObjectGet(name, OBJPROP_PRICE2);
datetime t1 = MathMin(time1, time2);
datetime t2 = MathMax(time1, time2);
double p1 = MathMin(price1, price2);
double p2 = MathMax(price1, price2);
if ((Close[0] >= p1) && (Close[0] <= p2) && (Time[0] >= t1) && (Time[0] <= t2))
{
alert = true;
break;
}
}
}
}
// àëåðò è çâóê
if (alert)
{
PlaySound(SoundFileName);
if (ShowAlert && (lastAlert != name))
{
string desc = ObjectDescription(name);
if (desc == "")
desc = name;
Alert(Symbol() + ": " + desc);
}
lastAlert = name;
}
else
lastAlert = "";
return(0);
}
int init()
{
return(0);
}
int deinit() { return(0); }
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---