0
Views
0
Downloads
0
Favorites
DeMark Projected High & Low Script
//+------------------------------------------------------------------+
//| Demark Projected High & Low Script.mq4 |
//| Converted to MT4 / MQ4 by Flash52 |
//| fxflash52@y... |
//+------------------------------------------------------------------+
#property copyright "Converted to MT4 / MQ4 by Flash52"
#property link "fxflash52@y..."
//+------------------------------------------------------------------+
//| Demark Projected High & Low script program start function |
//+------------------------------------------------------------------+
int start()
{
//---- initialize local variables
double day_high=1;
double day_low=1;
double yesterday_high=1;
double yesterday_open=1;
double yesterday_low=1;
double yesterday_close=1;
double today_open=1;
double dr=0;
double ds=0;
double x=0;
double rates_d1[2][6];
//---- exit if period is greater than daily charts
if(Period() > 1440)
{
Print("Error - Chart period is greater than 1 day.");
return(-1); // then exit
}
//---- Get new daily prices & calculate pivots
ArrayCopyRates(rates_d1, Symbol(), PERIOD_D1);
yesterday_close = rates_d1[1][4];
yesterday_open = rates_d1[1][1];
today_open = rates_d1[0][1];
yesterday_high = rates_d1[1][3];
yesterday_low = rates_d1[1][2];
//---- Calculate DeMark pivots
if(yesterday_close < yesterday_open)
{
x = (yesterday_high + (2* yesterday_low) + yesterday_close);
}
if(yesterday_close > yesterday_open)
{
x = ((yesterday_high*2) + yesterday_low + yesterday_close);
}
if(yesterday_close == yesterday_open)
{
x = (yesterday_high + yesterday_low + (2* yesterday_close));
}
dr = (x/2 - yesterday_low); //projected high
ds = (x/2 - yesterday_high); //projected low
//---- Set line labels on chart window
if(ObjectFind("DS Label") != 0)
{
ObjectCreate("DS Label", OBJ_TEXT, 0, Time[50], ds);
ObjectSetText("DS Label", "DeMark Projected Low", 8, "Arial", White);
}
else
{
ObjectMove("DS Label", 0, Time[50], ds);
}
if(ObjectFind("DR Label") != 0)
{
ObjectCreate("DR Label", OBJ_TEXT, 0, Time[50], dr);
ObjectSetText("DR Label", "DeMark Projected High", 8, "Arial", White);
}
else
{
ObjectMove("DR Label", 0, Time[50], dr);
}
//---- Set lines on chart window
if(ObjectFind("DS Line") != 0)
{
ObjectCreate("DS Line", OBJ_HLINE, 0, Time[50], ds);
ObjectSet("DS Line", OBJPROP_STYLE, STYLE_DASHDOT);
ObjectSet("DS Line", OBJPROP_COLOR, Red);
}
else
{
ObjectMove("DS Line", 0, Time[50], ds);
}
if(ObjectFind("DR Line") != 0)
{
ObjectCreate("DR Line", OBJ_HLINE, 0, Time[50], dr);
ObjectSet("DR Line", OBJPROP_STYLE, STYLE_DASHDOT);
ObjectSet("DR Line", OBJPROP_COLOR, Lime);
}
else
{
ObjectMove("DR Line", 0, Time[50], dr);
}
//---- done
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
---