apply long and short 1 conditions on xch che strategy ...

This commit is contained in:
2024-08-23 23:40:02 +03:30
parent f52241934e
commit f21e2c13dc
2 changed files with 164 additions and 5 deletions
+47
View File
@@ -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 ...
+117 -5
View File
@@ -348,16 +348,128 @@ public:
!chvwapConditions.hasBullishPower);
//
// Detecting Signals ...
//
bool isCHHKFullSwitchedToBullish =
bool isCHHKFullSwitchedToBullish =
chhkHelper.IsSwitchedToBullish(cIndex);
//
bool isCHHKFullSwitchedToBearish =
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)