1214 lines
34 KiB
Plaintext
1214 lines
34 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Class Library
|
|
// --------------------------------------
|
|
// Name: XCX121SMCStrategy
|
|
// Description: provides all based classes for use ...
|
|
//
|
|
//
|
|
// Maintainer:
|
|
// ------------
|
|
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
|
//
|
|
//////////////////////////////////////////////////////
|
|
//
|
|
// Global Properties ...
|
|
#property library
|
|
#property copyright "Copyright 2023, SaherElm IT Center"
|
|
#property link "https://www.saherelm.ir"
|
|
#property version "1.00"
|
|
#property strict
|
|
|
|
//
|
|
// Imports ...
|
|
|
|
//
|
|
#include "../Classes/x-121.smc.base.strategy.class.mq5"
|
|
#include "../Classes/x-121.smc.market.cycle.helper.class.mq5"
|
|
|
|
//
|
|
#include "../Signals/x-121.smc.xwz.signal.class.mq5"
|
|
|
|
//
|
|
// Definitions ...
|
|
|
|
//
|
|
// XStrategy Class Implementation(s) ...
|
|
class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|
{
|
|
//
|
|
// Public ...
|
|
public:
|
|
//
|
|
// Props ...
|
|
bool useXWZSignal;
|
|
bool useXWZSignalGuard;
|
|
XCX121SMCXWZSignalDetector *mXWZSignalDetector;
|
|
X121SMCStrategySignalProviderData cycleProvider;
|
|
|
|
//
|
|
// Constructor(s) ...
|
|
void XCX121SMCStrategy(
|
|
//
|
|
// Base ...
|
|
string _symbol, // Trading Symbol
|
|
ENUM_TIMEFRAMES _period // Trading TimeFrame
|
|
)
|
|
: XCX121SMCBaseStrategy(_symbol, _period)
|
|
{
|
|
//
|
|
InitialHelpers();
|
|
|
|
//
|
|
mXWZSignalDetector = new XCX121SMCXWZSignalDetector(
|
|
_symbol,
|
|
_period //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Deconstructur ...
|
|
void ~XCX121SMCStrategy()
|
|
{
|
|
Destroy();
|
|
}
|
|
|
|
//
|
|
// Getter(s) / Setter(s) ...
|
|
|
|
/**
|
|
* Get Max Allowed Required POI(s) to Find ...
|
|
*
|
|
* @return ( int )
|
|
*/
|
|
int MaxAllowedRequiredPOIs()
|
|
{
|
|
return mMaxAllowedRequiredPOIs;
|
|
}
|
|
|
|
/**
|
|
* Set Max Allowed Required POI(s) to Find ...
|
|
*
|
|
* @param value: number of Required POIs
|
|
*/
|
|
void MaxAllowedRequiredPOIs(int value)
|
|
{
|
|
//
|
|
if (value < 0)
|
|
{
|
|
value = 0;
|
|
}
|
|
|
|
//
|
|
mMaxAllowedRequiredPOIs = value;
|
|
}
|
|
|
|
//
|
|
// Overrides Actions ...
|
|
|
|
/**
|
|
* Destroy All Class Implementations ...
|
|
*/
|
|
void Destroy() override
|
|
{
|
|
//
|
|
ZeroMemory(mTriggerCycleHelper);
|
|
ZeroMemory(mDecisionCycleHelper);
|
|
ZeroMemory(mAnalyseCycleHelper);
|
|
ZeroMemory(mVerificationCycleHelper);
|
|
ZeroMemory(mConsolidationCycleHelper);
|
|
ZeroMemory(mVisionCycleHelper);
|
|
|
|
//
|
|
ZeroMemory(mXWZSignalDetector);
|
|
|
|
//
|
|
cycleProvider.Destroy();
|
|
}
|
|
|
|
/**
|
|
* Check Conditions For Signal ...
|
|
*/
|
|
bool HasSignal(
|
|
XSignal &signal,
|
|
X121SMCStrategyConditions &conditions //
|
|
) override
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
signal.Clean();
|
|
conditions.Clean();
|
|
|
|
//
|
|
int pushers = 0;
|
|
|
|
//
|
|
double sl = 0;
|
|
double tp = 0;
|
|
double risk = 0;
|
|
double entry = 0;
|
|
double reward = 0;
|
|
double r2r = R2R();
|
|
string provider = "";
|
|
double volume = Volume();
|
|
ENUM_POSITION_TYPE type = POSITION_TYPE_BUY;
|
|
ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET;
|
|
|
|
//
|
|
bool hasLong = false;
|
|
bool hasShort = false;
|
|
|
|
//
|
|
double selectedSL = 0;
|
|
|
|
//
|
|
// Start Calculations ...
|
|
|
|
//
|
|
// Retrieve Common Data ...
|
|
string symbol = GetSymbol();
|
|
ENUM_TIMEFRAMES period = GetPeriod();
|
|
|
|
//
|
|
datetime cTime = TimeCurrent();
|
|
|
|
//
|
|
// Required Value For SL/TP Calculations ...
|
|
double points = GetPoints(symbol);
|
|
double pip = GetPipPrice(symbol);
|
|
double pip2 = 2 * pip;
|
|
|
|
//
|
|
conditions.time = cTime;
|
|
conditions.symbol = symbol;
|
|
conditions.period = period;
|
|
|
|
//
|
|
// Check Spread for Signalling Conditions ...
|
|
// TODO: Uncomment this ...
|
|
// bool isSpreadPassed = IsSpreadPass();
|
|
// result = isSpreadPassed;
|
|
// if (!result)
|
|
// {
|
|
// //
|
|
// conditions.Clean();
|
|
// return result;
|
|
// }
|
|
|
|
//
|
|
// Detect Signal Conditions ...
|
|
bool hasSignal = false;
|
|
|
|
//
|
|
bool hasXWZSignal = false;
|
|
|
|
//
|
|
// XSupDemOBS Signal ...
|
|
X121SMCStrategyXWZSignalConditions mXWZConditions;
|
|
if (useXWZSignal && !hasSignal)
|
|
{
|
|
//
|
|
hasXWZSignal = DetectXWZSignal(
|
|
conditions,
|
|
mXWZConditions //
|
|
);
|
|
hasSignal = hasXWZSignal;
|
|
}
|
|
|
|
//
|
|
result = hasSignal;
|
|
if (!result)
|
|
{
|
|
//
|
|
conditions.Clean();
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Combine all Signals Conditions ...
|
|
selectedSL = conditions.sl;
|
|
provider = conditions.provider;
|
|
|
|
//
|
|
hasLong =
|
|
//
|
|
IsBullish(conditions.signalDir)
|
|
//
|
|
;
|
|
|
|
//
|
|
hasShort =
|
|
//
|
|
IsBearish(conditions.signalDir)
|
|
//
|
|
;
|
|
|
|
//
|
|
result = hasLong ||
|
|
hasShort;
|
|
|
|
//
|
|
// Rmove Signal Condition ...
|
|
if (result)
|
|
{
|
|
//
|
|
// TYPE ...
|
|
type =
|
|
hasLong
|
|
? POSITION_TYPE_BUY
|
|
: POSITION_TYPE_SELL;
|
|
ENUM_X_POSITION_TYPES xType =
|
|
hasLong
|
|
? X_POSITION_TYPE_LONG
|
|
: X_POSITION_TYPE_SHORT;
|
|
|
|
//
|
|
entry = GetEntry(
|
|
conditions.symbol,
|
|
type //
|
|
);
|
|
|
|
//
|
|
double spread = GetSpread(conditions.symbol);
|
|
|
|
//
|
|
double slAddition = 0;
|
|
sl =
|
|
hasLong
|
|
? selectedSL - slAddition
|
|
: selectedSL + slAddition;
|
|
|
|
//
|
|
// RISK Reward ...
|
|
risk =
|
|
hasLong
|
|
? entry - sl
|
|
: sl - entry;
|
|
reward = risk * r2r;
|
|
tp =
|
|
hasLong
|
|
? entry + reward
|
|
: entry - reward;
|
|
|
|
//
|
|
signal.sl = sl;
|
|
signal.tp = tp;
|
|
signal.type = type;
|
|
signal.mode = mode;
|
|
signal.entry = entry;
|
|
signal.volume = volume;
|
|
signal.symbol = symbol;
|
|
signal.period = period;
|
|
signal.pushers = pushers;
|
|
signal.provider = provider;
|
|
signal.time = TimeCurrent();
|
|
|
|
//
|
|
Copy(
|
|
conditions.targets,
|
|
signal.targets //
|
|
);
|
|
|
|
//
|
|
result = PrepareSignal(signal);
|
|
|
|
//
|
|
if (result)
|
|
{
|
|
//
|
|
if (useXWZSignal &&
|
|
hasXWZSignal)
|
|
{
|
|
//
|
|
// Configuring Amount Percent and etc ...
|
|
// TODO: Enable if required ...
|
|
bool ignoreEAVolume = false &&
|
|
mXWZConditions.reward > 0 &&
|
|
mXWZConditions.amountPercent > 0;
|
|
if (ignoreEAVolume)
|
|
{
|
|
//
|
|
double cReward = mXWZConditions.reward;
|
|
double cAmountPercent = mXWZConditions.amountPercent;
|
|
|
|
//
|
|
double cRiskReward = risk * cReward;
|
|
double cTP = hasLong
|
|
? entry + cRiskReward
|
|
: entry - cRiskReward;
|
|
|
|
//
|
|
double balance = mAccount.GetBalance();
|
|
double cRiskAmount = balance * cAmountPercent / 100;
|
|
double cRiskInPoints = risk / points;
|
|
double cVolume = mAccount.CalculateVolume(
|
|
signal.symbol,
|
|
cRiskAmount,
|
|
cRiskInPoints //
|
|
);
|
|
cVolume = NormalizeVolume(cVolume, signal.symbol);
|
|
|
|
//
|
|
if (cVolume > 0)
|
|
{
|
|
//
|
|
signal.ignoreEAVolume = ignoreEAVolume;
|
|
signal.volume = cVolume;
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
// Draw Signal Oject ...
|
|
XCSignalObject *iSignalObj;
|
|
bool isCreated = mVisionCycleHelper
|
|
.mPOIDrawer
|
|
.DrawSignal(signal, iSignalObj);
|
|
if (isCreated)
|
|
{
|
|
//
|
|
mSignalDrawnObjects.Add(iSignalObj);
|
|
|
|
//
|
|
int maxAllowedDrawnSignals = 15;
|
|
int count = mSignalDrawnObjects.Total();
|
|
if (count > maxAllowedDrawnSignals)
|
|
{
|
|
//
|
|
int to = count - maxAllowedDrawnSignals;
|
|
mSignalDrawnObjects.DeleteRange(
|
|
0,
|
|
to //
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
// Apply Spread on Signal's TP ...
|
|
signal.tp =
|
|
hasLong
|
|
? signal.tp + spread
|
|
: signal.tp - spread;
|
|
|
|
//
|
|
hasLong = false;
|
|
hasShort = false;
|
|
}
|
|
|
|
//
|
|
mXWZConditions.Clean();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Check for any Guard Actions ...
|
|
*/
|
|
bool CheckGuard(
|
|
X121SMCGuard &guards[],
|
|
const XPosition &positions[] //
|
|
) override
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
Clean(guards);
|
|
|
|
//
|
|
int count = ArraySize(positions);
|
|
result = IsValidSize(count);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XWZ Guard Detection ...
|
|
if (useXWZSignal &&
|
|
useXWZSignalGuard)
|
|
{
|
|
//
|
|
X121SMCGuard xwzGuards[];
|
|
bool hasGuard = mXWZSignalDetector.DetectGuards(
|
|
xwzGuards,
|
|
positions,
|
|
cycleProvider //
|
|
);
|
|
|
|
//
|
|
if (hasGuard)
|
|
{
|
|
//
|
|
Copy(
|
|
xwzGuards,
|
|
guards,
|
|
false //
|
|
);
|
|
}
|
|
|
|
//
|
|
Clean(xwzGuards);
|
|
}
|
|
|
|
//
|
|
count = ArraySize(guards);
|
|
result = IsValidSize(count);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Update all Requirements without waiting ...
|
|
*/
|
|
void DoUnwaitedTicksWork() override
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Customize Strategy Identifier ...
|
|
*/
|
|
string GetTag() override
|
|
{
|
|
return X121SMCStrategyToken;
|
|
}
|
|
|
|
//
|
|
// Protected ...
|
|
protected:
|
|
//
|
|
|
|
//
|
|
// Props ...
|
|
CArrayObj mSignalDrawnObjects;
|
|
|
|
//
|
|
// XC121SMCCycleHelper *mTriggerCycleHelper;
|
|
XC121SMCCycleHelper *mTriggerCycleHelper;
|
|
XC121SMCCycleHelper *mDecisionCycleHelper;
|
|
XC121SMCCycleHelper *mAnalyseCycleHelper;
|
|
XC121SMCCycleHelper *mVerificationCycleHelper;
|
|
XC121SMCCycleHelper *mConsolidationCycleHelper;
|
|
XC121SMCCycleHelper *mVisionCycleHelper;
|
|
|
|
//
|
|
// Actions ...
|
|
|
|
//
|
|
// Signalling Functions ...
|
|
|
|
//
|
|
// XWZ Signal ...
|
|
bool DetectXWZSignal(
|
|
X121SMCStrategyConditions &conditions,
|
|
X121SMCStrategyXWZSignalConditions &xWZConditions //
|
|
)
|
|
{
|
|
//
|
|
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();
|
|
|
|
//
|
|
datetime cTime = TimeCurrent();
|
|
|
|
//
|
|
ENUM_X_121_SMC_PROVIDERS provider = X_121_SMC_PROVIDER_XWZ;
|
|
string providerStr = ToString(provider);
|
|
|
|
//
|
|
// Detect Setup Conditions ...
|
|
datetime setupTime = mXWZSignalDetector.mConditions.setupTime;
|
|
bool isSetuped = mXWZSignalDetector.mConditions.IsSetuped();
|
|
ENUM_X_DIRECTION setupDir = mXWZSignalDetector.mConditions.dir;
|
|
if (!isSetuped)
|
|
{
|
|
//
|
|
// Detect Signal Setup ...
|
|
isSetuped = mXWZSignalDetector.DetectSignalSetup(
|
|
cycleProvider //
|
|
);
|
|
|
|
//
|
|
setupDir = mXWZSignalDetector.mConditions.dir;
|
|
setupTime = mXWZSignalDetector.mConditions.setupTime;
|
|
|
|
//
|
|
if (isSetuped)
|
|
{
|
|
//
|
|
int items = mXWZSignalDetector
|
|
.AddConditionsIfNotExists();
|
|
|
|
//
|
|
mXWZSignalDetector.mConditions.Clean();
|
|
}
|
|
}
|
|
|
|
//
|
|
int conditionsCount = ArraySize(mXWZSignalDetector.mConditionsCollection);
|
|
result = IsValidSize(conditionsCount);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Looking For Conditions ...
|
|
int selectedIndex = 0;
|
|
X121SMCStrategyXWZSignalConditions mTmpConditions[];
|
|
Copy(
|
|
mXWZSignalDetector.mConditionsCollection,
|
|
mTmpConditions //
|
|
);
|
|
X121SMCStrategyXWZSignalConditions 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 = mXWZSignalDetector
|
|
.DetectSignalTrigger(
|
|
mTmpConditions[i],
|
|
cycleProvider //
|
|
);
|
|
|
|
//
|
|
result = canTrigger;
|
|
if (!result)
|
|
{
|
|
//
|
|
bool isISetuped = mTmpConditions[i].IsSetuped();
|
|
if (!isISetuped)
|
|
{
|
|
//
|
|
ArrayRemove(
|
|
mXWZSignalDetector.mConditionsCollection,
|
|
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(
|
|
mXWZSignalDetector.mConditionsCollection,
|
|
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;
|
|
|
|
//
|
|
Copy(
|
|
mConditions.targets,
|
|
conditions.targets //
|
|
);
|
|
|
|
//
|
|
xWZConditions = mConditions;
|
|
|
|
//
|
|
mConditions.Clean();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Private ...
|
|
private:
|
|
//
|
|
// Props ...
|
|
|
|
//
|
|
int mMaxAllowedRequiredPOIs; // Max Allowed Required POI(s) to Find ...
|
|
|
|
/**
|
|
* Initial Required Indicators Helper ...
|
|
*/
|
|
void InitialHelpers()
|
|
{
|
|
//
|
|
useXWZSignal = true;
|
|
useXWZSignalGuard = false;
|
|
|
|
//
|
|
string symbol = GetSymbol();
|
|
ENUM_TIMEFRAMES period = GetPeriod();
|
|
|
|
//
|
|
if (mMaxAllowedRequiredPOIs <= 0)
|
|
{
|
|
mMaxAllowedRequiredPOIs = 0;
|
|
}
|
|
|
|
//
|
|
// Short ...
|
|
ENUM_X_PERIOD_METHOD scMethod = X_PERIOD_AUTO; // How to Find Period
|
|
ENUM_TIMEFRAMES scPeriod = NULL; // Time Period
|
|
|
|
//
|
|
// Medium ...
|
|
ENUM_X_PERIOD_METHOD mcMethod = X_PERIOD_AUTO; // How to Find Period
|
|
ENUM_TIMEFRAMES mcPeriod = NULL; // Time Period
|
|
|
|
//
|
|
// Long ...
|
|
ENUM_X_PERIOD_METHOD lcMethod = X_PERIOD_AUTO; // How to Find Period
|
|
ENUM_TIMEFRAMES lcPeriod = NULL; // Time Period
|
|
|
|
//
|
|
// Hind ...
|
|
ENUM_X_PERIOD_METHOD hcMethod = X_PERIOD_AUTO; // How to Find Period
|
|
ENUM_TIMEFRAMES hcPeriod = NULL; // Time Period
|
|
|
|
//
|
|
// XPV ...
|
|
X121Inputs x121Inputs;
|
|
|
|
//
|
|
x121Inputs.Default();
|
|
|
|
//
|
|
bool showAll = false;
|
|
|
|
//
|
|
x121Inputs.showRSI = showAll || false;
|
|
|
|
//
|
|
// XPV ...
|
|
|
|
//
|
|
x121Inputs.xpvInputs.scMethod = scMethod;
|
|
x121Inputs.xpvInputs.scPeriod = scPeriod;
|
|
x121Inputs.xpvInputs.mcMethod = mcMethod;
|
|
x121Inputs.xpvInputs.mcPeriod = mcPeriod;
|
|
x121Inputs.xpvInputs.lcMethod = lcMethod;
|
|
x121Inputs.xpvInputs.lcPeriod = lcPeriod;
|
|
x121Inputs.xpvInputs.hcMethod = hcMethod;
|
|
x121Inputs.xpvInputs.hcPeriod = hcPeriod;
|
|
|
|
//
|
|
x121Inputs.xhkInputs.xhkIgnoreSmoothingShadows = true;
|
|
|
|
//
|
|
x121Inputs.xatrInputs.atrMultiplier = 1.5;
|
|
x121Inputs.xatrInputs.atrSmoothingMode = X_MA_MODE_NONE;
|
|
x121Inputs.xpvInputs.goldenZoneLevel = X_FIBO_LEVEL_236;
|
|
|
|
//
|
|
x121Inputs.xvwapInputs.vwapFastLength = 20;
|
|
x121Inputs.xvwapInputs.vwapMidLength = 50;
|
|
x121Inputs.xvwapInputs.vwapSlowLength = 200;
|
|
|
|
//
|
|
x121Inputs.x3maInputs.x3maFastMALength = 20;
|
|
x121Inputs.x3maInputs.x3maMidMALength = 50;
|
|
x121Inputs.x3maInputs.x3maSlowMALength = 200;
|
|
|
|
//
|
|
// x121Inputs.xccInputs.upColor = clrLime;
|
|
// x121Inputs.xccInputs.downColor = clrRed;
|
|
// x121Inputs.xccInputs.lineColor = CLR_NONE;
|
|
// x121Inputs.xccInputs.bearishColor = clrRed;
|
|
// x121Inputs.xccInputs.bullishColor = clrLime;
|
|
// x121Inputs.xccInputs.volumesColor = clrGreen;
|
|
|
|
//
|
|
//
|
|
//
|
|
|
|
//
|
|
// XCC ...
|
|
x121Inputs.xccInputs.showCandles = showAll || true;
|
|
|
|
//
|
|
// XPV ...
|
|
x121Inputs.xpvInputs.showSar = showAll || false;
|
|
x121Inputs.xpvInputs.showPeaks = showAll || false;
|
|
x121Inputs.xpvInputs.showVales = showAll || false;
|
|
x121Inputs.xpvInputs.showSupports = showAll || false;
|
|
x121Inputs.xpvInputs.showResistances = showAll || false;
|
|
x121Inputs.xpvInputs.showGoldenZones = showAll || false;
|
|
|
|
//
|
|
// XHK ...
|
|
|
|
//
|
|
x121Inputs.xhkInputs.drawRawXHKCandles = showAll || false;
|
|
x121Inputs.xhkInputs.drawSmoothedXHKCandles = showAll || false;
|
|
|
|
//
|
|
// XMAS ...
|
|
|
|
//
|
|
x121Inputs.xmasInputs.showUpper = showAll || false;
|
|
x121Inputs.xmasInputs.showMid = showAll || false;
|
|
x121Inputs.xmasInputs.showLower = showAll || false;
|
|
|
|
//
|
|
// XATR ...
|
|
x121Inputs.xatrInputs.showATRUpper = showAll || false;
|
|
x121Inputs.xatrInputs.showATRLower = showAll || false;
|
|
|
|
//
|
|
// XSTR ...
|
|
x121Inputs.xstrInputs.showStr = showAll || false;
|
|
x121Inputs.xstrInputs.showStrUpper = showAll || false;
|
|
x121Inputs.xstrInputs.showStrLower = showAll || false;
|
|
|
|
//
|
|
// XCHE ...
|
|
x121Inputs.xcheInputs.showLE1 = showAll || false;
|
|
x121Inputs.xcheInputs.showLE2 = showAll || false;
|
|
x121Inputs.xcheInputs.showSE1 = showAll || false;
|
|
x121Inputs.xcheInputs.showSE2 = showAll || false;
|
|
|
|
//
|
|
// XDON ...
|
|
x121Inputs.xdonInputs.showOpen = showAll || false;
|
|
x121Inputs.xdonInputs.showClose = showAll || false;
|
|
x121Inputs.xdonInputs.showLow = showAll || false;
|
|
x121Inputs.xdonInputs.showHigh = showAll || false;
|
|
|
|
//
|
|
// XVWAP ...
|
|
x121Inputs.xvwapInputs.showVWapFast = showAll || false;
|
|
x121Inputs.xvwapInputs.showVWapMedium = showAll || false;
|
|
x121Inputs.xvwapInputs.showVWapSlow = showAll || false;
|
|
|
|
//
|
|
// X3MA ...
|
|
x121Inputs.x3maInputs.showX3MaFast = showAll || true;
|
|
x121Inputs.x3maInputs.showX3MaMid = showAll || true;
|
|
x121Inputs.x3maInputs.showX3MaSlow = showAll || true;
|
|
|
|
//
|
|
// Initialize Cycle Helpers ...
|
|
|
|
//
|
|
bool isInited = false;
|
|
|
|
//
|
|
int requiredPOIS = MaxAllowedRequiredPOIs();
|
|
|
|
//
|
|
// Trigger Cycle ...
|
|
mTriggerCycleHelper = new XC121SMCCycleHelper();
|
|
isInited = mTriggerCycleHelper.Init(
|
|
symbol,
|
|
PERIOD_M1,
|
|
x121Inputs,
|
|
requiredPOIS //
|
|
);
|
|
if (isInited)
|
|
{
|
|
//
|
|
// Configure POI Drawer ...
|
|
color bullishColor = clrDodgerBlue;
|
|
color bearishColor = clrSienna;
|
|
|
|
//
|
|
// Bars ...
|
|
mTriggerCycleHelper.mPOIDrawer.BarBullishColor(bullishColor);
|
|
mTriggerCycleHelper.mPOIDrawer.BarBearishColor(bearishColor);
|
|
|
|
//
|
|
// Swings ...
|
|
mTriggerCycleHelper.mPOIDrawer.SwingLowColor(bullishColor);
|
|
mTriggerCycleHelper.mPOIDrawer.SwingHighColor(bearishColor);
|
|
|
|
//
|
|
// Momentum ...
|
|
mTriggerCycleHelper.mPOIDrawer.BullishMomentumBarColor(bullishColor);
|
|
mTriggerCycleHelper.mPOIDrawer.BearishMomentumBarColor(bearishColor);
|
|
|
|
//
|
|
// Rejection ...
|
|
mTriggerCycleHelper.mPOIDrawer.BullishRejectionBarColor(bullishColor);
|
|
mTriggerCycleHelper.mPOIDrawer.BearishRejectionBarColor(bearishColor);
|
|
|
|
//
|
|
// Support and Resistance ...
|
|
mTriggerCycleHelper.mPOIDrawer.SupportZoneColor(bullishColor);
|
|
mTriggerCycleHelper.mPOIDrawer.ResistanceZoneColor(bearishColor);
|
|
|
|
//
|
|
// Demand and Supply ...
|
|
mTriggerCycleHelper.mPOIDrawer.DemandZoneColor(bullishColor);
|
|
mTriggerCycleHelper.mPOIDrawer.SupplyZoneColor(bearishColor);
|
|
|
|
//
|
|
// Order Blocks ...
|
|
mTriggerCycleHelper.mPOIDrawer.BullishOrderBlockColor(bullishColor);
|
|
mTriggerCycleHelper.mPOIDrawer.BearishOrderBlockColor(bearishColor);
|
|
|
|
//
|
|
// Fair Value Gaps ...
|
|
mTriggerCycleHelper.mPOIDrawer.BullishFVGColor(bullishColor);
|
|
mTriggerCycleHelper.mPOIDrawer.BearishFVGColor(bearishColor);
|
|
}
|
|
|
|
//
|
|
// Decision Cycle ...
|
|
mDecisionCycleHelper = new XC121SMCCycleHelper();
|
|
isInited = mDecisionCycleHelper.Init(
|
|
symbol,
|
|
PERIOD_M5,
|
|
x121Inputs,
|
|
requiredPOIS //
|
|
);
|
|
if (isInited)
|
|
{
|
|
//
|
|
// Configure POI Drawer ...
|
|
color bullishColor = clrDodgerBlue;
|
|
color bearishColor = clrSienna;
|
|
|
|
//
|
|
// Bars ...
|
|
mDecisionCycleHelper.mPOIDrawer.BarBullishColor(bullishColor);
|
|
mDecisionCycleHelper.mPOIDrawer.BarBearishColor(bearishColor);
|
|
|
|
//
|
|
// Swings ...
|
|
mDecisionCycleHelper.mPOIDrawer.SwingLowColor(bullishColor);
|
|
mDecisionCycleHelper.mPOIDrawer.SwingHighColor(bearishColor);
|
|
|
|
//
|
|
// Momentum ...
|
|
mDecisionCycleHelper.mPOIDrawer.BullishMomentumBarColor(bullishColor);
|
|
mDecisionCycleHelper.mPOIDrawer.BearishMomentumBarColor(bearishColor);
|
|
|
|
//
|
|
// Rejection ...
|
|
mDecisionCycleHelper.mPOIDrawer.BullishRejectionBarColor(bullishColor);
|
|
mDecisionCycleHelper.mPOIDrawer.BearishRejectionBarColor(bearishColor);
|
|
|
|
//
|
|
// Support and Resistance ...
|
|
mDecisionCycleHelper.mPOIDrawer.SupportZoneColor(bullishColor);
|
|
mDecisionCycleHelper.mPOIDrawer.ResistanceZoneColor(bearishColor);
|
|
|
|
//
|
|
// Demand and Supply ...
|
|
mDecisionCycleHelper.mPOIDrawer.DemandZoneColor(bullishColor);
|
|
mDecisionCycleHelper.mPOIDrawer.SupplyZoneColor(bearishColor);
|
|
|
|
//
|
|
// Order Blocks ...
|
|
mDecisionCycleHelper.mPOIDrawer.BullishOrderBlockColor(bullishColor);
|
|
mDecisionCycleHelper.mPOIDrawer.BearishOrderBlockColor(bearishColor);
|
|
|
|
//
|
|
// Fair Value Gaps ...
|
|
mDecisionCycleHelper.mPOIDrawer.BullishFVGColor(bullishColor);
|
|
mDecisionCycleHelper.mPOIDrawer.BearishFVGColor(bearishColor);
|
|
}
|
|
|
|
//
|
|
// Analyse Cycle ...
|
|
mAnalyseCycleHelper = new XC121SMCCycleHelper();
|
|
isInited = mAnalyseCycleHelper.Init(
|
|
symbol,
|
|
PERIOD_M15,
|
|
x121Inputs,
|
|
requiredPOIS //
|
|
);
|
|
if (isInited)
|
|
{
|
|
//
|
|
// Configure POI Drawer ...
|
|
color bullishColor = clrMediumSeaGreen;
|
|
color bearishColor = clrBlueViolet;
|
|
|
|
//
|
|
// Bars ...
|
|
mAnalyseCycleHelper.mPOIDrawer.BarBullishColor(bullishColor);
|
|
mAnalyseCycleHelper.mPOIDrawer.BarBearishColor(bearishColor);
|
|
|
|
//
|
|
// Swings ...
|
|
mAnalyseCycleHelper.mPOIDrawer.SwingLowColor(bullishColor);
|
|
mAnalyseCycleHelper.mPOIDrawer.SwingHighColor(bearishColor);
|
|
|
|
//
|
|
// Momentum ...
|
|
mAnalyseCycleHelper.mPOIDrawer.BullishMomentumBarColor(bullishColor);
|
|
mAnalyseCycleHelper.mPOIDrawer.BearishMomentumBarColor(bearishColor);
|
|
|
|
//
|
|
// Rejection ...
|
|
mAnalyseCycleHelper.mPOIDrawer.BullishRejectionBarColor(bullishColor);
|
|
mAnalyseCycleHelper.mPOIDrawer.BearishRejectionBarColor(bearishColor);
|
|
|
|
//
|
|
// Support and Resistance ...
|
|
mAnalyseCycleHelper.mPOIDrawer.SupportZoneColor(bullishColor);
|
|
mAnalyseCycleHelper.mPOIDrawer.ResistanceZoneColor(bearishColor);
|
|
|
|
//
|
|
// Demand and Supply ...
|
|
mAnalyseCycleHelper.mPOIDrawer.DemandZoneColor(bullishColor);
|
|
mAnalyseCycleHelper.mPOIDrawer.SupplyZoneColor(bearishColor);
|
|
|
|
//
|
|
// Order Blocks ...
|
|
mAnalyseCycleHelper.mPOIDrawer.BullishOrderBlockColor(bullishColor);
|
|
mAnalyseCycleHelper.mPOIDrawer.BearishOrderBlockColor(bearishColor);
|
|
|
|
//
|
|
// Fair Value Gaps ...
|
|
mAnalyseCycleHelper.mPOIDrawer.BullishFVGColor(bullishColor);
|
|
mAnalyseCycleHelper.mPOIDrawer.BearishFVGColor(bearishColor);
|
|
}
|
|
|
|
//
|
|
// Verification Cycle ...
|
|
mVerificationCycleHelper = new XC121SMCCycleHelper();
|
|
isInited = mVerificationCycleHelper.Init(
|
|
symbol,
|
|
PERIOD_M30,
|
|
x121Inputs,
|
|
requiredPOIS //
|
|
);
|
|
if (isInited)
|
|
{
|
|
//
|
|
// Configure POI Drawer ...
|
|
color bullishColor = clrDodgerBlue;
|
|
color bearishColor = clrSienna;
|
|
|
|
//
|
|
// Bars ...
|
|
mVerificationCycleHelper.mPOIDrawer.BarBullishColor(bullishColor);
|
|
mVerificationCycleHelper.mPOIDrawer.BarBearishColor(bearishColor);
|
|
|
|
//
|
|
// Swings ...
|
|
mVerificationCycleHelper.mPOIDrawer.SwingLowColor(bullishColor);
|
|
mVerificationCycleHelper.mPOIDrawer.SwingHighColor(bearishColor);
|
|
|
|
//
|
|
// Momentum ...
|
|
mVerificationCycleHelper.mPOIDrawer.BullishMomentumBarColor(bullishColor);
|
|
mVerificationCycleHelper.mPOIDrawer.BearishMomentumBarColor(bearishColor);
|
|
|
|
//
|
|
// Rejection ...
|
|
mVerificationCycleHelper.mPOIDrawer.BullishRejectionBarColor(bullishColor);
|
|
mVerificationCycleHelper.mPOIDrawer.BearishRejectionBarColor(bearishColor);
|
|
|
|
//
|
|
// Support and Resistance ...
|
|
mVerificationCycleHelper.mPOIDrawer.SupportZoneColor(bullishColor);
|
|
mVerificationCycleHelper.mPOIDrawer.ResistanceZoneColor(bearishColor);
|
|
|
|
//
|
|
// Demand and Supply ...
|
|
mVerificationCycleHelper.mPOIDrawer.DemandZoneColor(bullishColor);
|
|
mVerificationCycleHelper.mPOIDrawer.SupplyZoneColor(bearishColor);
|
|
|
|
//
|
|
// Order Blocks ...
|
|
mVerificationCycleHelper.mPOIDrawer.BullishOrderBlockColor(bullishColor);
|
|
mVerificationCycleHelper.mPOIDrawer.BearishOrderBlockColor(bearishColor);
|
|
|
|
//
|
|
// Fair Value Gaps ...
|
|
mVerificationCycleHelper.mPOIDrawer.BullishFVGColor(bullishColor);
|
|
mVerificationCycleHelper.mPOIDrawer.BearishFVGColor(bearishColor);
|
|
}
|
|
|
|
//
|
|
// Consolidation Cycle ...
|
|
mConsolidationCycleHelper = new XC121SMCCycleHelper();
|
|
isInited = mConsolidationCycleHelper.Init(
|
|
symbol,
|
|
PERIOD_H1,
|
|
x121Inputs,
|
|
requiredPOIS //
|
|
);
|
|
if (isInited)
|
|
{
|
|
//
|
|
// Configure POI Drawer ...
|
|
color bullishColor = clrLime;
|
|
color bearishColor = clrRed;
|
|
|
|
//
|
|
// Bars ...
|
|
mConsolidationCycleHelper.mPOIDrawer.BarBullishColor(bullishColor);
|
|
mConsolidationCycleHelper.mPOIDrawer.BarBearishColor(bearishColor);
|
|
|
|
//
|
|
// Swings ...
|
|
mConsolidationCycleHelper.mPOIDrawer.SwingLowColor(bullishColor);
|
|
mConsolidationCycleHelper.mPOIDrawer.SwingHighColor(bearishColor);
|
|
|
|
//
|
|
// Momentum ...
|
|
mConsolidationCycleHelper.mPOIDrawer.BullishMomentumBarColor(bullishColor);
|
|
mConsolidationCycleHelper.mPOIDrawer.BearishMomentumBarColor(bearishColor);
|
|
|
|
//
|
|
// Rejection ...
|
|
mConsolidationCycleHelper.mPOIDrawer.BullishRejectionBarColor(bullishColor);
|
|
mConsolidationCycleHelper.mPOIDrawer.BearishRejectionBarColor(bearishColor);
|
|
|
|
//
|
|
// Support and Resistance ...
|
|
mConsolidationCycleHelper.mPOIDrawer.SupportZoneColor(bullishColor);
|
|
mConsolidationCycleHelper.mPOIDrawer.ResistanceZoneColor(bearishColor);
|
|
|
|
//
|
|
// Demand and Supply ...
|
|
mConsolidationCycleHelper.mPOIDrawer.DemandZoneColor(bullishColor);
|
|
mConsolidationCycleHelper.mPOIDrawer.SupplyZoneColor(bearishColor);
|
|
|
|
//
|
|
// Order Blocks ...
|
|
mConsolidationCycleHelper.mPOIDrawer.BullishOrderBlockColor(bullishColor);
|
|
mConsolidationCycleHelper.mPOIDrawer.BearishOrderBlockColor(bearishColor);
|
|
|
|
//
|
|
// Fair Value Gaps ...
|
|
mConsolidationCycleHelper.mPOIDrawer.BullishFVGColor(bullishColor);
|
|
mConsolidationCycleHelper.mPOIDrawer.BearishFVGColor(bearishColor);
|
|
}
|
|
|
|
//
|
|
// Vision Cycle ...
|
|
mVisionCycleHelper = new XC121SMCCycleHelper();
|
|
isInited = mVisionCycleHelper.Init(
|
|
symbol,
|
|
PERIOD_H4,
|
|
x121Inputs,
|
|
requiredPOIS //
|
|
);
|
|
if (isInited)
|
|
{
|
|
//
|
|
// Configure POI Drawer ...
|
|
color bullishColor = clrAqua;
|
|
color bearishColor = clrMagenta;
|
|
|
|
//
|
|
// Bars ...
|
|
mVisionCycleHelper.mPOIDrawer.BarBullishColor(bullishColor);
|
|
mVisionCycleHelper.mPOIDrawer.BarBearishColor(bearishColor);
|
|
|
|
//
|
|
// Swings ...
|
|
mVisionCycleHelper.mPOIDrawer.SwingLowColor(bullishColor);
|
|
mVisionCycleHelper.mPOIDrawer.SwingHighColor(bearishColor);
|
|
|
|
//
|
|
// Momentum ...
|
|
mVisionCycleHelper.mPOIDrawer.BullishMomentumBarColor(bullishColor);
|
|
mVisionCycleHelper.mPOIDrawer.BearishMomentumBarColor(bearishColor);
|
|
|
|
//
|
|
// Rejection ...
|
|
mVisionCycleHelper.mPOIDrawer.BullishRejectionBarColor(bullishColor);
|
|
mVisionCycleHelper.mPOIDrawer.BearishRejectionBarColor(bearishColor);
|
|
|
|
//
|
|
// Support and Resistance ...
|
|
mVisionCycleHelper.mPOIDrawer.SupportZoneColor(bullishColor);
|
|
mVisionCycleHelper.mPOIDrawer.ResistanceZoneColor(bearishColor);
|
|
|
|
//
|
|
// Demand and Supply ...
|
|
mVisionCycleHelper.mPOIDrawer.DemandZoneColor(bullishColor);
|
|
mVisionCycleHelper.mPOIDrawer.SupplyZoneColor(bearishColor);
|
|
|
|
//
|
|
// Order Blocks ...
|
|
mVisionCycleHelper.mPOIDrawer.BullishOrderBlockColor(bullishColor);
|
|
mVisionCycleHelper.mPOIDrawer.BearishOrderBlockColor(bearishColor);
|
|
|
|
//
|
|
// Fair Value Gaps ...
|
|
mVisionCycleHelper.mPOIDrawer.BullishFVGColor(bullishColor);
|
|
mVisionCycleHelper.mPOIDrawer.BearishFVGColor(bearishColor);
|
|
}
|
|
|
|
//
|
|
// Initial Cycle Provider ...
|
|
cycleProvider.Init(
|
|
mTriggerCycleHelper,
|
|
mDecisionCycleHelper,
|
|
mAnalyseCycleHelper,
|
|
mVerificationCycleHelper,
|
|
mConsolidationCycleHelper,
|
|
mVisionCycleHelper //
|
|
);
|
|
}
|
|
|
|
//
|
|
};
|
|
|
|
// |