last ...
This commit is contained in:
@@ -1503,6 +1503,73 @@ class XCPOIDrawer : public XCBase
|
||||
XClean(tmps);
|
||||
}
|
||||
|
||||
void DrawTrendLine(
|
||||
string name,
|
||||
double fromPrice,
|
||||
datetime fromTime,
|
||||
double toPrice,
|
||||
datetime toTime,
|
||||
XPOIDrawConfig &config,
|
||||
color clr = CLR_NONE //
|
||||
)
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
bool has =
|
||||
IsXValid(name) &&
|
||||
IsXValid(toTime) &&
|
||||
IsXValid(fromTime) &&
|
||||
NotEmptyZero(toPrice) &&
|
||||
NotEmptyZero(fromPrice) &&
|
||||
fromTime < toTime;
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
ENUM_X_DIRECTION trendDir =
|
||||
fromPrice > toPrice
|
||||
? X_DIRECTION_BEARISH
|
||||
: fromPrice < toPrice
|
||||
? X_DIRECTION_BULLISH
|
||||
: X_DIRECTION_NONE;
|
||||
color clrTrend =
|
||||
(clr != CLR_NONE)
|
||||
? clr
|
||||
: IsXBullish(trendDir)
|
||||
? config.bullishColor
|
||||
: config.bearishColor;
|
||||
|
||||
//
|
||||
CChartObjectTrend *object;
|
||||
has = DrawTrendLine(
|
||||
fromPrice,
|
||||
fromTime,
|
||||
toPrice,
|
||||
toTime,
|
||||
object,
|
||||
name,
|
||||
config.trendRayRight,
|
||||
config.trendRayLeft //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Apply Style ...
|
||||
object.Color(clr);
|
||||
object.Width(config.trendWidth);
|
||||
object.Style(config.trendStyle);
|
||||
|
||||
//
|
||||
// Save Object ...
|
||||
drawnObjects.Add(object);
|
||||
}
|
||||
|
||||
//
|
||||
ZeroMemory(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw Specified Pattern info ...
|
||||
*
|
||||
@@ -2452,114 +2519,6 @@ class XCPOIDrawer : public XCBase
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Quarters ...
|
||||
has = config.drawQuarterZones &&
|
||||
analysis.IsQuarterReady();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Draw Majors ...
|
||||
has = config.drawQuarterMajors;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Support ...
|
||||
has = analysis.HasMajorSupport();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
analysis.majorSupport.to = cTime;
|
||||
DrawZone(
|
||||
analysis.majorSupport,
|
||||
config.quarterMajorsDrawConfig //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Resistance ...
|
||||
has = analysis.HasMajorResistance();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
analysis.majorResistance.to = cTime;
|
||||
DrawZone(
|
||||
analysis.majorResistance,
|
||||
config.quarterMajorsDrawConfig //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Draw Minors ...
|
||||
if (config.drawQuarterMinors)
|
||||
{
|
||||
//
|
||||
// Support ...
|
||||
has = analysis.HasMinorSupport();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
analysis.minorSupport.to = cTime;
|
||||
DrawZone(
|
||||
analysis.minorSupport,
|
||||
config.quarterMinorsDrawConfig //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Resistance ...
|
||||
has = analysis.HasMinorResistance();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
analysis.minorResistance.to = cTime;
|
||||
DrawZone(
|
||||
analysis.minorResistance,
|
||||
config.quarterMinorsDrawConfig //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Draw Quarter ...
|
||||
if (config.drawQuarter &&
|
||||
analysis.quarter > 0)
|
||||
{
|
||||
//
|
||||
double quarter = analysis.quarter;
|
||||
|
||||
//
|
||||
datetime quarterFrom = MathMin(analysis.majorResistance.from,
|
||||
analysis.majorSupport.from);
|
||||
datetime quarterTo = cTime;
|
||||
string quarterName = "XQuarter_" + ToXString(quarter) + "_" + ToXString(TimeToSeconds(quarterFrom));
|
||||
|
||||
//
|
||||
CChartObjectTrend *iObj;
|
||||
has = DrawTrendLine(
|
||||
quarter,
|
||||
quarterFrom,
|
||||
quarter,
|
||||
quarterTo,
|
||||
iObj,
|
||||
quarterName,
|
||||
false, // Ray Right ...
|
||||
false // Ray Left ...
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iObj.Width(config.quarterWidth);
|
||||
iObj.Color(config.quarterColor);
|
||||
iObj.Style(config.quarterStyle);
|
||||
|
||||
//
|
||||
drawnObjects.Add(iObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
patternBar.Clean();
|
||||
|
||||
Reference in New Issue
Block a user