last works on pattern detector ...
This commit is contained in:
@@ -1260,4 +1260,104 @@ void ValidateBoxes(
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a Bar to Support Box ...
|
||||
*
|
||||
* @param bar: XOHCL, Specified Bar ...
|
||||
* @param box: XBoxZone, destination Box ...
|
||||
* @param toTime: datetime, Specified Box to Time ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool ToSupportBox(
|
||||
XOHCL &bar,
|
||||
XBoxZone &box,
|
||||
datetime toTime = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
box.Clean();
|
||||
toTime = NormalizeTime(toTime);
|
||||
|
||||
//
|
||||
result = bar.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
box.to = toTime;
|
||||
box.from = bar.time;
|
||||
box.lower = bar.low;
|
||||
box.symbol = bar.symbol;
|
||||
box.period = bar.period;
|
||||
box.upper = bar.GetDown();
|
||||
box.dir = X_DIRECTION_BULLISH;
|
||||
box.type = "Support";
|
||||
|
||||
//
|
||||
result = box.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
box.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a Bar to Resistance Box ...
|
||||
*
|
||||
* @param bar: XOHCL, Specified Bar ...
|
||||
* @param box: XBoxZone, destination Box ...
|
||||
* @param toTime: datetime, Specified Box to Time ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool ToResistanceBox(
|
||||
XOHCL &bar,
|
||||
XBoxZone &box,
|
||||
datetime toTime = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
box.Clean();
|
||||
toTime = NormalizeTime(toTime);
|
||||
|
||||
//
|
||||
result = bar.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
box.to = toTime;
|
||||
box.from = bar.time;
|
||||
box.upper = bar.high;
|
||||
box.symbol = bar.symbol;
|
||||
box.period = bar.period;
|
||||
box.lower = bar.GetUp();
|
||||
box.dir = X_DIRECTION_BEARISH;
|
||||
box.type = "Resistance";
|
||||
|
||||
//
|
||||
result = box.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
box.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user