apply long and short 1 conditions on xch che strategy ...
This commit is contained in:
@@ -1928,6 +1928,53 @@ struct XOHCL
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Decisions ...
|
||||
|
||||
//
|
||||
bool IsBullishDecision(
|
||||
double percent = 70 // Percent of Body
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
IsValid() &&
|
||||
Index() > 0 &&
|
||||
IsBullish() &&
|
||||
(GetRange() * percent) / 100 <= GetBody()
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool IsBearishDecision(
|
||||
double percent = 70 // Percent of Body
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
IsValid() &&
|
||||
Index() > 0 &&
|
||||
IsBearish() &&
|
||||
(GetRange() * percent) / 100 <= GetBody()
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Touches ...
|
||||
|
||||
|
||||
@@ -347,9 +347,6 @@ public:
|
||||
!chvlmConditions.hasBullishPower &&
|
||||
!chvwapConditions.hasBullishPower);
|
||||
|
||||
//
|
||||
// Detecting Signals ...
|
||||
|
||||
//
|
||||
bool isCHHKFullSwitchedToBullish =
|
||||
chhkHelper.IsSwitchedToBullish(cIndex);
|
||||
@@ -358,6 +355,121 @@ public:
|
||||
bool isCHHKFullSwitchedToBearish =
|
||||
chhkHelper.IsSwitchedToBearish(cIndex);
|
||||
|
||||
//
|
||||
bool isBearishPowerDecreasing =
|
||||
//
|
||||
conditions.chhkConditions.isBearishPowerDecreasing &&
|
||||
conditions.chcheConditions.isBearishPowerDecreasing
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isBullishPowerDecreasing =
|
||||
//
|
||||
conditions.chhkConditions.isBullishPowerDecreasing &&
|
||||
conditions.chcheConditions.isBullishPowerDecreasing
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool hasBearishDecision =
|
||||
//
|
||||
cBar.IsBearishDecision()
|
||||
//
|
||||
||
|
||||
//
|
||||
pBar.IsBearishDecision()
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool hasBullishDecision =
|
||||
//
|
||||
cBar.IsBullishDecision()
|
||||
//
|
||||
||
|
||||
//
|
||||
pBar.IsBullishDecision()
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
double long1SL =
|
||||
(cBar.IsBullishDecision()
|
||||
? cBar.low
|
||||
: pBar.low) -
|
||||
(10 * points);
|
||||
|
||||
//
|
||||
double short1SL =
|
||||
(cBar.IsBearishDecision()
|
||||
? cBar.high
|
||||
: pBar.high) -
|
||||
(10 * points);
|
||||
|
||||
//
|
||||
// Detecting Signals ...
|
||||
|
||||
//
|
||||
bool hasLong1 =
|
||||
//
|
||||
hasBullishDecision &&
|
||||
notHaveBearishPower &&
|
||||
isBearishPowerDecreasing &&
|
||||
isCHHKFullSwitchedToBullish
|
||||
//
|
||||
;
|
||||
if (hasLong1)
|
||||
{
|
||||
//
|
||||
pushers++;
|
||||
Add(
|
||||
"XCHHKE",
|
||||
signallers //
|
||||
);
|
||||
|
||||
//
|
||||
sl = long1SL;
|
||||
type = POSITION_TYPE_BUY;
|
||||
}
|
||||
|
||||
//
|
||||
bool hasShort1 =
|
||||
//
|
||||
hasBearishDecision &&
|
||||
notHaveBullishPower &&
|
||||
isBullishPowerDecreasing &&
|
||||
isCHHKFullSwitchedToBearish
|
||||
//
|
||||
;
|
||||
if (hasShort1)
|
||||
{
|
||||
//
|
||||
pushers++;
|
||||
Add(
|
||||
"XCHHKE",
|
||||
signallers //
|
||||
);
|
||||
|
||||
//
|
||||
sl = short1SL;
|
||||
type = POSITION_TYPE_SELL;
|
||||
}
|
||||
|
||||
//
|
||||
hasLong =
|
||||
//
|
||||
hasLong1
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
hasShort =
|
||||
//
|
||||
hasShort1
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
result = hasLong || hasShort;
|
||||
if (!result)
|
||||
|
||||
Reference in New Issue
Block a user