125 lines
2.4 KiB
Plaintext
125 lines
2.4 KiB
Plaintext
|
|
//
|
|
void DrawSupportResistance(
|
|
int bar_index,
|
|
XOHCLSupRes &data,
|
|
string prefix = "",
|
|
color supportColor = clrLime,
|
|
color lowSupportColor = clrGreen,
|
|
color resistanceColor = clrRed,
|
|
color highResistanceColor = clrBrown)
|
|
{
|
|
//
|
|
datetime barTime = GetCandleTime(
|
|
_Symbol,
|
|
_Period,
|
|
bar_index);
|
|
|
|
//
|
|
datetime prevBarTime = GetCandleTime(
|
|
_Symbol,
|
|
_Period,
|
|
bar_index + 5);
|
|
|
|
//
|
|
long chID = ChartID();
|
|
int subWindiw = 0;
|
|
|
|
//
|
|
string mPrefix = prefix + "_" + (string)barTime + "_";
|
|
|
|
//
|
|
// SUPPORT ...
|
|
|
|
//
|
|
if (data.sup > 0)
|
|
{
|
|
//
|
|
string supTlName = mPrefix + "SUP_(" + (string)data.sup + ")";
|
|
|
|
//
|
|
// Draw Support ...
|
|
DrawTrendLine(
|
|
chID,
|
|
supTlName,
|
|
subWindiw,
|
|
prevBarTime,
|
|
data.sup,
|
|
barTime,
|
|
data.sup,
|
|
supportColor,
|
|
STYLE_DOT,
|
|
1,
|
|
true);
|
|
}
|
|
|
|
//
|
|
if (data.lowSup > 0)
|
|
{
|
|
//
|
|
string lowSupTlName = mPrefix + "LOW-SUP_(" + (string)data.lowSup + ")";
|
|
|
|
//
|
|
// Draw Low Support ...
|
|
DrawTrendLine(
|
|
chID,
|
|
lowSupTlName,
|
|
subWindiw,
|
|
prevBarTime,
|
|
data.lowSup,
|
|
barTime,
|
|
data.lowSup,
|
|
lowSupportColor,
|
|
STYLE_DOT,
|
|
1,
|
|
true);
|
|
}
|
|
|
|
//
|
|
// RESISTANCE ...
|
|
|
|
//
|
|
if (data.res > 0)
|
|
{
|
|
//
|
|
string resTlName = mPrefix + "RES_(" + (string)data.res + ")";
|
|
|
|
//
|
|
// Draw Support ...
|
|
DrawTrendLine(
|
|
chID,
|
|
resTlName,
|
|
subWindiw,
|
|
prevBarTime,
|
|
data.res,
|
|
barTime,
|
|
data.res,
|
|
resistanceColor,
|
|
STYLE_DOT,
|
|
1,
|
|
true);
|
|
}
|
|
|
|
//
|
|
if (data.highRes > 0)
|
|
{
|
|
//
|
|
string highResTlName = mPrefix + "HIGH-RES_(" + (string)data.highRes + ")";
|
|
|
|
//
|
|
// Draw Low Support ...
|
|
DrawTrendLine(
|
|
chID,
|
|
highResTlName,
|
|
subWindiw,
|
|
prevBarTime,
|
|
data.highRes,
|
|
barTime,
|
|
data.highRes,
|
|
highResistanceColor,
|
|
STYLE_DOT,
|
|
1,
|
|
true);
|
|
}
|
|
}
|