Complete Rejection Bars ...
This commit is contained in:
@@ -121,9 +121,7 @@ class XCBaseObject : public CChartObject
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
// Swing ...
|
||||
class XCSwingObject : public XCBaseObject
|
||||
class XCBarArrowObject : public XCBaseObject
|
||||
{
|
||||
//
|
||||
public:
|
||||
@@ -133,16 +131,19 @@ class XCSwingObject : public XCBaseObject
|
||||
* Creator ...
|
||||
*
|
||||
* @param chart_id: Long, Specified Chart ID ...
|
||||
* @param name: String, Specified Object ID ...
|
||||
* @param window: Integer, Specified Chart Window ID ...
|
||||
* @param swing: XCSwing instance ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool CreateBySwing(
|
||||
bool CreateByBar(
|
||||
long chart_id,
|
||||
string name,
|
||||
int window,
|
||||
int arrow,
|
||||
XCSwing &swing //
|
||||
XOHCL &bar,
|
||||
ENUM_X_PRICE priceType //
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -151,7 +152,7 @@ class XCSwingObject : public XCBaseObject
|
||||
//
|
||||
result =
|
||||
//
|
||||
swing.IsValid()
|
||||
bar.IsValid()
|
||||
//
|
||||
;
|
||||
if (!result)
|
||||
@@ -159,22 +160,9 @@ class XCSwingObject : public XCBaseObject
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
string name = swing.GetTag();
|
||||
|
||||
//
|
||||
XOHCL bar;
|
||||
result = swing.FillBar(bar);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
datetime time = bar.time;
|
||||
double price = swing.IsSwingHigh()
|
||||
? bar.high
|
||||
: bar.low;
|
||||
double price = bar.GetPrice(priceType);
|
||||
|
||||
//
|
||||
result = mArrow.Create(
|
||||
@@ -240,6 +228,87 @@ class XCSwingObject : public XCBaseObject
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
// Swing ...
|
||||
class XCSwingObject : public XCBarArrowObject
|
||||
{
|
||||
//
|
||||
public:
|
||||
//
|
||||
|
||||
/**
|
||||
* Creator ...
|
||||
*
|
||||
* @param chart_id: Long, Specified Chart ID ...
|
||||
* @param window: Integer, Specified Chart Window ID ...
|
||||
* @param swing: XCSwing instance ...
|
||||
* @param prefix: String ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool CreateBySwing(
|
||||
long chart_id,
|
||||
int window,
|
||||
int arrow,
|
||||
XCSwing &swing,
|
||||
string prefix = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
swing.IsValid()
|
||||
//
|
||||
;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
string name = swing.GetTag();
|
||||
if (IsValid(prefix))
|
||||
{
|
||||
name = prefix + "_" + name;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL bar;
|
||||
result = swing.FillBar(bar);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
ENUM_X_PRICE price = swing.IsSwingHigh()
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_LOW;
|
||||
|
||||
//
|
||||
result = CreateByBar(
|
||||
chart_id,
|
||||
name,
|
||||
window,
|
||||
arrow,
|
||||
bar,
|
||||
price //
|
||||
);
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
ObjName(name);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Swing High ...
|
||||
class XCSwingHighObject : public XCSwingObject
|
||||
@@ -253,7 +322,9 @@ class XCSwingHighObject : public XCSwingObject
|
||||
*
|
||||
* @param chart_id: Long, Specified Chart ID ...
|
||||
* @param window: Integer, Specified Chart Window ID ...
|
||||
* @param arrow: Integer, Specified Arrow Code ...
|
||||
* @param swing: XCSwing instance ...
|
||||
* @param prefix: String ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
@@ -261,7 +332,8 @@ class XCSwingHighObject : public XCSwingObject
|
||||
long chart_id,
|
||||
int window,
|
||||
int arrow,
|
||||
XCSwing &swing //
|
||||
XCSwing &swing,
|
||||
string prefix = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -280,7 +352,8 @@ class XCSwingHighObject : public XCSwingObject
|
||||
chart_id,
|
||||
window,
|
||||
arrow,
|
||||
swing //
|
||||
swing,
|
||||
prefix //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -313,7 +386,9 @@ class XCSwingLowObject : public XCSwingObject
|
||||
*
|
||||
* @param chart_id: Long, Specified Chart ID ...
|
||||
* @param window: Integer, Specified Chart Window ID ...
|
||||
* @param arrow: Integer, Specified Arrow Code ...
|
||||
* @param swing: XCSwing instance ...
|
||||
* @param prefix: String ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
@@ -321,7 +396,8 @@ class XCSwingLowObject : public XCSwingObject
|
||||
long chart_id,
|
||||
int window,
|
||||
int arrow,
|
||||
XCSwing &swing //
|
||||
XCSwing &swing,
|
||||
string prefix = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -340,7 +416,8 @@ class XCSwingLowObject : public XCSwingObject
|
||||
chart_id,
|
||||
window,
|
||||
arrow,
|
||||
swing //
|
||||
swing,
|
||||
prefix //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -360,6 +437,424 @@ class XCSwingLowObject : public XCSwingObject
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
// Momentum ...
|
||||
class XCMomentumObject : public XCBarArrowObject
|
||||
{
|
||||
//
|
||||
public:
|
||||
//
|
||||
|
||||
/**
|
||||
* Creator ...
|
||||
*
|
||||
* @param chart_id: Long, Specified Chart ID ...
|
||||
* @param window: Integer, Specified Chart Window ID ...
|
||||
* @param momentumBar: XCMomentumBar instance ...
|
||||
* @param prefix: String ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool CreateByMomentum(
|
||||
long chart_id,
|
||||
int window,
|
||||
int arrow,
|
||||
XCMomentumBar &momentumBar,
|
||||
string prefix = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
momentumBar.IsValid()
|
||||
//
|
||||
;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
string name = momentumBar.GetTag();
|
||||
if (IsValid(prefix))
|
||||
{
|
||||
name = prefix + "_" + name;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL bar;
|
||||
result = momentumBar.FillBar(bar);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
ENUM_X_PRICE price = momentumBar.IsBullish()
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_HIGH;
|
||||
|
||||
//
|
||||
result = CreateByBar(
|
||||
chart_id,
|
||||
name,
|
||||
window,
|
||||
arrow,
|
||||
bar,
|
||||
price //
|
||||
);
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
ObjName(name);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Bullish Momentum Bar ...
|
||||
class XCBullishMomentumObject : public XCMomentumObject
|
||||
{
|
||||
//
|
||||
public:
|
||||
//
|
||||
|
||||
/**
|
||||
* Creator ...
|
||||
*
|
||||
* @param chart_id: Long, Specified Chart ID ...
|
||||
* @param window: Integer, Specified Chart Window ID ...
|
||||
* @param arrow: Integer, Specified Arrow Code ...
|
||||
* @param momentumBar: XCMomentumBar instance ...
|
||||
* @param prefix: String ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool Create(
|
||||
long chart_id,
|
||||
int window,
|
||||
int arrow,
|
||||
XCMomentumBar &momentumBar,
|
||||
string prefix = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = momentumBar.IsValid() &&
|
||||
momentumBar.IsBullish();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = CreateByMomentum(
|
||||
chart_id,
|
||||
window,
|
||||
arrow,
|
||||
momentumBar,
|
||||
prefix //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Object Type ...
|
||||
*
|
||||
* @return ( ENUM_XCHARTOBJECTS )
|
||||
*/
|
||||
virtual ENUM_XCHARTOBJECTS Type()
|
||||
{
|
||||
return X_BULLISH_MOMENTUM_BAR_OBJ;
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
// Bearish Momentum Bar ...
|
||||
class XCBearishMomentumObject : public XCMomentumObject
|
||||
{
|
||||
//
|
||||
public:
|
||||
//
|
||||
|
||||
/**
|
||||
* Creator ...
|
||||
*
|
||||
* @param chart_id: Long, Specified Chart ID ...
|
||||
* @param window: Integer, Specified Chart Window ID ...
|
||||
* @param arrow: Integer, Specified Arrow Code ...
|
||||
* @param momentumBar: XCMomentumBar instance ...
|
||||
* @param prefix: String ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool Create(
|
||||
long chart_id,
|
||||
int window,
|
||||
int arrow,
|
||||
XCMomentumBar &momentumBar,
|
||||
string prefix = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = momentumBar.IsValid() &&
|
||||
momentumBar.IsBearish();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = CreateByMomentum(
|
||||
chart_id,
|
||||
window,
|
||||
arrow,
|
||||
momentumBar,
|
||||
prefix //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Object Type ...
|
||||
*
|
||||
* @return ( ENUM_XCHARTOBJECTS )
|
||||
*/
|
||||
virtual ENUM_XCHARTOBJECTS Type()
|
||||
{
|
||||
return X_BEARISH_MOMENTUM_BAR_OBJ;
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
// Rejection ...
|
||||
class XCRejectionObject : public XCBarArrowObject
|
||||
{
|
||||
//
|
||||
public:
|
||||
//
|
||||
|
||||
/**
|
||||
* Creator ...
|
||||
*
|
||||
* @param chart_id: Long, Specified Chart ID ...
|
||||
* @param window: Integer, Specified Chart Window ID ...
|
||||
* @param rejectionBar: XCRejectionBar instance ...
|
||||
* @param prefix: String ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool CreateByRejection(
|
||||
long chart_id,
|
||||
int window,
|
||||
int arrow,
|
||||
XCRejectionBar &rejectionBar,
|
||||
string prefix = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
rejectionBar.IsValid()
|
||||
//
|
||||
;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
string name = rejectionBar.GetTag();
|
||||
if (IsValid(prefix))
|
||||
{
|
||||
name = prefix + "_" + name;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL bar;
|
||||
result = rejectionBar.FillBar(bar);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
ENUM_X_PRICE price = rejectionBar.IsBullish()
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_HIGH;
|
||||
|
||||
//
|
||||
result = CreateByBar(
|
||||
chart_id,
|
||||
name,
|
||||
window,
|
||||
arrow,
|
||||
bar,
|
||||
price //
|
||||
);
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
ObjName(name);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Bullish Rejection Bar ...
|
||||
class XCBullishRejectionObject : public XCRejectionObject
|
||||
{
|
||||
//
|
||||
public:
|
||||
//
|
||||
|
||||
/**
|
||||
* Creator ...
|
||||
*
|
||||
* @param chart_id: Long, Specified Chart ID ...
|
||||
* @param window: Integer, Specified Chart Window ID ...
|
||||
* @param arrow: Integer, Specified Arrow Code ...
|
||||
* @param rejectionBar: XCRejectionBar instance ...
|
||||
* @param prefix: String ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool Create(
|
||||
long chart_id,
|
||||
int window,
|
||||
int arrow,
|
||||
XCRejectionBar &rejectionBar,
|
||||
string prefix = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = rejectionBar.IsValid() &&
|
||||
rejectionBar.IsBullish();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = CreateByRejection(
|
||||
chart_id,
|
||||
window,
|
||||
arrow,
|
||||
rejectionBar,
|
||||
prefix //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Object Type ...
|
||||
*
|
||||
* @return ( ENUM_XCHARTOBJECTS )
|
||||
*/
|
||||
virtual ENUM_XCHARTOBJECTS Type()
|
||||
{
|
||||
return X_BULLISH_REJECTION_BAR_OBJ;
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
// Bearish Rejection Bar ...
|
||||
class XCBearishRejectionObject : public XCRejectionObject
|
||||
{
|
||||
//
|
||||
public:
|
||||
//
|
||||
|
||||
/**
|
||||
* Creator ...
|
||||
*
|
||||
* @param chart_id: Long, Specified Chart ID ...
|
||||
* @param window: Integer, Specified Chart Window ID ...
|
||||
* @param arrow: Integer, Specified Arrow Code ...
|
||||
* @param rejectionBar: XCRejectionBar instance ...
|
||||
* @param prefix: String ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool Create(
|
||||
long chart_id,
|
||||
int window,
|
||||
int arrow,
|
||||
XCRejectionBar &rejectionBar,
|
||||
string prefix = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = rejectionBar.IsValid() &&
|
||||
rejectionBar.IsBearish();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = CreateByRejection(
|
||||
chart_id,
|
||||
window,
|
||||
arrow,
|
||||
rejectionBar,
|
||||
prefix //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Object Type ...
|
||||
*
|
||||
* @return ( ENUM_XCHARTOBJECTS )
|
||||
*/
|
||||
virtual ENUM_XCHARTOBJECTS Type()
|
||||
{
|
||||
return X_BEARISH_REJECTION_BAR_OBJ;
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
// XCZoneObject ...
|
||||
class XCZoneObject : public XCBaseObject
|
||||
|
||||
Reference in New Issue
Block a user