0
Views
0
Downloads
0
Favorites
XALIF!
//+------------------------------------------------------------------+
//| maloma 4 XALIF.mq4 |
//+------------------------------------------------------------------+
#property copyright "© Maloma"
#property indicator_chart_window
//---- input parameters
extern int StartHour1st=5;
extern int EndHour1st=9;
extern int StartHour2nd=12;
extern int EndHour2nd=15;
bool NewDay=true;
double UpPrice1st=0;
double DnPrice1st=0;
double UpPrice2nd=0;
double DnPrice2nd=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator buffers mapping
//---- drawing settings
//----
//---- name for DataWindow
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
ObjectDelete("UpLINE1st");
ObjectDelete("DnLINE1st");
ObjectDelete("UpLINE2nd");
ObjectDelete("DnLINE2nd");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
void DelOldLines()
{
if (ObjectFind("UpLINE1st")!=-1)
{
ObjectDelete("UpLINE1st");
}
if (ObjectFind("DnLINE1st")!=-1)
{
ObjectDelete("DnLINE1st");
}
if (ObjectFind("UpLINE2nd")!=-1)
{
ObjectDelete("UpLINE2nd");
}
if (ObjectFind("DnLINE2nd")!=-1)
{
ObjectDelete("DnLINE2nd");
}
DnPrice1st=0;
UpPrice1st=0;
DnPrice2nd=0;
UpPrice2nd=0;
return(0);
}
int start()
{
if (Hour()==0 && NewDay)
{
DelOldLines();
NewDay=false;
}
if (Hour()<StartHour1st) {return(0);}
if (UpPrice1st==0) UpPrice1st=Bid;
if (DnPrice1st==0) DnPrice1st=Bid;
if (Hour()<EndHour1st)
{
if (Bid>UpPrice1st)
{
UpPrice1st=Bid;
ObjectDelete("UpLINE1st");
ObjectCreate("UpLINE1st",OBJ_HLINE,0,0,UpPrice1st);
ObjectSet("UpLINE1st",OBJPROP_COLOR,Gold);
ObjectSet("UpLINE1st",OBJPROP_WIDTH,2);
}
if (Bid<DnPrice1st)
{
DnPrice1st=Bid;
ObjectDelete("DnLINE1st");
ObjectCreate("DnLINE1st",OBJ_HLINE,0,0,DnPrice1st);
ObjectSet("DnLINE1st",OBJPROP_COLOR,Gold);
ObjectSet("DnLINE1st",OBJPROP_WIDTH,2);
}
}
//--------------------------------------------------------
if (Hour()<StartHour2nd) {return(0);}
if (UpPrice2nd==0) UpPrice2nd=Bid;
if (DnPrice2nd==0) DnPrice2nd=Bid;
if (Hour()<EndHour2nd)
{
if (Bid>UpPrice2nd)
{
UpPrice2nd=Bid;
ObjectDelete("UpLINE2nd");
ObjectCreate("UpLINE2nd",OBJ_HLINE,0,0,UpPrice2nd);
ObjectSet("UpLINE2nd",OBJPROP_COLOR,Coral);
ObjectSet("UpLINE2nd",OBJPROP_WIDTH,2);
}
if (Bid<DnPrice2nd)
{
DnPrice2nd=Bid;
ObjectDelete("DnLINE2nd");
ObjectCreate("DnLINE2nd",OBJ_HLINE,0,0,DnPrice2nd);
ObjectSet("DnLINE2nd",OBJPROP_COLOR,Coral);
ObjectSet("DnLINE2nd",OBJPROP_WIDTH,2);
}
}
return(0);
if (Hour()>=EndHour2nd) {NewDay=true;}
}
//+------------------------------------------------------------------+
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
---