0
Views
0
Downloads
0
Favorites
Lines_HiLo_Yesterday
//+------------------------------------------------------------------+
//| Lines_HiLo.mq4 |
//|
//|
//+------------------------------------------------------------------+
#property copyright "TradeForex"
#property link ""
#property indicator_chart_window
extern bool ViewComment = true;
double period_Low=0;
double period_High=0;
double Yester_High_Line=0;
double Yester_Low_Line=0;
double Todays_High_Line=0;
double Todays_Low_Line=0;
double Range = 0;
double Todays_High = 0;
double Todays_Low = 0;
double Range_Yesterday = 0;
double Todays_Range = 0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
ObjectDelete("BuyAt Label");
ObjectDelete("BuyAt Line");
ObjectDelete("SellAt Label");
ObjectDelete("SellAt Line");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
period_High =High[Highest(NULL,0,MODE_HIGH,1,1)];
period_Low =Low[Lowest(NULL,0,MODE_LOW,1,1)];
Todays_High = High[Highest(NULL,0,MODE_HIGH,0,1)];
Todays_Low = High[Highest(NULL,0,MODE_HIGH,0,1)];
Range_Yesterday = (period_High - period_Low) * Point;
Todays_Range = (Todays_High - Todays_Low) * Point;
Yester_High_Line = (period_High );
Yester_Low_Line = (period_Low );
if (ViewComment==true){
Comment("Yesterdays Range = "," ", Range);
}
{
SetLevel("Yesterdays High", Yester_High_Line, Green); //Blue
SetLevel("Yesterdays Low", Yester_Low_Line, Green); //Blue
SetLevel("Buy Line ", Todays_High_Line, Blue); //Green
SetLevel("Sell line", Todays_Low_Line, Blue); //Red
}
return(0);
}
//+------------------------------------------------------------------+
//| Helper |
//+------------------------------------------------------------------+
void SetLevel(string text, double level, color col1)
{
string labelname= text + " Label";
string linename= text + " Line";
if (ObjectFind(labelname) != 0) {
ObjectCreate(labelname, OBJ_TEXT, 0, Time[20], level);
ObjectSetText(labelname, " " + text, 8, "Arial", White);
}
else {
ObjectMove(labelname, 0, Time[20], level);
}
if (ObjectFind(linename) != 0) {
ObjectCreate(linename, OBJ_HLINE, 0, Time[40], level);
ObjectSet(linename, OBJPROP_STYLE, STYLE_SOLID);
ObjectSet(linename, OBJPROP_COLOR, col1);
}
else {
ObjectMove(linename, 0, Time[40], level);
}
}
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
---