last working ...

This commit is contained in:
2025-06-04 00:04:32 +03:30
parent 043c635812
commit a7ea212ada
8 changed files with 1784 additions and 288 deletions
@@ -0,0 +1,223 @@
XBoxZone iPeak;
XBoxZone iVale;
XBoxZone iOBBull;
XBoxZone iOBBear;
XBoxZone iMTBull;
XBoxZone iMTBear;
//
iPeak.Clean();
iVale.Clean();
iOBBull.Clean();
iOBBear.Clean();
iMTBull.Clean();
iMTBear.Clean();
//
// Select MT Block ...
// if (result)
// {
// //
// // New MT Pivot Detected ...
// if (detector.newMTBullishPivotDetected)
// {
// //
// idx = GetYoungest(detector.mtBullishPivots);
// if (IsValidIndex(idx))
// {
// iMTBull = detector.mtBullishPivots[idx];
// }
// }
// else if (detector.newMTBearishPivotDetected)
// {
// //
// idx = GetYoungest(detector.mtBearishPivots);
// if (IsValidIndex(idx))
// {
// iMTBear = detector.mtBearishPivots[idx];
// }
// }
// //
// // Draw MT ...
// //
// // Bullish ...
// has = iMTBull.IsValid();
// if (has)
// {
// //
// iMTBull.to = conditions.bars[zIDX].time;
// //
// XCBoxObject *iObj;
// has = drawer
// .drawer
// .DrawBox(
// iMTBull,
// iObj //
// );
// if (has)
// {
// drawer.ApplyMTBullishPivotStyle(iObj);
// }
// }
// //
// // Bearish ...
// has = iMTBear.IsValid();
// if (has)
// {
// //
// iMTBear.to = conditions.bars[zIDX].time;
// //
// XCBoxObject *iObj;
// has = drawer
// .drawer
// .DrawBox(
// iMTBear,
// iObj //
// );
// if (has)
// {
// drawer.ApplyMTBearishPivotStyle(iObj);
// }
// }
// }
//
// Select Peak and Vale ...
// this used to Signalling Better ...
// if (result)
// {
// //
// // Select Peak ...
// idx = GetLowest(
// conditions.bars[cIDX],
// detector.peakPivots //
// );
// if (IsValidIndex(idx))
// {
// //
// iPeak = detector.peakPivots[idx];
// iPeak.to = conditions.bars[zIDX].time;
// }
// //
// // Select Vale ...
// idx = GetHighest(
// conditions.bars[cIDX],
// detector.valePivots //
// );
// if (IsValidIndex(idx))
// {
// //
// iVale = detector.valePivots[idx];
// iVale.to = conditions.bars[zIDX].time;
// }
// //
// // Checkig Result ...
// result =
// iPeak.IsValid() &&
// iVale.IsValid();
// //
// // Draw Peak and Vales ...
// if (result)
// {
// //
// // Object Definitions ...
// XCBoxObject *iObj;
// //
// // Draw Peak ...
// has = drawer
// .drawer
// .DrawBox(
// iPeak,
// iObj //
// );
// if (has)
// {
// drawer.ApplyPeakPivotStyle(iObj);
// }
// ZeroMemory(iObj);
// //
// // Draw Vale ...
// has = drawer
// .drawer
// .DrawBox(
// iVale,
// iObj //
// );
// if (has)
// {
// drawer.ApplyValePivotStyle(iObj);
// }
// ZeroMemory(iObj);
// }
// }
// //
// // We Have to Detect Youngest Order Block ...
// // or Mitigation Block ...
// if (isCond1Bullish)
// {
// // //
// // // OB ...
// // idx = GetYoungest(detector.obBullishPivots);
// // has = IsValidIndex(idx);
// // if (has)
// // {
// // iOB = detector.obBullishPivots[idx];
// // }
// //
// // MT ...
// idx = GetYoungest(detector.mtBullishPivots);
// has = IsValidIndex(idx);
// if (has)
// {
// iOB = detector.mtBullishPivots[idx];
// }
// }
// else if (isCond1Bearish)
// {
// //
// // OB
// // idx = GetYoungest(detector.obBearishPivots);
// // has = IsValidIndex(idx);
// // if (has)
// // {
// // iOB = detector.obBearishPivots[idx];
// // }
// //
// // MT
// idx = GetYoungest(detector.mtBearishPivots);
// has = IsValidIndex(idx);
// if (has)
// {
// iMT = detector.mtBearishPivots[idx];
// }
// }
// //
// // Now we can Do some Verifications Using these ...
// result =
// isCond1Bullish
// ? iMT.IsBullish()
// : iMT.IsBearish();
// if (!result)
// {
// //
// isCond1Bullish = false;
// isCond1Bearish = false;
// }
//
// All Requirements based on Cond 1 ...
+12
View File
@@ -99,6 +99,12 @@ input bool eaAllowSignallingBasedOnTriggerBlocks; // Signalling Based
input bool eaAllowSignallingBasedOnTriggerBlocksInsideOther; // Signalling Based on Trigger Blocks Seccond inputs
input bool eaSecondsTriggersSLUsingFirstTriggerBlock; // Use First Trigger Block for SL of Seconds Trigger Block Signalss
input bool eaApplyValidateAndFilterOnSelectInsideOthers; // Select Trigger Blocks by Applying Validations and Filterss
input bool eaAllowSignallingConditions1; // Allow Market Conditions Signaller to Using Sar Signals
input bool eaAllowSignallingConditions2; // Allow Market Conditions Signaller to Using Trend Signals
input bool eaAllowSignallingConditions3; // Allow Market Conditions Signaller to Using Delta Signals
input bool eaAllowSignallingConditions4; // Allow Market Conditions Signaller to Using Volume Signals
input bool eaAllowSignallingConditions5; // Allow Market Conditions Signaller to Using Signal Bar Signals
input bool eaAllowSignallingConditions6; // Allow Market Conditions Signaller to Using HK Signal Bar Signals
//
// Volume ...
@@ -273,6 +279,12 @@ int OnInit()
eaExpert.eaSecondsTriggersSLUsingFirstTriggerBlock = eaSecondsTriggersSLUsingFirstTriggerBlock;
eaExpert.eaApplyValidateAndFilterOnSelectInsideOthers = eaApplyValidateAndFilterOnSelectInsideOthers;
eaExpert.eaAllowSignallingBasedOnTriggerBlocksInsideOther = eaAllowSignallingBasedOnTriggerBlocksInsideOther;
eaExpert.eaAllowSignallingConditions1 = eaAllowSignallingConditions1;
eaExpert.eaAllowSignallingConditions2 = eaAllowSignallingConditions2;
eaExpert.eaAllowSignallingConditions3 = eaAllowSignallingConditions3;
eaExpert.eaAllowSignallingConditions4 = eaAllowSignallingConditions4;
eaExpert.eaAllowSignallingConditions5 = eaAllowSignallingConditions5;
eaExpert.eaAllowSignallingConditions6 = eaAllowSignallingConditions6;
//
// Volume ...
+12
View File
@@ -102,6 +102,12 @@ input bool eaAllowSignallingBasedOnTriggerBlocks; // Signalling Based
input bool eaAllowSignallingBasedOnTriggerBlocksInsideOther; // Signalling Based on Trigger Blocks Seccond inputs
input bool eaSecondsTriggersSLUsingFirstTriggerBlock; // Use First Trigger Block for SL of Seconds Trigger Block Signalss
input bool eaApplyValidateAndFilterOnSelectInsideOthers; // Select Trigger Blocks by Applying Validations and Filterss
input bool eaAllowSignallingConditions1; // Allow Market Conditions Signaller to Using Sar Signals
input bool eaAllowSignallingConditions2; // Allow Market Conditions Signaller to Using Trend Signals
input bool eaAllowSignallingConditions3; // Allow Market Conditions Signaller to Using Delta Signals
input bool eaAllowSignallingConditions4; // Allow Market Conditions Signaller to Using Volume Signals
input bool eaAllowSignallingConditions5; // Allow Market Conditions Signaller to Using Signal Bar Signals
input bool eaAllowSignallingConditions6; // Allow Market Conditions Signaller to Using HK Signal Bar Signals
//
// Volume ...
@@ -831,6 +837,12 @@ void InitRequirements()
iSignallerInputs.signallerConfigs.secondsTriggersSLUsingFirstTriggerBlock = eaSecondsTriggersSLUsingFirstTriggerBlock;
iSignallerInputs.signallerConfigs.applyValidateAndFilterOnSelectInsideOthers = eaApplyValidateAndFilterOnSelectInsideOthers;
iSignallerInputs.signallerConfigs.allowSignallingBasedOnTriggerBlocksInsideOther = eaAllowSignallingBasedOnTriggerBlocksInsideOther;
iSignallerInputs.signallerConfigs.allowSignallingConditions1 = eaAllowSignallingConditions1;
iSignallerInputs.signallerConfigs.allowSignallingConditions2 = eaAllowSignallingConditions2;
iSignallerInputs.signallerConfigs.allowSignallingConditions3 = eaAllowSignallingConditions3;
iSignallerInputs.signallerConfigs.allowSignallingConditions4 = eaAllowSignallingConditions4;
iSignallerInputs.signallerConfigs.allowSignallingConditions5 = eaAllowSignallingConditions5;
iSignallerInputs.signallerConfigs.allowSignallingConditions6 = eaAllowSignallingConditions6;
//
// Trigger Block Filters ...
+991
View File
@@ -5699,4 +5699,995 @@ class XCX121XCatbHelper : public XCBaseHelper
//
};
//
// Extensions ...
//
enum ENUM_XCATB_DIRECTION_SHIFT_TYPES
{
XCATB_DIRECTION_SHIFT_TYPE_NONE, // None
XCATB_DIRECTION_SHIFT_TYPE_SAR, // XSARB
XCATB_DIRECTION_SHIFT_TYPE_TREND, // XTRNDB
XCATB_DIRECTION_SHIFT_TYPE_DELTA, // XDELTAB
XCATB_DIRECTION_SHIFT_TYPE_VOLUME, // XVLMB
XCATB_DIRECTION_SHIFT_TYPE_SIGNAL_BAR, // XSBARB
XCATB_DIRECTION_SHIFT_TYPE_HK_SIGNAL_BAR, // XHKSBARB
};
//
bool IsValid(ENUM_XCATB_DIRECTION_SHIFT_TYPES value)
{
return value != XCATB_DIRECTION_SHIFT_TYPE_NONE;
}
//
string ToString(ENUM_XCATB_DIRECTION_SHIFT_TYPES value)
{
return EnumToString(value);
}
//
ENUM_XCATB_DIRECTION_SHIFT_TYPES GetDirectionShiftType(XBoxZone &box)
{
//
ENUM_XCATB_DIRECTION_SHIFT_TYPES result = XCATB_DIRECTION_SHIFT_TYPE_NONE;
//
if (!box.IsValid())
{
return result;
}
//
ENUM_XCATB_DIRECTION_SHIFT_TYPES all[] = {
XCATB_DIRECTION_SHIFT_TYPE_SAR,
XCATB_DIRECTION_SHIFT_TYPE_TREND,
XCATB_DIRECTION_SHIFT_TYPE_DELTA,
XCATB_DIRECTION_SHIFT_TYPE_VOLUME,
XCATB_DIRECTION_SHIFT_TYPE_SIGNAL_BAR,
XCATB_DIRECTION_SHIFT_TYPE_HK_SIGNAL_BAR,
};
//
int count = ArraySize(all);
for (int i = 0; i < count; i++)
{
//
if (box.type == ToString(all[i]))
{
//
result = all[i];
break;
}
}
//
return result;
}
//
bool IsDirectionShift(XBoxZone &box)
{
//
bool result = false;
//
result = IsValid(GetDirectionShiftType(box));
//
return result;
}
/**
* Generate Sar Direction Shift Box ...
*
* @param box: XBoxZone instance reference, Holds Generated Box ...
* @param helper: XCX121XCatbHelper instance pointer ...
* @param conditions: X121XCatbConditions instance reference, Specified Market Conditions ...
*
* @return ( bool )
*/
bool GenerateSarDirectionShiftBox(
XBoxZone &box,
XCX121XCatbHelper *helper,
X121XCatbConditions &conditions //
)
{
//
bool result = false;
//
// Normalize Args ...
box.Clean();
//
// Validate Args ...
result =
helper != NULL;
if (!result)
{
return result;
}
//
// Define Requirements ...
//
int idx = -1;
int zIDX = 0;
int cIDX = zIDX + 1;
int pIDX = cIDX + 1;
//
// Check Sar Direction Changed Happens or not ...
//
bool isBullish =
//
(
//
// Current SAR is Directional ...
conditions.isSarBullish &&
//
// Previous InDirectional Sar Exists ...
helper.lastSarBearish.IsValid() &&
//
// Current Close is Over previous Sar ...
conditions.bars[cIDX].close > helper.lastSarBearish.after &&
//
// Before Close is not Over previous Sar ...
conditions.bars[pIDX].close <= helper.lastSarBearish.after
//
)
//
;
//
bool isBearish =
//
(
//
// Current SAR is Directional ...
conditions.isSarBearish &&
//
// Previous InDirectional Sar Exists ...
helper.lastSarBullish.IsValid() &&
//
// Current Close is Under previous ...
conditions.bars[cIDX].close < helper.lastSarBullish.after &&
//
// Before Close is not Under previous ...
conditions.bars[pIDX].close >= helper.lastSarBullish.after
//
)
//
;
//
result =
isBullish ||
isBearish;
if (!result)
{
return result;
}
//
// Assign Last Direction Shift ...
XDirectionShift lastBullish = helper.lastSarBullish;
XDirectionShift lastBearish = helper.lastSarBearish;
XDirectionShift selected = isBullish
? lastBearish
: lastBullish;
//
// Convert to Box ...
box.type = "XSARB";
box.from = selected.at;
box.symbol = selected.symbol;
box.period = selected.period;
box.dir = isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
box.to = conditions.bars[zIDX].time;
//
// Detect Boundary ...
idx = selected.Index();
result = IsValidIndex(idx);
if (result)
{
//
box.lower = conditions.bars[zIDX].FindLowest(idx, MODE_CLOSE);
box.upper = conditions.bars[zIDX].FindHighest(idx, MODE_CLOSE);
}
//
// Summarize Result ...
result = box.IsValid();
//
// Cleanup Resources ...
//
if (!result)
{
box.Clean();
}
//
selected.Clean();
lastBullish.Clean();
lastBearish.Clean();
//
return result;
}
/**
* Generate Trend Direction Shift Box ...
*
* @param box: XBoxZone instance reference, Holds Generated Box ...
* @param helper: XCX121XCatbHelper instance pointer ...
* @param conditions: X121XCatbConditions instance reference, Specified Market Conditions ...
*
* @return ( bool )
*/
bool GenerateTrendDirectionShiftBox(
XBoxZone &box,
XCX121XCatbHelper *helper,
X121XCatbConditions &conditions //
)
{
//
bool result = false;
//
// Normalize Args ...
box.Clean();
//
// Validate Args ...
result =
helper != NULL;
if (!result)
{
return result;
}
//
// Define Requirements ...
//
int idx = -1;
int zIDX = 0;
int cIDX = zIDX + 1;
int pIDX = cIDX + 1;
//
// Check Sar Direction Changed Happens or not ...
//
bool isBullish =
//
(
//
// Current Trend is Directional ...
conditions.isTrendBullish &&
//
// Previous InDirectiona; Trend Exists ...
helper.lastTrendBearish.IsValid() &&
//
// Current Close is Over previous ...
conditions.bars[cIDX].close > helper.lastTrendBearish.after &&
//
// Before close is not Over previous ...
conditions.bars[pIDX].close <= helper.lastTrendBearish.after
//
)
//
;
//
bool isBearish =
//
(
//
// Current Trend is Directional ...
conditions.isTrendBearish &&
//
// Previous InDirectiona; Trend Exists ...
helper.lastTrendBullish.IsValid() &&
//
// Current Close is Under previous ...
conditions.bars[cIDX].close < helper.lastTrendBullish.after &&
//
// Before close is not Under previous ...
conditions.bars[pIDX].close >= helper.lastTrendBullish.after
//
)
//
;
//
result =
isBullish ||
isBearish;
if (!result)
{
return result;
}
//
// Assign Last Direction Shift ...
XDirectionShift lastBullish = helper.lastTrendBullish;
XDirectionShift lastBearish = helper.lastTrendBearish;
XDirectionShift selected = isBullish
? lastBearish
: lastBullish;
//
// Convert to Box ...
box.type = "XTRNDB";
box.from = selected.at;
box.symbol = selected.symbol;
box.period = selected.period;
box.dir = isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
box.to = conditions.bars[zIDX].time;
//
// Detect Boundary ...
idx = selected.Index();
result = IsValidIndex(idx);
if (result)
{
//
box.lower = conditions.bars[zIDX].FindLowest(idx, MODE_CLOSE);
box.upper = conditions.bars[zIDX].FindHighest(idx, MODE_CLOSE);
}
//
// Summarize Result ...
result = box.IsValid();
//
// Cleanup Resources ...
//
if (!result)
{
box.Clean();
}
//
selected.Clean();
lastBullish.Clean();
lastBearish.Clean();
//
return result;
}
/**
* Generate Delta Direction Shift Box ...
*
* @param box: XBoxZone instance reference, Holds Generated Box ...
* @param helper: XCX121XCatbHelper instance pointer ...
* @param conditions: X121XCatbConditions instance reference, Specified Market Conditions ...
*
* @return ( bool )
*/
bool GenerateDeltaDirectionShiftBox(
XBoxZone &box,
XCX121XCatbHelper *helper,
X121XCatbConditions &conditions //
)
{
//
bool result = false;
//
// Normalize Args ...
box.Clean();
//
// Validate Args ...
result =
helper != NULL;
if (!result)
{
return result;
}
//
// Define Requirements ...
//
int idx = -1;
int zIDX = 0;
int cIDX = zIDX + 1;
int pIDX = cIDX + 1;
//
// Check Sar Direction Changed Happens or not ...
//
bool isBullish =
//
// Check State ...
(
//
// Delta is Up ...
conditions.deltaBuffer[cIDX] > conditions.deltaBuffer[pIDX] &&
//
// Delta Signal is Up ...
conditions.deltaSignalBuffer[cIDX] > conditions.deltaSignalBuffer[pIDX] &&
//
// Delta Crossed Over Delta Signal ...
conditions.deltaBuffer[cIDX] > conditions.deltaSignalBuffer[cIDX]
//
)
//
&&
//
// Check Last InDirectional Exists ...
helper.lastDeltaBearish.IsValid() &&
//
// Current Close is Over last ...
conditions.bars[cIDX].close > helper.lastDeltaBearish.after &&
//
// Before Close is not Over last ...
conditions.bars[pIDX].close <= helper.lastDeltaBearish.after
//
;
//
bool isBearish =
//
// Check State ...
(
//
// Delta is Down ...
conditions.deltaBuffer[cIDX] < conditions.deltaBuffer[pIDX] &&
//
// Delta Signal is Down ...
conditions.deltaSignalBuffer[cIDX] < conditions.deltaSignalBuffer[pIDX] &&
//
// Delta Crossed Under Delta Signal ...
conditions.deltaBuffer[cIDX] < conditions.deltaSignalBuffer[cIDX]
//
)
//
&&
//
// Check Last InDirectional Exists ...
helper.lastDeltaBullish.IsValid() &&
//
// Current Close is Under last ...
conditions.bars[cIDX].close < helper.lastDeltaBullish.after &&
//
// Before Close is not Under last ...
conditions.bars[pIDX].close >= helper.lastDeltaBullish.after
//
;
//
result =
isBullish ||
isBearish;
if (!result)
{
return result;
}
//
// Assign Last Direction Shift ...
XDirectionShift lastBullish = helper.lastDeltaBullish;
XDirectionShift lastBearish = helper.lastDeltaBearish;
XDirectionShift selected = isBullish
? lastBearish
: lastBullish;
//
// Convert to Box ...
box.type = "XDELTAB";
box.from = selected.at;
box.symbol = selected.symbol;
box.period = selected.period;
box.dir = isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
box.to = conditions.bars[zIDX].time;
//
// Detect Boundary ...
idx = selected.Index();
result = IsValidIndex(idx);
if (result)
{
//
box.lower = conditions.bars[zIDX].FindLowest(idx, MODE_CLOSE);
box.upper = conditions.bars[zIDX].FindHighest(idx, MODE_CLOSE);
}
//
// Summarize Result ...
result = box.IsValid();
//
// Cleanup Resources ...
//
if (!result)
{
box.Clean();
}
//
selected.Clean();
lastBullish.Clean();
lastBearish.Clean();
//
return result;
}
/**
* Generate Volume Direction Shift Box ...
*
* @param box: XBoxZone instance reference, Holds Generated Box ...
* @param helper: XCX121XCatbHelper instance pointer ...
* @param conditions: X121XCatbConditions instance reference, Specified Market Conditions ...
*
* @return ( bool )
*/
bool GenerateVolumeDirectionShiftBox(
XBoxZone &box,
XCX121XCatbHelper *helper,
X121XCatbConditions &conditions //
)
{
//
bool result = false;
//
// Normalize Args ...
box.Clean();
//
// Validate Args ...
result =
helper != NULL;
if (!result)
{
return result;
}
//
// Define Requirements ...
//
int idx = -1;
int zIDX = 0;
int cIDX = zIDX + 1;
int pIDX = cIDX + 1;
//
// Check Sar Direction Changed Happens or not ...
//
bool isBullish =
//
(
//
//
// Volume is Up ...
conditions.bullishVolumeBuffer[1] > conditions.bullishVolumeBuffer[2] &&
//
// Volume Signal is Up ...
conditions.bullishVolumeSignalBuffer[1] > conditions.bullishVolumeSignalBuffer[2] &&
//
// Volume Signals Crossed Over ...
conditions.bullishVolumeSignalBuffer[1] > conditions.bearishVolumeSignalBuffer[1]
//
)
//
&&
//
// Check Last InDirectional Exists ...
helper.lastVolumeBearish.IsValid() &&
//
// Current Close is Over last ...
conditions.bars[cIDX].close > helper.lastVolumeBearish.after &&
//
// Before Close is not Over last ...
conditions.bars[pIDX].close <= helper.lastVolumeBearish.after
//
;
//
bool isBearish =
//
(
//
//
// Volume is Up ...
conditions.bearishVolumeBuffer[1] > conditions.bearishVolumeBuffer[2] &&
//
// Volume Signal is Up ...
conditions.bearishVolumeSignalBuffer[1] > conditions.bearishVolumeSignalBuffer[2] &&
//
// Volume Signals Crossed Over ...
conditions.bearishVolumeSignalBuffer[1] > conditions.bullishVolumeSignalBuffer[1]
//
)
//
&&
//
// Check Last InDirectional Exists ...
helper.lastVolumeBullish.IsValid() &&
//
// Current Close is Over last ...
conditions.bars[cIDX].close < helper.lastVolumeBullish.after &&
//
// Before Close is not Over last ...
conditions.bars[pIDX].close >= helper.lastVolumeBullish.after
//
;
//
result =
isBullish ||
isBearish;
if (!result)
{
return result;
}
//
// Assign Last Direction Shift ...
XDirectionShift lastBullish = helper.lastVolumeBullish;
XDirectionShift lastBearish = helper.lastVolumeBearish;
XDirectionShift selected = isBullish
? lastBearish
: lastBullish;
//
// Convert to Box ...
box.type = "XVLMB";
box.from = selected.at;
box.symbol = selected.symbol;
box.period = selected.period;
box.dir = isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
box.to = conditions.bars[zIDX].time;
//
// Detect Boundary ...
idx = selected.Index();
result = IsValidIndex(idx);
if (result)
{
//
box.lower = conditions.bars[zIDX].FindLowest(idx, MODE_CLOSE);
box.upper = conditions.bars[zIDX].FindHighest(idx, MODE_CLOSE);
}
//
// Summarize Result ...
result = box.IsValid();
//
// Cleanup Resources ...
//
if (!result)
{
box.Clean();
}
//
selected.Clean();
lastBullish.Clean();
lastBearish.Clean();
//
return result;
}
/**
* Generate Signal Bar Direction Shift Box ...
*
* @param box: XBoxZone instance reference, Holds Generated Box ...
* @param helper: XCX121XCatbHelper instance pointer ...
* @param conditions: X121XCatbConditions instance reference, Specified Market Conditions ...
*
* @return ( bool )
*/
bool GenerateSignalBarDirectionShiftBox(
XBoxZone &box,
XCX121XCatbHelper *helper,
X121XCatbConditions &conditions //
)
{
//
bool result = false;
//
// Normalize Args ...
box.Clean();
//
// Validate Args ...
result =
helper != NULL;
if (!result)
{
return result;
}
//
// Define Requirements ...
//
int idx = -1;
int zIDX = 0;
int cIDX = zIDX + 1;
int pIDX = cIDX + 1;
//
// Check Sar Direction Changed Happens or not ...
//
bool isBullish =
//
(
//
// Check Direction ...
conditions.isSBarBullish &&
//
// Previous InDirectional Exists ...
helper.lastSignalBarBearish.IsValid() &&
//
// Current Signal Bar close over prev ...
conditions.sBarCloseBuffer[cIDX] > helper.lastSignalBarBearish.after &&
//
// Prev Signal Bar not close over prev ...
conditions.sBarCloseBuffer[pIDX] <= helper.lastSignalBarBearish.after
//
)
//
;
//
bool isBearish =
//
(
//
// Check Direction ...
conditions.isSBarBearish &&
//
// Previous InDirectional Exists ...
helper.lastSignalBarBullish.IsValid() &&
//
// Current Signal Bar close over prev ...
conditions.sBarCloseBuffer[cIDX] < helper.lastSignalBarBullish.after &&
//
// Prev Signal Bar not close over prev ...
conditions.sBarCloseBuffer[pIDX] >= helper.lastSignalBarBullish.after
//
)
//
;
//
result =
isBullish ||
isBearish;
if (!result)
{
return result;
}
//
// Assign Last Direction Shift ...
XDirectionShift lastBullish = helper.lastSignalBarBullish;
XDirectionShift lastBearish = helper.lastSignalBarBearish;
XDirectionShift selected = isBullish
? lastBearish
: lastBullish;
//
// Convert to Box ...
box.type = "XSBARB";
box.from = selected.at;
box.symbol = selected.symbol;
box.period = selected.period;
box.dir = isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
box.to = conditions.bars[zIDX].time;
//
// Detect Boundary ...
idx = selected.Index();
result = IsValidIndex(idx);
if (result)
{
//
box.lower = conditions.bars[zIDX].FindLowest(idx, MODE_CLOSE);
box.upper = conditions.bars[zIDX].FindHighest(idx, MODE_CLOSE);
}
//
// Summarize Result ...
result = box.IsValid();
//
// Cleanup Resources ...
//
if (!result)
{
box.Clean();
}
//
selected.Clean();
lastBullish.Clean();
lastBearish.Clean();
//
return result;
}
/**
* Generate HK Signal Bar Direction Shift Box ...
*
* @param box: XBoxZone instance reference, Holds Generated Box ...
* @param helper: XCX121XCatbHelper instance pointer ...
* @param conditions: X121XCatbConditions instance reference, Specified Market Conditions ...
*
* @return ( bool )
*/
bool GenerateHKSignalBarDirectionShiftBox(
XBoxZone &box,
XCX121XCatbHelper *helper,
X121XCatbConditions &conditions //
)
{
//
bool result = false;
//
// Normalize Args ...
box.Clean();
//
// Validate Args ...
result =
helper != NULL;
if (!result)
{
return result;
}
//
// Define Requirements ...
//
int idx = -1;
int zIDX = 0;
int cIDX = zIDX + 1;
int pIDX = cIDX + 1;
//
// Check Sar Direction Changed Happens or not ...
//
bool isBullish =
//
(
//
// Check Direction ...
conditions.isHKSBarBullish &&
//
// Previous InDirectional Exists ...
helper.lastHKSignalBarBearish.IsValid() &&
//
// Current Signal Bar close over prev ...
conditions.hkSBarCloseBuffer[cIDX] > helper.lastHKSignalBarBearish.after &&
//
// Prev Signal Bar not close over prev ...
conditions.hkSBarCloseBuffer[pIDX] <= helper.lastHKSignalBarBearish.after
//
)
//
;
//
bool isBearish =
//
(
//
// Check Direction ...
conditions.isHKSBarBearish &&
//
// Previous InDirectional Exists ...
helper.lastHKSignalBarBullish.IsValid() &&
//
// Current Signal Bar close over prev ...
conditions.hkSBarCloseBuffer[cIDX] < helper.lastHKSignalBarBullish.after &&
//
// Prev Signal Bar not close over prev ...
conditions.hkSBarCloseBuffer[pIDX] >= helper.lastHKSignalBarBullish.after
//
)
//
;
//
result =
isBullish ||
isBearish;
if (!result)
{
return result;
}
//
// Assign Last Direction Shift ...
XDirectionShift lastBullish = helper.lastHKSignalBarBullish;
XDirectionShift lastBearish = helper.lastHKSignalBarBearish;
XDirectionShift selected = isBullish
? lastBearish
: lastBullish;
//
// Convert to Box ...
box.type = "XHKSBARB";
box.from = selected.at;
box.symbol = selected.symbol;
box.period = selected.period;
box.dir = isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
box.to = conditions.bars[zIDX].time;
//
// Detect Boundary ...
idx = selected.Index();
result = IsValidIndex(idx);
if (result)
{
//
box.lower = conditions.bars[zIDX].FindLowest(idx, MODE_CLOSE);
box.upper = conditions.bars[zIDX].FindHighest(idx, MODE_CLOSE);
}
//
// Summarize Result ...
result = box.IsValid();
//
// Cleanup Resources ...
//
if (!result)
{
box.Clean();
}
//
selected.Clean();
lastBullish.Clean();
lastBearish.Clean();
//
return result;
}
//
+64
View File
@@ -5983,6 +5983,70 @@ struct XDirectionShift
return result;
}
//
// Get Bar Index of Direction Shift ...
int Index()
{
//
int result = -1;
//
// Validate ...
if (!IsValid())
{
return result;
}
//
// Retrieve Bar Index ...
result = GetBarIndex(
symbol,
period,
at //
);
//
return result;
}
//
// Get At Bar ...
bool AtBar(XOHCL &bar)
{
//
bool result = false;
//
// Normalize ...
bar.Clean();
//
// Validate ...
result = IsValid();
if (!result)
{
return result;
}
//
int idx = Index();
if (IsValidIndex(idx))
{
//
result = bar.Init(
symbol,
period,
idx //
);
}
//
result = bar.IsValid();
//
return result;
}
//
// Check Same ...
bool IsSameAs(XDirectionShift &item)
+12 -1
View File
@@ -107,6 +107,12 @@ class XCXCATBEAExpert : public XCBase
bool eaAllowSignallingBasedOnTriggerBlocksInsideOther; // Signalling Based on Trigger Blocks Seccond inputs
bool eaSecondsTriggersSLUsingFirstTriggerBlock; // Use First Trigger Block for SL of Seconds Trigger Block Signalss
bool eaApplyValidateAndFilterOnSelectInsideOthers; // Select Trigger Blocks by Applying Validations and Filterss
bool eaAllowSignallingConditions1; // Allow Market Conditions Signaller to Using Sar Starter Signals
bool eaAllowSignallingConditions2; // Allow Market Conditions Signaller to Using Trend Starter Signals
bool eaAllowSignallingConditions3; // Allow Market Conditions Signaller to Using Delta Starter Signals
bool eaAllowSignallingConditions4; // Allow Market Conditions Signaller to Using Volume Starter Signals
bool eaAllowSignallingConditions5; // Allow Market Conditions Signaller to Using Signal Bar Starter Signals
bool eaAllowSignallingConditions6; // Allow Market Conditions Signaller to Using HK Signal Bar Starter Signals
//
// Volume ...
@@ -494,7 +500,12 @@ class XCXCATBEAExpert : public XCBase
iSignallerInputs.signallerConfigs.secondsTriggersSLUsingFirstTriggerBlock = eaSecondsTriggersSLUsingFirstTriggerBlock;
iSignallerInputs.signallerConfigs.applyValidateAndFilterOnSelectInsideOthers = eaApplyValidateAndFilterOnSelectInsideOthers;
iSignallerInputs.signallerConfigs.allowSignallingBasedOnTriggerBlocksInsideOther = eaAllowSignallingBasedOnTriggerBlocksInsideOther;
iSignallerInputs.signallerConfigs.allowSignallingConditions1 = eaAllowSignallingConditions1;
iSignallerInputs.signallerConfigs.allowSignallingConditions2 = eaAllowSignallingConditions2;
iSignallerInputs.signallerConfigs.allowSignallingConditions3 = eaAllowSignallingConditions3;
iSignallerInputs.signallerConfigs.allowSignallingConditions4 = eaAllowSignallingConditions4;
iSignallerInputs.signallerConfigs.allowSignallingConditions5 = eaAllowSignallingConditions5;
iSignallerInputs.signallerConfigs.allowSignallingConditions6 = eaAllowSignallingConditions6;
//
// Prepare Trigger Block Validations ...
@@ -49,6 +49,15 @@ struct XCATBEASignallingConfigs
bool applyValidateAndFilterOnSelectInsideOthers; // Select Trigger Blocks by Applying Validations and Filterss
bool secondsTriggersSLUsingFirstTriggerBlock; // Use First Trigger Block for SL of Seconds Trigger Block Signalss
//
// Market Conditions Signall Providers ...
bool allowSignallingConditions1; // Allow Market Conditions Signaller to Using Sar Starter Signals
bool allowSignallingConditions2; // Allow Market Conditions Signaller to Using Trend Starter Signals
bool allowSignallingConditions3; // Allow Market Conditions Signaller to Using Delta Starter Signals
bool allowSignallingConditions4; // Allow Market Conditions Signaller to Using Volume Starter Signals
bool allowSignallingConditions5; // Allow Market Conditions Signaller to Using Signal Bar Starter Signals
bool allowSignallingConditions6; // Allow Market Conditions Signaller to Using HK Signal Bar Starter Signals
//
// Constructor ...
XCATBEASignallingConfigs()
@@ -71,6 +80,14 @@ struct XCATBEASignallingConfigs
//
secondsTriggersSLUsingFirstTriggerBlock = false;
applyValidateAndFilterOnSelectInsideOthers = false;
//
allowSignallingConditions1 = false;
allowSignallingConditions2 = false;
allowSignallingConditions3 = false;
allowSignallingConditions4 = false;
allowSignallingConditions5 = false;
allowSignallingConditions6 = false;
}
};
@@ -163,6 +180,15 @@ class XCXCATBEASignaller : XCBase
bool secondsTriggersSLUsingFirstTriggerBlock; // Use First Trigger Block for SL of Seconds Trigger Block Signalss
bool applyValidateAndFilterOnSelectInsideOthers; // Select Trigger Blocks by Applying Validations and Filterss
//
// Market Conditions Signall Providers ...
bool allowSignallingConditions1; // Allow Market Conditions Signaller to Using Sar Starter Signals
bool allowSignallingConditions2; // Allow Market Conditions Signaller to Using Trend Starter Signals
bool allowSignallingConditions3; // Allow Market Conditions Signaller to Using Delta Starter Signals
bool allowSignallingConditions4; // Allow Market Conditions Signaller to Using Volume Starter Signals
bool allowSignallingConditions5; // Allow Market Conditions Signaller to Using Signal Bar Starter Signals
bool allowSignallingConditions6; // Allow Market Conditions Signaller to Using HK Signal Bar Starter Signals
//
bool allowDraws; // Allow Draws or not ...
bool allowGuards; // Allow Guards or not ...
@@ -708,6 +734,12 @@ class XCXCATBEASignaller : XCBase
barAnalyser,
mConditions.conditions,
mConditions.pivotZone,
allowSignallingConditions1,
allowSignallingConditions2,
allowSignallingConditions3,
allowSignallingConditions4,
allowSignallingConditions5,
allowSignallingConditions6,
barIndex,
10 // Loopback ...
);
@@ -1494,6 +1526,14 @@ class XCXCATBEASignaller : XCBase
secondsTriggersSLUsingFirstTriggerBlock = inputs.signallerConfigs.secondsTriggersSLUsingFirstTriggerBlock;
applyValidateAndFilterOnSelectInsideOthers = inputs.signallerConfigs.applyValidateAndFilterOnSelectInsideOthers;
//
allowSignallingConditions1 = inputs.signallerConfigs.allowSignallingConditions1;
allowSignallingConditions2 = inputs.signallerConfigs.allowSignallingConditions2;
allowSignallingConditions3 = inputs.signallerConfigs.allowSignallingConditions3;
allowSignallingConditions4 = inputs.signallerConfigs.allowSignallingConditions4;
allowSignallingConditions5 = inputs.signallerConfigs.allowSignallingConditions5;
allowSignallingConditions6 = inputs.signallerConfigs.allowSignallingConditions6;
//
bool has = inputs.IsValid();
if (!has)
+430 -287
View File
@@ -358,6 +358,12 @@ bool DetectSignalZone(
XCBarAnalyser *barAnalyser,
X121XCatbConditions &conditions,
XBoxZone &signalZone,
bool allowSignallingConditions1 = false,
bool allowSignallingConditions2 = false,
bool allowSignallingConditions3 = false,
bool allowSignallingConditions4 = false,
bool allowSignallingConditions5 = false,
bool allowSignallingConditions6 = false,
int barIndex = 0,
int loopback = 10 //
)
@@ -403,12 +409,6 @@ bool DetectSignalZone(
//
int idx = -1;
XBoxZone iPeak;
XBoxZone iVale;
XBoxZone iOBBull;
XBoxZone iOBBear;
XBoxZone iMTBull;
XBoxZone iMTBear;
bool has = false;
bool isBullish = false;
bool isBearish = false;
@@ -425,154 +425,6 @@ bool DetectSignalZone(
ENUM_TIMEFRAMES iPeriod = NULL;
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
//
// Select MT Block ...
if (result)
{
//
// New MT Pivot Detected ...
if (detector.newMTBullishPivotDetected)
{
//
idx = GetYoungest(detector.mtBullishPivots);
if (IsValidIndex(idx))
{
iMTBull = detector.mtBullishPivots[idx];
}
}
else if (detector.newMTBearishPivotDetected)
{
//
idx = GetYoungest(detector.mtBearishPivots);
if (IsValidIndex(idx))
{
iMTBear = detector.mtBearishPivots[idx];
}
}
//
// Draw MT ...
//
// Bullish ...
has = iMTBull.IsValid();
if (has)
{
//
iMTBull.to = conditions.bars[zIDX].time;
//
XCBoxObject *iObj;
has = drawer
.drawer
.DrawBox(
iMTBull,
iObj //
);
if (has)
{
drawer.ApplyMTBullishPivotStyle(iObj);
}
}
//
// Bearish ...
has = iMTBear.IsValid();
if (has)
{
//
iMTBear.to = conditions.bars[zIDX].time;
//
XCBoxObject *iObj;
has = drawer
.drawer
.DrawBox(
iMTBear,
iObj //
);
if (has)
{
drawer.ApplyMTBearishPivotStyle(iObj);
}
}
}
//
// Select Peak and Vale ...
// this used to Signalling Better ...
if (result)
{
//
// Select Peak ...
idx = GetLowest(
conditions.bars[cIDX],
detector.peakPivots //
);
if (IsValidIndex(idx))
{
//
iPeak = detector.peakPivots[idx];
iPeak.to = conditions.bars[zIDX].time;
}
//
// Select Vale ...
idx = GetHighest(
conditions.bars[cIDX],
detector.valePivots //
);
if (IsValidIndex(idx))
{
//
iVale = detector.valePivots[idx];
iVale.to = conditions.bars[zIDX].time;
}
//
// Checkig Result ...
result =
iPeak.IsValid() &&
iVale.IsValid();
//
// Draw Peak and Vales ...
if (result)
{
//
// Object Definitions ...
XCBoxObject *iObj;
//
// Draw Peak ...
has = drawer
.drawer
.DrawBox(
iPeak,
iObj //
);
if (has)
{
drawer.ApplyPeakPivotStyle(iObj);
}
ZeroMemory(iObj);
//
// Draw Vale ...
has = drawer
.drawer
.DrawBox(
iVale,
iObj //
);
if (has)
{
drawer.ApplyValePivotStyle(iObj);
}
ZeroMemory(iObj);
}
}
//
// Signalling ...
if (result)
@@ -959,7 +811,7 @@ bool DetectSignalZone(
// Detect Bar Verifications ...
//
ENUM_X_DIRECTION iDir;
ENUM_X_DIRECTION iBDir;
//
// Rejected ...
@@ -967,14 +819,14 @@ bool DetectSignalZone(
barAnalyser
.IsRejected(
conditions.bars[cIDX],
iDir //
iBDir //
);
bool isBullishRejected =
isRejected &&
IsBullish(iDir);
IsBullish(iBDir);
bool isBearishRejected =
isRejected &&
IsBearish(iDir);
IsBearish(iBDir);
//
// Engulfed ...
@@ -982,14 +834,14 @@ bool DetectSignalZone(
barAnalyser
.IsEngulfed(
conditions.bars[cIDX],
iDir //
iBDir //
);
bool isBullishEngulfed =
isEngulfed &&
IsBullish(iDir);
IsBullish(iBDir);
bool isBearishEngulfed =
isEngulfed &&
IsBearish(iDir);
IsBearish(iBDir);
//
// Momentum ...
@@ -997,14 +849,14 @@ bool DetectSignalZone(
barAnalyser
.IsMomentum(
conditions.bars[cIDX],
iDir //
iBDir //
);
bool isBullishMomentum =
isMomentum &&
IsBullish(iDir);
IsBullish(iBDir);
bool isBearishMomentum =
isMomentum &&
IsBearish(iDir);
IsBearish(iBDir);
//
bool isBarBullishPressured =
@@ -1026,61 +878,69 @@ bool DetectSignalZone(
// Conditions 1:
// --------------
// Descriptions:
// - [] Detect Parabolic Sar Start ...
// - [] Convert is to Box ...
// - [] Detect Parabolic Sar Direction Change ...
// - [] Check Some others Conditions based on Changed Direction ...
// - [] Generate Direction Change Zone ...
// - [] Use it to Fill Signal Zone ...
// ------------------------------------
//
bool isCond1Bullish =
bool isCond1Bullish = false;
bool isCond1Bearish = false;
if (allowSignallingConditions1)
{
//
// Start ...
(isSarBullishStart &&
!isSarBearishStart) &&
//
// SCORE ...
isScoreBullish &&
//
// BAR ...
isBarBullishPressured &&
//
// KI ...
// conditions.isKIUp &&
conditions.isKIBullish &&
//
// ATR ...
conditions.isATRUp &&
//
// TREND ...
conditions.isTrendUp // &&
// conditions.isTrendBullish
//
;
isCond1Bullish =
//
// Start ...
(isSarBullishStart &&
!isSarBearishStart) &&
//
// SCORE ...
isScoreBullish &&
//
// BAR ...
isBarBullishPressured &&
//
// KI ...
// conditions.isKIUp &&
conditions.isKIBullish &&
//
// ATR ...
conditions.isATRUp &&
//
// TREND ...
conditions.isTrendUp // &&
// conditions.isTrendBullish
//
;
//
bool isCond1Bearish =
//
// Start ...
(isSarBearishStart &&
!isSarBullishStart) &&
//
// SCORE ...
isScoreBearish &&
//
// BAR ...
isBarBearishPressured &&
//
// KI ...
// conditions.isKIDown &&
conditions.isKIBearish &&
//
// ATR ...
conditions.isATRDown &&
//
// TREND ...
conditions.isTrendDown // &&
// conditions.isTrendBearish
//
;
isCond1Bearish =
//
// Start ...
(isSarBearishStart &&
!isSarBullishStart) &&
//
// SCORE ...
isScoreBearish &&
//
// BAR ...
isBarBearishPressured &&
//
// KI ...
// conditions.isKIDown &&
conditions.isKIBearish &&
//
// ATR ...
conditions.isATRDown &&
//
// TREND ...
conditions.isTrendDown // &&
// conditions.isTrendBearish
//
;
}
//
bool isCond1 =
@@ -1089,89 +949,360 @@ bool DetectSignalZone(
if (isCond1)
{
//
// Validate Some Other Requirements ...
// //
// // We Have to Detect Youngest Order Block ...
// // or Mitigation Block ...
// if (isCond1Bullish)
// {
// // //
// // // OB ...
// // idx = GetYoungest(detector.obBullishPivots);
// // has = IsValidIndex(idx);
// // if (has)
// // {
// // iOB = detector.obBullishPivots[idx];
// // }
// //
// // MT ...
// idx = GetYoungest(detector.mtBullishPivots);
// has = IsValidIndex(idx);
// if (has)
// {
// iOB = detector.mtBullishPivots[idx];
// }
// }
// else if (isCond1Bearish)
// {
// //
// // OB
// // idx = GetYoungest(detector.obBearishPivots);
// // has = IsValidIndex(idx);
// // if (has)
// // {
// // iOB = detector.obBearishPivots[idx];
// // }
// //
// // MT
// idx = GetYoungest(detector.mtBearishPivots);
// has = IsValidIndex(idx);
// if (has)
// {
// iMT = detector.mtBearishPivots[idx];
// }
// }
// //
// // Now we can Do some Verifications Using these ...
// result =
// isCond1Bullish
// ? iMT.IsBullish()
// : iMT.IsBearish();
// if (!result)
// {
// //
// isCond1Bullish = false;
// isCond1Bearish = false;
// }
//
// All Requirements based on Cond 1 ...
// Generate Direction Shift Zone ...
has = GenerateSarDirectionShiftBox(
signalZone,
helper,
conditions //
);
if (has)
{
//
iTo = signalZone.to;
iDir = signalZone.dir;
iType = signalZone.type;
iFrom = signalZone.from;
iUpper = signalZone.upper;
iLower = signalZone.lower;
}
}
// ----------------------------------
//
// Summarizing Result ...
// --------------
// Conditions 2:
// --------------
// Descriptions:
// - [] Detect Trend Direction Change ...
// - [] Check Some others Conditions based on Changed Direction ...
// - [] Generate Direction Change Zone ...
// - [] Use it to Fill Signal Zone ...
// ------------------------------------
//
bool isCond2Bullish = false;
bool isCond2Bearish = false;
if (allowSignallingConditions2)
{
//
isCond2Bullish =
//
// Start ...
(isTrendBullishStart &&
!isTrendBearishStart)
//
;
//
isCond2Bearish =
//
// Start ...
(isTrendBearishStart &&
!isTrendBullishStart)
//
;
}
//
bool isCond2 =
isCond2Bullish ||
isCond2Bearish;
if (isCond2)
{
//
// Generate Direction Shift Zone ...
has = GenerateTrendDirectionShiftBox(
signalZone,
helper,
conditions //
);
if (has)
{
//
iTo = signalZone.to;
iDir = signalZone.dir;
iType = signalZone.type;
iFrom = signalZone.from;
iUpper = signalZone.upper;
iLower = signalZone.lower;
}
}
// ------------------------------------
//
// --------------
// Conditions 3:
// --------------
// Descriptions:
// - [] Detect Delta Direction Change ...
// - [] Check Some others Conditions based on Changed Direction ...
// - [] Generate Direction Change Zone ...
// - [] Use it to Fill Signal Zone ...
// ------------------------------------
//
bool isCond3Bullish = false;
bool isCond3Bearish = false;
if (allowSignallingConditions3)
{
//
isCond3Bullish =
//
// Start ...
(isDeltaBullishStart &&
!isDeltaBearishStart)
//
;
//
isCond3Bearish =
//
// Start ...
(isDeltaBearishStart &&
!isDeltaBullishStart)
//
;
}
//
bool isCond3 =
isCond3Bullish ||
isCond3Bearish;
if (isCond3)
{
//
// Generate Direction Shift Zone ...
has = GenerateDeltaDirectionShiftBox(
signalZone,
helper,
conditions //
);
if (has)
{
//
iTo = signalZone.to;
iDir = signalZone.dir;
iType = signalZone.type;
iFrom = signalZone.from;
iUpper = signalZone.upper;
iLower = signalZone.lower;
}
}
// ------------------------------------
//
// --------------
// Conditions 4:
// --------------
// Descriptions:
// - [] Detect Volume Direction Change ...
// - [] Check Some others Conditions based on Changed Direction ...
// - [] Generate Direction Change Zone ...
// - [] Use it to Fill Signal Zone ...
// ------------------------------------
//
bool isCond4Bullish = false;
bool isCond4Bearish = false;
if (allowSignallingConditions4)
{
//
isCond4Bullish =
//
// Start ...
(isVolumeBullishStart &&
!isVolumeBearishStart)
//
;
//
isCond4Bearish =
//
// Start ...
(isVolumeBearishStart &&
!isVolumeBullishStart)
//
;
}
//
bool isCond4 =
isCond4Bullish ||
isCond4Bearish;
if (isCond4)
{
//
// Generate Direction Shift Zone ...
has = GenerateVolumeDirectionShiftBox(
signalZone,
helper,
conditions //
);
if (has)
{
//
iTo = signalZone.to;
iDir = signalZone.dir;
iType = signalZone.type;
iFrom = signalZone.from;
iUpper = signalZone.upper;
iLower = signalZone.lower;
}
}
// ------------------------------------
//
// --------------
// Conditions 5:
// --------------
// Descriptions:
// - [] Detect Signal Bar Direction Change ...
// - [] Check Some others Conditions based on Changed Direction ...
// - [] Generate Direction Change Zone ...
// - [] Use it to Fill Signal Zone ...
// ------------------------------------
//
bool isCond5Bullish = false;
bool isCond5Bearish = false;
if (allowSignallingConditions5)
{
//
isCond5Bullish =
//
// Start ...
(isSBarBullishStart &&
!isSBarBearishStart)
//
;
//
isCond5Bearish =
//
// Start ...
(isSBarBearishStart &&
!isSBarBullishStart)
//
;
}
//
bool isCond5 =
isCond5Bullish ||
isCond5Bearish;
if (isCond5)
{
//
// Generate Direction Shift Zone ...
has = GenerateSignalBarDirectionShiftBox(
signalZone,
helper,
conditions //
);
if (has)
{
//
iTo = signalZone.to;
iDir = signalZone.dir;
iType = signalZone.type;
iFrom = signalZone.from;
iUpper = signalZone.upper;
iLower = signalZone.lower;
}
}
// ------------------------------------
//
// --------------
// Conditions 6:
// --------------
// Descriptions:
// - [] Detect HK Signal Bar Direction Change ...
// - [] Check Some others Conditions based on Changed Direction ...
// - [] Generate Direction Change Zone ...
// - [] Use it to Fill Signal Zone ...
// ------------------------------------
//
bool isCond6Bullish = false;
bool isCond6Bearish = false;
if (allowSignallingConditions6)
{
//
isCond6Bullish =
//
// Start ...
(isHKSBarBullishStart &&
!isHKSBarBearishStart)
//
;
//
isCond6Bearish =
//
// Start ...
(isHKSBarBearishStart &&
!isHKSBarBullishStart)
//
;
}
//
bool isCond6 =
isCond6Bullish ||
isCond6Bearish;
if (isCond6)
{
//
// Generate Direction Shift Zone ...
has = GenerateHKSignalBarDirectionShiftBox(
signalZone,
helper,
conditions //
);
if (has)
{
//
iTo = signalZone.to;
iDir = signalZone.dir;
iType = signalZone.type;
iFrom = signalZone.from;
iUpper = signalZone.upper;
iLower = signalZone.lower;
}
}
// ------------------------------------
//
// Summarizing Signalling Results ...
//
isBullish =
//
isCond1Bullish
isCond1Bullish ||
isCond2Bullish ||
isCond3Bullish ||
isCond4Bullish ||
isCond5Bullish ||
isCond6Bullish
//
;
//
isBearish =
//
isCond1Bearish
isCond1Bearish ||
isCond2Bearish ||
isCond3Bearish ||
isCond4Bearish ||
isCond5Bearish ||
isCond6Bearish
//
;
}
//
// Summarize Result ...
result =
isBullish ||
isBearish;
@@ -1203,7 +1334,7 @@ bool DetectSignalZone(
isBullish
? clrAqua
: clrMagenta;
string iName = "Conditions_" + ToString(iDir) + "_" + ToString(((int)conditions.time));
string iName = signalZone.type + "_Conditions_" + ToString(iDir) + "_" + ToString(((int)conditions.time));
//
CChartObjectVLine *iObj = new CChartObjectVLine();
@@ -1224,11 +1355,31 @@ bool DetectSignalZone(
has = signalZone.IsValid();
if (has)
{
drawer.DrawBox(signalZone);
//
XCATBPivotStyle iStyle;
iStyle.width = 2;
iStyle.clr = isBullish
? clrYellow
: clrOrange;
iStyle.style = STYLE_SOLID;
//
XCBoxObject *iObj;
has = drawer
.drawer
.DrawBox(
signalZone,
iObj //
);
if (has)
{
drawer.ApplyPivotStyle(iObj, iStyle);
}
}
//
Print("Conditions ...");
signalZone.Clean();
}
//
@@ -1238,14 +1389,6 @@ bool DetectSignalZone(
//
// Cleanup Resources ...
//
iPeak.Clean();
iVale.Clean();
iOBBull.Clean();
iOBBear.Clean();
iMTBull.Clean();
iMTBear.Clean();
//
if (!result)
{