start implementing XCHICHWAP Strategy ...
This commit is contained in:
@@ -578,13 +578,14 @@ class XSCXCHVWAPHelper : public XSCBaseHelper
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
public:
|
||||
public:
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
// Constructors ...
|
||||
XSCXCHVWAPHelper() : XSCBaseHelper(_Symbol, _Period)
|
||||
XSCXCHVWAPHelper()
|
||||
: XSCBaseHelper(_Symbol, _Period)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -2236,6 +2237,99 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Order of VWaps ...
|
||||
|
||||
//
|
||||
// Only Check Orders of VWap Buffers
|
||||
// not State of them ...
|
||||
bool IsBullishOrder(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
double shortVWap = GetS(barIndex);
|
||||
double mediumVWap = GetM(barIndex);
|
||||
double longVWap = GetL(barIndex);
|
||||
double hindVWap = GetH(barIndex);
|
||||
|
||||
//
|
||||
result = shortVWap > mediumVWap &&
|
||||
mediumVWap > longVWap &&
|
||||
longVWap > hindVWap;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
bool IsSwitchedToBullishOrder(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
bool isCBullishOrder = IsBullishOrder(barIndex);
|
||||
bool isPBullishOrder = IsBullishOrder(barIndex + 1);
|
||||
|
||||
//
|
||||
result =
|
||||
isCBullishOrder &&
|
||||
!isPBullishOrder;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Only Check Orders of VWap Buffers
|
||||
// not State of them ...
|
||||
bool IsBearishOrder(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
double shortVWap = GetS(barIndex);
|
||||
double mediumVWap = GetM(barIndex);
|
||||
double longVWap = GetL(barIndex);
|
||||
double hindVWap = GetH(barIndex);
|
||||
|
||||
//
|
||||
result = shortVWap < mediumVWap &&
|
||||
mediumVWap < longVWap &&
|
||||
longVWap < hindVWap;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
bool IsSwitchedToBearishOrder(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
bool isCBearishOrder = IsBearishOrder(barIndex);
|
||||
bool isPBearishOrder = IsBearishOrder(barIndex + 1);
|
||||
|
||||
//
|
||||
result =
|
||||
isCBearishOrder &&
|
||||
!isPBearishOrder;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Conditions ...
|
||||
|
||||
@@ -2482,10 +2576,10 @@ public:
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
protected:
|
||||
//
|
||||
// Private ...
|
||||
private:
|
||||
private:
|
||||
//
|
||||
// Props ...
|
||||
XCHVWAPInputs mInputs; // Inputs ...
|
||||
|
||||
Reference in New Issue
Block a user