last ...
This commit is contained in:
@@ -27,7 +27,6 @@
|
||||
#include "../Classes/x-121.smc.market.cycle.helper.class.mq5"
|
||||
|
||||
//
|
||||
#include "../Signals/x-121.smc.xobs.signal.lib.mq5"
|
||||
#include "../Signals/x-121.smc.xsupdemobs.signal.lib.mq5"
|
||||
|
||||
//
|
||||
@@ -42,7 +41,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
public:
|
||||
//
|
||||
// Props ...
|
||||
bool useXOBSSignal;
|
||||
bool useXSupDemOBSSignal;
|
||||
|
||||
//
|
||||
@@ -104,11 +102,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
void Destroy() override
|
||||
{
|
||||
//
|
||||
Clean(mX121SMCXOBSConditionsCollection);
|
||||
Clean(mX121SMCXSupDemOBSConditionsCollection);
|
||||
|
||||
//
|
||||
ZeroMemory(mTriggerCycleHelper);
|
||||
// ZeroMemory(mTriggerCycleHelper);
|
||||
ZeroMemory(mDecisionCycleHelper);
|
||||
ZeroMemory(mAnalyseCycleHelper);
|
||||
ZeroMemory(mVerificationCycleHelper);
|
||||
@@ -116,7 +113,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
ZeroMemory(mVisionCycleHelper);
|
||||
|
||||
//
|
||||
delete mTriggerCycleHelper;
|
||||
// delete mTriggerCycleHelper;
|
||||
delete mDecisionCycleHelper;
|
||||
delete mAnalyseCycleHelper;
|
||||
delete mVerificationCycleHelper;
|
||||
@@ -204,18 +201,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
bool hasSignal = false;
|
||||
|
||||
//
|
||||
bool hasXOBSSignal = false;
|
||||
bool hasXSupDemOBSSignal = false;
|
||||
|
||||
//
|
||||
// XOBS Signal ...
|
||||
if (useXOBSSignal && !hasSignal)
|
||||
{
|
||||
//
|
||||
hasXOBSSignal = DetectXOBSSignal(conditions);
|
||||
hasSignal = hasXOBSSignal;
|
||||
}
|
||||
|
||||
//
|
||||
// XSupDemOBS Signal ...
|
||||
if (useXSupDemOBSSignal && !hasSignal)
|
||||
@@ -405,23 +392,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// XOBS Guard Detection ...
|
||||
if (useXOBSSignal)
|
||||
{
|
||||
//
|
||||
bool hasGuard = DetectX121SMCXOBSGuards(
|
||||
guards,
|
||||
positions,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// XSupDemOBS Guard Detection ...
|
||||
if (useXSupDemOBSSignal)
|
||||
@@ -430,7 +400,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
bool hasGuard = DetectX121SMCXSupDemOBSGuards(
|
||||
guards,
|
||||
positions,
|
||||
mTriggerCycleHelper,
|
||||
// mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
@@ -464,7 +434,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
// Props ...
|
||||
|
||||
//
|
||||
XC121SMCCycleHelper *mTriggerCycleHelper;
|
||||
// XC121SMCCycleHelper *mTriggerCycleHelper;
|
||||
XC121SMCCycleHelper *mDecisionCycleHelper;
|
||||
XC121SMCCycleHelper *mAnalyseCycleHelper;
|
||||
XC121SMCCycleHelper *mVerificationCycleHelper;
|
||||
@@ -477,223 +447,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
//
|
||||
// Signalling Functions ...
|
||||
|
||||
//
|
||||
// XOBS Signal ...
|
||||
bool DetectXOBSSignal(
|
||||
X121SMCStrategyConditions &conditions //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
bool isBullish = false;
|
||||
bool isBearish = false;
|
||||
|
||||
//
|
||||
int zIndex = 0;
|
||||
int cIndex = zIndex + 1;
|
||||
int pIndex = cIndex + 1;
|
||||
int ppIndex = pIndex + 1;
|
||||
|
||||
//
|
||||
string symbol = GetSymbol();
|
||||
ENUM_TIMEFRAMES period = GetPeriod();
|
||||
|
||||
//
|
||||
XOHCL zBar;
|
||||
result = zBar.Init(
|
||||
symbol,
|
||||
period,
|
||||
zIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL cBar;
|
||||
result = cBar.Init(
|
||||
symbol,
|
||||
period,
|
||||
cIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL pBar;
|
||||
result = pBar.Init(
|
||||
symbol,
|
||||
period,
|
||||
pIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double cLL = cBar.FindLowest(7, MODE_LOW);
|
||||
double cHH = cBar.FindHighest(7, MODE_HIGH);
|
||||
|
||||
//
|
||||
datetime cTime = TimeCurrent();
|
||||
|
||||
//
|
||||
ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XOBS;
|
||||
string providerStr = ToString(provider);
|
||||
|
||||
//
|
||||
// Detect Setup Conditions ...
|
||||
datetime setupTime = mX121SMCXOBSConditions.setupTime;
|
||||
bool isSetuped = mX121SMCXOBSConditions.IsSetuped();
|
||||
ENUM_X_DIRECTION setupDir = mX121SMCXOBSConditions.dir;
|
||||
if (!isSetuped)
|
||||
{
|
||||
//
|
||||
// Detect Signal Setup ...
|
||||
isSetuped = DetectX121SMCXOBSSignalSetup(
|
||||
symbol,
|
||||
period,
|
||||
mX121SMCXOBSConditions,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
|
||||
//
|
||||
setupDir = mX121SMCXOBSConditions.dir;
|
||||
setupTime = mX121SMCXOBSConditions.setupTime;
|
||||
|
||||
//
|
||||
if (isSetuped)
|
||||
{
|
||||
//
|
||||
int items = AddX121SMCXOBSConditionsIfNotExists(
|
||||
mX121SMCXOBSConditions,
|
||||
mX121SMCXOBSConditionsCollection //
|
||||
);
|
||||
|
||||
//
|
||||
mX121SMCXOBSConditions.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
int conditionsCount = ArraySize(mX121SMCXOBSConditionsCollection);
|
||||
result = IsValidSize(conditionsCount);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Looking For Conditions ...
|
||||
int selectedIndex = 0;
|
||||
X121SMCStrategyXOBSSignalConditions mTmpConditions[];
|
||||
Copy(
|
||||
mX121SMCXOBSConditionsCollection,
|
||||
mTmpConditions //
|
||||
);
|
||||
X121SMCStrategyXOBSSignalConditions mConditions;
|
||||
for (int i = 0; i < conditionsCount; i++)
|
||||
{
|
||||
//
|
||||
// Check Triggers ...
|
||||
bool canTrigger = mTmpConditions[i].CanTrigger();
|
||||
datetime triggerTime = mTmpConditions[i].triggerTime;
|
||||
if (!canTrigger)
|
||||
{
|
||||
//
|
||||
// Detect Signal Trigger ...
|
||||
canTrigger = DetectX121SMCXOBSSignalTrigger(
|
||||
mTmpConditions[i],
|
||||
symbol,
|
||||
period,
|
||||
mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
|
||||
//
|
||||
result = canTrigger;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
bool isISetuped = mTmpConditions[i].IsSetuped();
|
||||
if (!isISetuped)
|
||||
{
|
||||
//
|
||||
ArrayRemove(
|
||||
mX121SMCXOBSConditionsCollection,
|
||||
i,
|
||||
1 //
|
||||
);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
triggerTime = mTmpConditions[i].triggerTime;
|
||||
}
|
||||
|
||||
//
|
||||
if (canTrigger)
|
||||
{
|
||||
//
|
||||
selectedIndex = i;
|
||||
mConditions = mTmpConditions[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = IsValid(mConditions.setupTime) &&
|
||||
HasDirection(mConditions.dir);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Remove Selected Index from Main Collection ...
|
||||
ArrayRemove(
|
||||
mX121SMCXOBSConditionsCollection,
|
||||
selectedIndex,
|
||||
1 //
|
||||
);
|
||||
|
||||
//
|
||||
// Check Signal Direction ...
|
||||
isBullish = IsBullish(mConditions.dir);
|
||||
isBearish = IsBearish(mConditions.dir);
|
||||
result = isBullish ||
|
||||
isBearish;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Issues Signal on Conditions ...
|
||||
conditions.sl = mConditions.sl;
|
||||
conditions.provider = providerStr;
|
||||
conditions.signalDir = mConditions.dir;
|
||||
conditions.target = mConditions.target;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// XSupDemOBS Signal ...
|
||||
@@ -778,7 +531,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
symbol,
|
||||
period,
|
||||
mX121SMCXSupDemOBSConditions,
|
||||
mTriggerCycleHelper,
|
||||
// mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
@@ -835,7 +588,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
mTmpConditions[i],
|
||||
symbol,
|
||||
period,
|
||||
mTriggerCycleHelper,
|
||||
// mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
mVerificationCycleHelper,
|
||||
@@ -928,7 +681,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
void InitialHelpers()
|
||||
{
|
||||
//
|
||||
useXOBSSignal = false;
|
||||
useXSupDemOBSSignal = true;
|
||||
|
||||
//
|
||||
@@ -1049,60 +801,60 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
// Trigger Cycle ...
|
||||
mTriggerCycleHelper = new XC121SMCCycleHelper();
|
||||
isInited = mTriggerCycleHelper.Init(
|
||||
symbol,
|
||||
PERIOD_M1,
|
||||
x121Inputs,
|
||||
requiredPOIS //
|
||||
);
|
||||
if (isInited)
|
||||
{
|
||||
//
|
||||
// Configure POI Drawer ...
|
||||
color bullishColor = clrYellowGreen;
|
||||
color bearishColor = clrChocolate;
|
||||
// mTriggerCycleHelper = new XC121SMCCycleHelper();
|
||||
// isInited = mTriggerCycleHelper.Init(
|
||||
// symbol,
|
||||
// PERIOD_M1,
|
||||
// x121Inputs,
|
||||
// requiredPOIS //
|
||||
// );
|
||||
// if (isInited)
|
||||
// {
|
||||
// //
|
||||
// // Configure POI Drawer ...
|
||||
// color bullishColor = clrYellowGreen;
|
||||
// color bearishColor = clrChocolate;
|
||||
|
||||
//
|
||||
// Bars ...
|
||||
mTriggerCycleHelper.mPOIDrawer.BarBullishColor(bullishColor);
|
||||
mTriggerCycleHelper.mPOIDrawer.BarBearishColor(bearishColor);
|
||||
// //
|
||||
// // Bars ...
|
||||
// mTriggerCycleHelper.mPOIDrawer.BarBullishColor(bullishColor);
|
||||
// mTriggerCycleHelper.mPOIDrawer.BarBearishColor(bearishColor);
|
||||
|
||||
//
|
||||
// Swings ...
|
||||
mTriggerCycleHelper.mPOIDrawer.SwingLowColor(bullishColor);
|
||||
mTriggerCycleHelper.mPOIDrawer.SwingHighColor(bearishColor);
|
||||
// //
|
||||
// // Swings ...
|
||||
// mTriggerCycleHelper.mPOIDrawer.SwingLowColor(bullishColor);
|
||||
// mTriggerCycleHelper.mPOIDrawer.SwingHighColor(bearishColor);
|
||||
|
||||
//
|
||||
// Momentum ...
|
||||
mTriggerCycleHelper.mPOIDrawer.BullishMomentumBarColor(bullishColor);
|
||||
mTriggerCycleHelper.mPOIDrawer.BearishMomentumBarColor(bearishColor);
|
||||
// //
|
||||
// // Momentum ...
|
||||
// mTriggerCycleHelper.mPOIDrawer.BullishMomentumBarColor(bullishColor);
|
||||
// mTriggerCycleHelper.mPOIDrawer.BearishMomentumBarColor(bearishColor);
|
||||
|
||||
//
|
||||
// Rejection ...
|
||||
mTriggerCycleHelper.mPOIDrawer.BullishRejectionBarColor(bullishColor);
|
||||
mTriggerCycleHelper.mPOIDrawer.BearishRejectionBarColor(bearishColor);
|
||||
// //
|
||||
// // Rejection ...
|
||||
// mTriggerCycleHelper.mPOIDrawer.BullishRejectionBarColor(bullishColor);
|
||||
// mTriggerCycleHelper.mPOIDrawer.BearishRejectionBarColor(bearishColor);
|
||||
|
||||
//
|
||||
// Support and Resistance ...
|
||||
mTriggerCycleHelper.mPOIDrawer.SupportZoneColor(bullishColor);
|
||||
mTriggerCycleHelper.mPOIDrawer.ResistanceZoneColor(bearishColor);
|
||||
// //
|
||||
// // Support and Resistance ...
|
||||
// mTriggerCycleHelper.mPOIDrawer.SupportZoneColor(bullishColor);
|
||||
// mTriggerCycleHelper.mPOIDrawer.ResistanceZoneColor(bearishColor);
|
||||
|
||||
//
|
||||
// Demand and Supply ...
|
||||
mTriggerCycleHelper.mPOIDrawer.DemandZoneColor(bullishColor);
|
||||
mTriggerCycleHelper.mPOIDrawer.SupplyZoneColor(bearishColor);
|
||||
// //
|
||||
// // Demand and Supply ...
|
||||
// mTriggerCycleHelper.mPOIDrawer.DemandZoneColor(bullishColor);
|
||||
// mTriggerCycleHelper.mPOIDrawer.SupplyZoneColor(bearishColor);
|
||||
|
||||
//
|
||||
// Order Blocks ...
|
||||
mTriggerCycleHelper.mPOIDrawer.BullishOrderBlockColor(bullishColor);
|
||||
mTriggerCycleHelper.mPOIDrawer.BearishOrderBlockColor(bearishColor);
|
||||
// //
|
||||
// // Order Blocks ...
|
||||
// mTriggerCycleHelper.mPOIDrawer.BullishOrderBlockColor(bullishColor);
|
||||
// mTriggerCycleHelper.mPOIDrawer.BearishOrderBlockColor(bearishColor);
|
||||
|
||||
//
|
||||
// Fair Value Gaps ...
|
||||
mTriggerCycleHelper.mPOIDrawer.BullishFVGColor(bullishColor);
|
||||
mTriggerCycleHelper.mPOIDrawer.BearishFVGColor(bearishColor);
|
||||
}
|
||||
// //
|
||||
// // Fair Value Gaps ...
|
||||
// mTriggerCycleHelper.mPOIDrawer.BullishFVGColor(bullishColor);
|
||||
// mTriggerCycleHelper.mPOIDrawer.BearishFVGColor(bearishColor);
|
||||
// }
|
||||
|
||||
//
|
||||
// Decision Cycle ...
|
||||
|
||||
Reference in New Issue
Block a user