Last Works on Validating Order Blocks ...
This commit is contained in:
@@ -0,0 +1,218 @@
|
|||||||
|
//
|
||||||
|
double cPZoneUpper = 0;
|
||||||
|
double cPZoneLower = 0;
|
||||||
|
datetime cPZoneFrom = NULL;
|
||||||
|
datetime cPZoneTo = NULL;
|
||||||
|
result = consolidationPriceZone.GetBoxData(
|
||||||
|
X_DIRECTION_ALL,
|
||||||
|
cPZoneUpper,
|
||||||
|
cPZoneLower,
|
||||||
|
cPZoneFrom,
|
||||||
|
cPZoneTo //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double aPZoneUpper = 0;
|
||||||
|
double aPZoneLower = 0;
|
||||||
|
datetime aPZoneFrom = NULL;
|
||||||
|
datetime aPZoneTo = NULL;
|
||||||
|
result = analysePriceZone.GetBoxData(
|
||||||
|
X_DIRECTION_ALL,
|
||||||
|
aPZoneUpper,
|
||||||
|
aPZoneLower,
|
||||||
|
aPZoneFrom,
|
||||||
|
aPZoneTo //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// RSI ...
|
||||||
|
double rsi = decisionConditions.x121Conditions.rsiBuffer[1];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isRSIOverBought = decisionConditions.x121Conditions.isRSIOverBought;
|
||||||
|
bool isRSICrossedOverOverBought = decisionConditions.x121Conditions.isRSICrossedOverOverBought;
|
||||||
|
bool isRSICrossedUnderOverBought = decisionConditions.x121Conditions.isRSICrossedUnderOverBought;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isRSIOverSold = decisionConditions.x121Conditions.isRSIOverSold;
|
||||||
|
bool isRSICrossedOverOverSold = decisionConditions.x121Conditions.isRSICrossedOverOverSold;
|
||||||
|
bool isRSICrossedUnderOverSold = decisionConditions.x121Conditions.isRSICrossedUnderOverSold;
|
||||||
|
|
||||||
|
//
|
||||||
|
// PV ...
|
||||||
|
double peak = decisionConditions.x121Conditions.peaksBuffer[1];
|
||||||
|
double vale = decisionConditions.x121Conditions.valesBuffer[1];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isNewPeak = decisionConditions.x121Conditions.isNewPeak;
|
||||||
|
bool isNewPeakOverLast = decisionConditions.x121Conditions.isNewPeakOverLast;
|
||||||
|
bool isNewPeakUnderLast = decisionConditions.x121Conditions.isNewPeakUnderLast;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isNewVale = decisionConditions.x121Conditions.isNewVale;
|
||||||
|
bool isNewValeOverLast = decisionConditions.x121Conditions.isNewValeOverLast;
|
||||||
|
bool isNewValeUnderLast = decisionConditions.x121Conditions.isNewValeUnderLast;
|
||||||
|
|
||||||
|
//
|
||||||
|
// STR ...
|
||||||
|
double str = decisionConditions.x121Conditions.strBuffer[1];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isStrBullish = decisionConditions.x121Conditions.isStrBullish;
|
||||||
|
bool isStrBearish = decisionConditions.x121Conditions.isStrBearish;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isStrSwitchedToBullish = decisionConditions.x121Conditions.isStrSwitchedToBullish;
|
||||||
|
bool isStrSwitchedToBearish = decisionConditions.x121Conditions.isStrSwitchedToBearish;
|
||||||
|
|
||||||
|
//
|
||||||
|
// ATR ...
|
||||||
|
double atr = decisionConditions.x121Conditions.atrBuffer[1];
|
||||||
|
double atrUpper = decisionConditions.x121Conditions.atrUpperBuffer[1];
|
||||||
|
double atrLower = decisionConditions.x121Conditions.atrLowerBuffer[1];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCloseOverATRUpper = decisionConditions.x121Conditions.isCloseOverATRUpper;
|
||||||
|
bool isCloseOverATRLower = decisionConditions.x121Conditions.isCloseOverATRLower;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCloseUnderATRUpper = decisionConditions.x121Conditions.isCloseUnderATRUpper;
|
||||||
|
bool isCloseUnderATRLower = decisionConditions.x121Conditions.isCloseUnderATRLower;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isRejectUpATRUpper = decisionConditions.x121Conditions.isRejectUpATRUpper;
|
||||||
|
bool isRejectDownATRUpper = decisionConditions.x121Conditions.isRejectDownATRUpper;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isRejectUpATRLower = decisionConditions.x121Conditions.isRejectUpATRLower;
|
||||||
|
bool isRejectDownATRLower = decisionConditions.x121Conditions.isRejectDownATRLower;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBreakUpATRUpper = decisionConditions.x121Conditions.isBreakUpATRUpper;
|
||||||
|
bool isBreakDownATRUpper = decisionConditions.x121Conditions.isBreakDownATRUpper;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBreakUpATRLower = decisionConditions.x121Conditions.isBreakUpATRLower;
|
||||||
|
bool isBreakDownATRLower = decisionConditions.x121Conditions.isBreakDownATRLower;
|
||||||
|
|
||||||
|
//
|
||||||
|
// SAR ...
|
||||||
|
double sar = decisionConditions.x121Conditions.sarBuffer[1];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSarBullish = decisionConditions.x121Conditions.isSarBullish;
|
||||||
|
bool isSarBearish = decisionConditions.x121Conditions.isSarBearish;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSarSwitchedToBullish = decisionConditions.x121Conditions.isSarSwitchedToBullish;
|
||||||
|
bool isSarSwitchedToBearish = decisionConditions.x121Conditions.isSarSwitchedToBearish;
|
||||||
|
|
||||||
|
//
|
||||||
|
// DON ...
|
||||||
|
|
||||||
|
//
|
||||||
|
double donOpenUpper = decisionConditions.x121Conditions.donOpenUpperBuffer[1];
|
||||||
|
double donOpenLower = decisionConditions.x121Conditions.donOpenLowerBuffer[1];
|
||||||
|
double donHighUpper = decisionConditions.x121Conditions.donHighUpperBuffer[1];
|
||||||
|
double donHighLower = decisionConditions.x121Conditions.donHighLowerBuffer[1];
|
||||||
|
double donLowUpper = decisionConditions.x121Conditions.donLowUpperBuffer[1];
|
||||||
|
double donLowLower = decisionConditions.x121Conditions.donLowLowerBuffer[1];
|
||||||
|
double donCloseUpper = decisionConditions.x121Conditions.donCloseUpperBuffer[1];
|
||||||
|
double donCloseLower = decisionConditions.x121Conditions.donCloseLowerBuffer[1];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isRejectDonOpenUpper = decisionConditions.x121Conditions.isRejectDonOpenUpper;
|
||||||
|
bool isRejectDonHighUpper = decisionConditions.x121Conditions.isRejectDonHighUpper;
|
||||||
|
bool isRejectDonLowUpper = decisionConditions.x121Conditions.isRejectDonLowUpper;
|
||||||
|
bool isRejectDonCloseUpper = decisionConditions.x121Conditions.isRejectDonCloseUpper;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isRejectDonOpenLower = decisionConditions.x121Conditions.isRejectDonOpenLower;
|
||||||
|
bool isRejectDonHighLower = decisionConditions.x121Conditions.isRejectDonHighLower;
|
||||||
|
bool isRejectDonLowLower = decisionConditions.x121Conditions.isRejectDonLowLower;
|
||||||
|
bool isRejectDonCloseLower = decisionConditions.x121Conditions.isRejectDonCloseLower;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBreakDonOpenUpper = decisionConditions.x121Conditions.isBreakDonOpenUpper;
|
||||||
|
bool isBreakDonHighUpper = decisionConditions.x121Conditions.isBreakDonHighUpper;
|
||||||
|
bool isBreakDonLowUpper = decisionConditions.x121Conditions.isBreakDonLowUpper;
|
||||||
|
bool isBreakDonCloseUpper = decisionConditions.x121Conditions.isBreakDonCloseUpper;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBreakDonOpenLower = decisionConditions.x121Conditions.isBreakDonOpenLower;
|
||||||
|
bool isBreakDonHighLower = decisionConditions.x121Conditions.isBreakDonHighLower;
|
||||||
|
bool isBreakDonLowLower = decisionConditions.x121Conditions.isBreakDonLowLower;
|
||||||
|
bool isBreakDonCloseLower = decisionConditions.x121Conditions.isBreakDonCloseLower;
|
||||||
|
|
||||||
|
//
|
||||||
|
// VWAP ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// COMPLEX ...
|
||||||
|
// Complex Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isNewPeakOverATRUpper =
|
||||||
|
isNewPeak &&
|
||||||
|
peak > atrUpper;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isNewValeUnderATRLower =
|
||||||
|
isNewVale &&
|
||||||
|
vale < atrLower;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isDonHighUpperEqualsToPeak =
|
||||||
|
donHighUpper == peak;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isDonLowLowerEqualsToVale =
|
||||||
|
donLowLower == vale;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullishSign = (
|
||||||
|
//
|
||||||
|
triggerConditions.x121Conditions.isBreakUpATRLower ||
|
||||||
|
triggerConditions.x121Conditions.isRejectUpATRLower ||
|
||||||
|
triggerConditions.x121Conditions.isBreakDonHighLower ||
|
||||||
|
triggerConditions.x121Conditions.isRejectDonHighLower ||
|
||||||
|
triggerConditions.x121Conditions.isBreakDonCloseLower ||
|
||||||
|
triggerConditions.x121Conditions.isRejectDonCloseLower
|
||||||
|
//
|
||||||
|
);
|
||||||
|
bool isBearishSign = (
|
||||||
|
//
|
||||||
|
triggerConditions.x121Conditions.isBreakDownATRUpper ||
|
||||||
|
triggerConditions.x121Conditions.isRejectDownATRUpper ||
|
||||||
|
triggerConditions.x121Conditions.isBreakDonLowUpper ||
|
||||||
|
triggerConditions.x121Conditions.isRejectDonLowUpper ||
|
||||||
|
triggerConditions.x121Conditions.isBreakDonCloseUpper ||
|
||||||
|
triggerConditions.x121Conditions.isRejectDonCloseUpper
|
||||||
|
//
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check RSI in Over Bought or Over Sold ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isRSICrossedOverOverSold = consolidationConditions.x121Conditions.isRSICrossedOverOverSold;
|
||||||
|
bool isRSICrossedUnderOverBought = consolidationConditions.x121Conditions.isRSICrossedUnderOverBought;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isRSICrossedOverOverSold ||
|
||||||
|
isRSICrossedUnderOverBought;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,957 @@
|
|||||||
|
///////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// SaherElm IT Center MQL5 X121 SMC Signal Class
|
||||||
|
// -------------------------------------------------
|
||||||
|
// Name:
|
||||||
|
// Description: provide all Signalling functions ...
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// 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.market.cycle.helper.class.mq5"
|
||||||
|
#include "../Libraries/x-121.smc.lib.mq5"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Definitions ...
|
||||||
|
struct X121SMCStrategyXTWPVSignalConditions
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
string symbol;
|
||||||
|
ENUM_TIMEFRAMES period;
|
||||||
|
|
||||||
|
//
|
||||||
|
double sl;
|
||||||
|
double target;
|
||||||
|
ENUM_X_DIRECTION dir;
|
||||||
|
ENUM_X_POSITION_TYPES type;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Setup Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
datetime setupTime;
|
||||||
|
datetime triggerTime;
|
||||||
|
|
||||||
|
//
|
||||||
|
datetime newPeakOverATRUpperAt;
|
||||||
|
datetime newValeUnderATRLowerAt;
|
||||||
|
|
||||||
|
//
|
||||||
|
datetime donHighUpperEqualsToPeakAt;
|
||||||
|
datetime donLowLowerEqualsToValeAt;
|
||||||
|
|
||||||
|
//
|
||||||
|
datetime closeOverATRUpperAt;
|
||||||
|
datetime closeUnderATRLowerAt;
|
||||||
|
|
||||||
|
//
|
||||||
|
datetime rsiOverSoldAt;
|
||||||
|
datetime rsiOverBoughtAt;
|
||||||
|
|
||||||
|
//
|
||||||
|
datetime newPeakOverLastAt;
|
||||||
|
datetime newValeUnderLastAt;
|
||||||
|
|
||||||
|
//
|
||||||
|
datetime bullishBarSignAt;
|
||||||
|
datetime bearishBarSignAt;
|
||||||
|
|
||||||
|
//
|
||||||
|
XPriceZones priceZone;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor ...
|
||||||
|
X121SMCStrategyXTWPVSignalConditions()
|
||||||
|
{
|
||||||
|
Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tools ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleaning Up ...
|
||||||
|
*/
|
||||||
|
void Clean()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
sl = 0;
|
||||||
|
target = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
dir = X_DIRECTION_NONE;
|
||||||
|
type = X_POSITION_TYPE_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
symbol = NULL;
|
||||||
|
period = NULL;
|
||||||
|
setupTime = NULL;
|
||||||
|
triggerTime = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
ExtensionClean();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check Condition is Setting Up ...
|
||||||
|
*
|
||||||
|
* @param dir: ENUM_X_DIRECTION member, Setting Up Direction ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool IsSetuped()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsValid(setupTime) &&
|
||||||
|
HasDirection(dir);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate Setup Age ...
|
||||||
|
*
|
||||||
|
* @return ( int )
|
||||||
|
*/
|
||||||
|
int GetSetupAge()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!IsSetuped())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = (int)(TimeCurrent() - setupTime) / PeriodSeconds(period);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detect How we Can Trigger Signal ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool CanTrigger()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
sl > 0 &&
|
||||||
|
IsValid(symbol) &&
|
||||||
|
IsValid(period) &&
|
||||||
|
IsValid(triggerTime) &&
|
||||||
|
type != X_POSITION_TYPE_ALL &&
|
||||||
|
type != X_POSITION_TYPE_NONE
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extensions ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean Additional Properties ...
|
||||||
|
*/
|
||||||
|
void ExtensionClean()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
priceZone.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
newPeakOverATRUpperAt = NULL;
|
||||||
|
newValeUnderATRLowerAt = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
donHighUpperEqualsToPeakAt = NULL;
|
||||||
|
donLowLowerEqualsToValeAt = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
closeOverATRUpperAt = NULL;
|
||||||
|
closeUnderATRLowerAt = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
rsiOverSoldAt = NULL;
|
||||||
|
rsiOverBoughtAt = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
newPeakOverLastAt = NULL;
|
||||||
|
newValeUnderLastAt = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
bullishBarSignAt = NULL;
|
||||||
|
bearishBarSignAt = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if Conditions Filled ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool IsFilled(ENUM_X_DIRECTION &fillDir)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
fillDir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasNewPeakOverATRUpper = IsValid(newPeakOverATRUpperAt);
|
||||||
|
bool hasNewValeUnderATRLower = IsValid(newValeUnderATRLowerAt);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasDonHighUpperEqualsToPeak = IsValid(donHighUpperEqualsToPeakAt);
|
||||||
|
bool hasDonLowLowerEqualsToVale = IsValid(donLowLowerEqualsToValeAt);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasCloseOverATRUpper = IsValid(closeOverATRUpperAt);
|
||||||
|
bool hasCloseUnderATRLower = IsValid(closeUnderATRLowerAt);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasRsiOverSold = IsValid(rsiOverSoldAt);
|
||||||
|
bool hasRsiOverBought = IsValid(rsiOverBoughtAt);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasNewPeakOverLast = IsValid(newPeakOverLastAt);
|
||||||
|
bool hasNewValeUnderLast = IsValid(newValeUnderLastAt);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasBullishBarSign = IsValid(bullishBarSignAt);
|
||||||
|
bool hasBearishBarSign = IsValid(bearishBarSignAt);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish =
|
||||||
|
(
|
||||||
|
//
|
||||||
|
hasRsiOverSold &&
|
||||||
|
hasBullishBarSign &&
|
||||||
|
hasNewValeUnderLast &&
|
||||||
|
hasCloseUnderATRLower &&
|
||||||
|
hasNewValeUnderATRLower &&
|
||||||
|
hasDonLowLowerEqualsToVale
|
||||||
|
//
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBearish =
|
||||||
|
(
|
||||||
|
//
|
||||||
|
hasRsiOverBought &&
|
||||||
|
hasBearishBarSign &&
|
||||||
|
hasNewPeakOverLast &&
|
||||||
|
hasCloseOverATRUpper &&
|
||||||
|
hasNewPeakOverATRUpper &&
|
||||||
|
hasDonHighUpperEqualsToPeak
|
||||||
|
//
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
(isBullish || isBearish) &&
|
||||||
|
!(isBullish && isBearish);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
fillDir =
|
||||||
|
isBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HasPriceZone()
|
||||||
|
{
|
||||||
|
return priceZone.IsValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extension Functions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Setup Conditions ...
|
||||||
|
bool DetectX121SMCXTWPVSiganlSetup(
|
||||||
|
string _symbol,
|
||||||
|
ENUM_TIMEFRAMES _period,
|
||||||
|
//
|
||||||
|
X121SMCStrategyXTWPVSignalConditions &conditions,
|
||||||
|
//
|
||||||
|
XC121SMCCycleHelper *triggerCycleHelper,
|
||||||
|
XC121SMCCycleHelper *decisionCycleHelper,
|
||||||
|
XC121SMCCycleHelper *analyseCycleHelper,
|
||||||
|
XC121SMCCycleHelper *verificationCycleHelper,
|
||||||
|
XC121SMCCycleHelper *consolidationCycleHelper,
|
||||||
|
XC121SMCCycleHelper *visionCycleHelper
|
||||||
|
//
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = false;
|
||||||
|
bool isBearish = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
int zIndex = 0;
|
||||||
|
int cIndex = zIndex + 1;
|
||||||
|
int pIndex = cIndex + 1;
|
||||||
|
int ppIndex = pIndex + 1;
|
||||||
|
|
||||||
|
//
|
||||||
|
int loopback = 10;
|
||||||
|
|
||||||
|
//
|
||||||
|
string symbol = _symbol;
|
||||||
|
ENUM_TIMEFRAMES period = _period;
|
||||||
|
|
||||||
|
//
|
||||||
|
conditions.symbol = symbol;
|
||||||
|
conditions.period = period;
|
||||||
|
|
||||||
|
//
|
||||||
|
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 ask = GetAsk(symbol);
|
||||||
|
double bid = GetBid(symbol);
|
||||||
|
datetime cTime = TimeCurrent();
|
||||||
|
double points = GetPoints(symbol);
|
||||||
|
|
||||||
|
//
|
||||||
|
int swingLoopback = 9;
|
||||||
|
double ll = cBar.FindLowest(swingLoopback, MODE_LOW);
|
||||||
|
double hh = cBar.FindHighest(swingLoopback, MODE_HIGH);
|
||||||
|
double llDown = cBar.FindLowesttDown(swingLoopback);
|
||||||
|
double hhUp = cBar.FindHighestUp(swingLoopback);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cycles Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Trigger ...
|
||||||
|
ENUM_XPOI_EVENTS triggerPoiEvents[];
|
||||||
|
ENUM_X_CYCLE_EVENTS triggerCycleEvents[];
|
||||||
|
X121SMCCycleConditions triggerConditions;
|
||||||
|
result = triggerCycleHelper.GetConditions(
|
||||||
|
triggerCycleEvents,
|
||||||
|
triggerPoiEvents,
|
||||||
|
triggerConditions,
|
||||||
|
zIndex,
|
||||||
|
loopback //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Decision ...
|
||||||
|
ENUM_XPOI_EVENTS decisionPoiEvents[];
|
||||||
|
ENUM_X_CYCLE_EVENTS decisionCycleEvents[];
|
||||||
|
X121SMCCycleConditions decisionConditions;
|
||||||
|
result = decisionCycleHelper.GetConditions(
|
||||||
|
decisionCycleEvents,
|
||||||
|
decisionPoiEvents,
|
||||||
|
decisionConditions,
|
||||||
|
zIndex,
|
||||||
|
loopback //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Analyse ...
|
||||||
|
ENUM_XPOI_EVENTS analysePoiEvents[];
|
||||||
|
ENUM_X_CYCLE_EVENTS analyseCycleEvents[];
|
||||||
|
X121SMCCycleConditions analyseConditions;
|
||||||
|
result = analyseCycleHelper.GetConditions(
|
||||||
|
analyseCycleEvents,
|
||||||
|
analysePoiEvents,
|
||||||
|
analyseConditions,
|
||||||
|
zIndex,
|
||||||
|
loopback //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Verification ...
|
||||||
|
ENUM_XPOI_EVENTS verificationPoiEvents[];
|
||||||
|
ENUM_X_CYCLE_EVENTS verificationCycleEvents[];
|
||||||
|
X121SMCCycleConditions verificationConditions;
|
||||||
|
result = verificationCycleHelper.GetConditions(
|
||||||
|
verificationCycleEvents,
|
||||||
|
verificationPoiEvents,
|
||||||
|
verificationConditions,
|
||||||
|
zIndex,
|
||||||
|
loopback //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Consolidation ...
|
||||||
|
ENUM_XPOI_EVENTS consolidationPoiEvents[];
|
||||||
|
ENUM_X_CYCLE_EVENTS consolidationCycleEvents[];
|
||||||
|
X121SMCCycleConditions consolidationConditions;
|
||||||
|
result = consolidationCycleHelper.GetConditions(
|
||||||
|
consolidationCycleEvents,
|
||||||
|
consolidationPoiEvents,
|
||||||
|
consolidationConditions,
|
||||||
|
zIndex,
|
||||||
|
loopback //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Vision ...
|
||||||
|
ENUM_XPOI_EVENTS visionPoiEvents[];
|
||||||
|
ENUM_X_CYCLE_EVENTS visionCycleEvents[];
|
||||||
|
X121SMCCycleConditions visionConditions;
|
||||||
|
result = visionCycleHelper.GetConditions(
|
||||||
|
visionCycleEvents,
|
||||||
|
visionPoiEvents,
|
||||||
|
visionConditions,
|
||||||
|
zIndex,
|
||||||
|
loopback //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cycles POI States ...
|
||||||
|
XPOIState triggerState = triggerConditions.state;
|
||||||
|
XPOIState decisionState = decisionConditions.state;
|
||||||
|
XPOIState analyseState = analyseConditions.state;
|
||||||
|
XPOIState verificationState = verificationConditions.state;
|
||||||
|
XPOIState consolidationState = consolidationConditions.state;
|
||||||
|
XPOIState visionState = visionConditions.state;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Setup Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
result = analyseConditions.x121Conditions.isStrSwitchedToBullish ||
|
||||||
|
analyseConditions.x121Conditions.isStrSwitchedToBearish;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
conditions.setupTime = cTime;
|
||||||
|
conditions.dir =
|
||||||
|
isBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Trigger Conditions ...
|
||||||
|
bool DetectX121SMCXTWPVSiganlTrigger(
|
||||||
|
//
|
||||||
|
X121SMCStrategyXTWPVSignalConditions &conditions,
|
||||||
|
//
|
||||||
|
string _symbol,
|
||||||
|
ENUM_TIMEFRAMES _period,
|
||||||
|
//
|
||||||
|
XC121SMCCycleHelper *triggerCycleHelper,
|
||||||
|
XC121SMCCycleHelper *decisionCycleHelper,
|
||||||
|
XC121SMCCycleHelper *analyseCycleHelper,
|
||||||
|
XC121SMCCycleHelper *verificationCycleHelper,
|
||||||
|
XC121SMCCycleHelper *consolidationCycleHelper,
|
||||||
|
XC121SMCCycleHelper *visionCycleHelper,
|
||||||
|
//
|
||||||
|
int maxAllowedSetupAge = 60 //
|
||||||
|
//
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = conditions.IsSetuped();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
datetime setupTime = conditions.setupTime;
|
||||||
|
ENUM_X_DIRECTION setupDir = conditions.dir;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = IsBullish(setupDir);
|
||||||
|
bool isBearish = IsBearish(setupDir);
|
||||||
|
|
||||||
|
//
|
||||||
|
int zIndex = 0;
|
||||||
|
int cIndex = zIndex + 1;
|
||||||
|
int pIndex = cIndex + 1;
|
||||||
|
int ppIndex = pIndex + 1;
|
||||||
|
|
||||||
|
//
|
||||||
|
int loopback = 10;
|
||||||
|
|
||||||
|
//
|
||||||
|
string symbol = _symbol;
|
||||||
|
ENUM_TIMEFRAMES period = _period;
|
||||||
|
|
||||||
|
//
|
||||||
|
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 ask = GetAsk(symbol);
|
||||||
|
double bid = GetBid(symbol);
|
||||||
|
datetime cTime = TimeCurrent();
|
||||||
|
double points = GetPoints(symbol);
|
||||||
|
|
||||||
|
//
|
||||||
|
int swingLoopback = 9;
|
||||||
|
double ll = cBar.FindLowest(swingLoopback, MODE_LOW);
|
||||||
|
double hh = cBar.FindHighest(swingLoopback, MODE_HIGH);
|
||||||
|
double llDown = cBar.FindLowesttDown(swingLoopback);
|
||||||
|
double hhUp = cBar.FindHighestUp(swingLoopback);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cycles Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Trigger ...
|
||||||
|
ENUM_XPOI_EVENTS triggerPoiEvents[];
|
||||||
|
ENUM_X_CYCLE_EVENTS triggerCycleEvents[];
|
||||||
|
X121SMCCycleConditions triggerConditions;
|
||||||
|
result = triggerCycleHelper.GetConditions(
|
||||||
|
triggerCycleEvents,
|
||||||
|
triggerPoiEvents,
|
||||||
|
triggerConditions,
|
||||||
|
zIndex,
|
||||||
|
loopback //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Decision ...
|
||||||
|
ENUM_XPOI_EVENTS decisionPoiEvents[];
|
||||||
|
ENUM_X_CYCLE_EVENTS decisionCycleEvents[];
|
||||||
|
X121SMCCycleConditions decisionConditions;
|
||||||
|
result = decisionCycleHelper.GetConditions(
|
||||||
|
decisionCycleEvents,
|
||||||
|
decisionPoiEvents,
|
||||||
|
decisionConditions,
|
||||||
|
zIndex,
|
||||||
|
loopback //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Analyse ...
|
||||||
|
ENUM_XPOI_EVENTS analysePoiEvents[];
|
||||||
|
ENUM_X_CYCLE_EVENTS analyseCycleEvents[];
|
||||||
|
X121SMCCycleConditions analyseConditions;
|
||||||
|
result = analyseCycleHelper.GetConditions(
|
||||||
|
analyseCycleEvents,
|
||||||
|
analysePoiEvents,
|
||||||
|
analyseConditions,
|
||||||
|
zIndex,
|
||||||
|
loopback //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Verification ...
|
||||||
|
ENUM_XPOI_EVENTS verificationPoiEvents[];
|
||||||
|
ENUM_X_CYCLE_EVENTS verificationCycleEvents[];
|
||||||
|
X121SMCCycleConditions verificationConditions;
|
||||||
|
result = verificationCycleHelper.GetConditions(
|
||||||
|
verificationCycleEvents,
|
||||||
|
verificationPoiEvents,
|
||||||
|
verificationConditions,
|
||||||
|
zIndex,
|
||||||
|
loopback //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Consolidation ...
|
||||||
|
ENUM_XPOI_EVENTS consolidationPoiEvents[];
|
||||||
|
ENUM_X_CYCLE_EVENTS consolidationCycleEvents[];
|
||||||
|
X121SMCCycleConditions consolidationConditions;
|
||||||
|
result = consolidationCycleHelper.GetConditions(
|
||||||
|
consolidationCycleEvents,
|
||||||
|
consolidationPoiEvents,
|
||||||
|
consolidationConditions,
|
||||||
|
zIndex,
|
||||||
|
loopback //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Vision ...
|
||||||
|
ENUM_XPOI_EVENTS visionPoiEvents[];
|
||||||
|
ENUM_X_CYCLE_EVENTS visionCycleEvents[];
|
||||||
|
X121SMCCycleConditions visionConditions;
|
||||||
|
result = visionCycleHelper.GetConditions(
|
||||||
|
visionCycleEvents,
|
||||||
|
visionPoiEvents,
|
||||||
|
visionConditions,
|
||||||
|
zIndex,
|
||||||
|
loopback //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cycles POI States ...
|
||||||
|
XPOIState triggerState = triggerConditions.state;
|
||||||
|
XPOIState decisionState = decisionConditions.state;
|
||||||
|
XPOIState analyseState = analyseConditions.state;
|
||||||
|
XPOIState verificationState = verificationConditions.state;
|
||||||
|
XPOIState consolidationState = consolidationConditions.state;
|
||||||
|
XPOIState visionState = visionConditions.state;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Trigger Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Bullish Conditions ...
|
||||||
|
isBullish =
|
||||||
|
isBullish &&
|
||||||
|
cBar.IsBullish();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Bearish Conditions ...
|
||||||
|
isBearish =
|
||||||
|
isBearish &&
|
||||||
|
cBar.IsBearish();
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Cleanup Setup Conditions ...
|
||||||
|
int setupAge = conditions.GetSetupAge();
|
||||||
|
if (IsValidSize(setupAge) &&
|
||||||
|
IsValidSize(maxAllowedSetupAge) &&
|
||||||
|
setupAge >= maxAllowedSetupAge)
|
||||||
|
{
|
||||||
|
conditions.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Nearest Pivot Point ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Target ...
|
||||||
|
double target = CalculateTarget(
|
||||||
|
cBar,
|
||||||
|
analyseState,
|
||||||
|
setupDir //
|
||||||
|
);
|
||||||
|
if (target == 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
target = CalculateTarget(
|
||||||
|
cBar,
|
||||||
|
verificationState,
|
||||||
|
setupDir //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double oppositTarget = CalculateTarget(
|
||||||
|
cBar,
|
||||||
|
analyseState,
|
||||||
|
Opposit(setupDir) //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
double entry = GetEntry(
|
||||||
|
conditions.symbol,
|
||||||
|
setupDir //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Filling SL Candidates ...
|
||||||
|
|
||||||
|
//
|
||||||
|
double sls[];
|
||||||
|
|
||||||
|
//
|
||||||
|
double atr = triggerConditions.x121Conditions.atrBuffer[1];
|
||||||
|
double peak = triggerConditions.x121Conditions.peaksBuffer[1];
|
||||||
|
double vale = triggerConditions.x121Conditions.valesBuffer[1];
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isBullish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double lowerVale = triggerCycleHelper.mX121Helper.xpvHelper.GetLowerVale(vale);
|
||||||
|
if (lowerVale > 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
lowerVale,
|
||||||
|
sls //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (isBearish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double higherPeak = triggerCycleHelper.mX121Helper.xpvHelper.GetHigherPeak(peak);
|
||||||
|
if (higherPeak > 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
higherPeak,
|
||||||
|
sls //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (ArraySize(sls) == 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double slsMin = GetMin(sls);
|
||||||
|
double slsMax = GetMax(sls);
|
||||||
|
|
||||||
|
//
|
||||||
|
double sl = isBullish
|
||||||
|
? slsMin - atr
|
||||||
|
: slsMax + atr;
|
||||||
|
double risk = MathAbs(entry - sl);
|
||||||
|
double targetDelta = 2 * (risk / 3);
|
||||||
|
if (target == 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int minTargetPint = 50;
|
||||||
|
double minTargetPointValue = minTargetPint * points;
|
||||||
|
if (targetDelta < minTargetPointValue)
|
||||||
|
{
|
||||||
|
targetDelta = minTargetPointValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Force Target On Half Risk ...
|
||||||
|
target =
|
||||||
|
isBullish
|
||||||
|
? entry + targetDelta
|
||||||
|
: entry - targetDelta;
|
||||||
|
|
||||||
|
//
|
||||||
|
target = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Ignore Target ...
|
||||||
|
target = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Filling Conditions Props ...
|
||||||
|
conditions.sl = sl;
|
||||||
|
conditions.target = target;
|
||||||
|
conditions.triggerTime = cTime;
|
||||||
|
conditions.type = isBullish
|
||||||
|
? X_POSITION_TYPE_LONG
|
||||||
|
: X_POSITION_TYPE_SHORT;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draw Signal ...
|
||||||
|
int DrawX121SMCXTWPVSiganl(
|
||||||
|
X121SMCStrategyXTWPVSignalConditions &conditions,
|
||||||
|
XCBaseObject *&drawnObjects[],
|
||||||
|
XCPOIDrawer *drawer //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(drawnObjects);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (drawer == NULL)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSetuped = conditions.IsSetuped();
|
||||||
|
if (!isSetuped)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = IsBullish(conditions.dir);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ArraySize(drawnObjects);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
@@ -34,6 +34,7 @@ struct X121Inputs
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
|
bool showRSI;
|
||||||
X121XPVInputs xpvInputs;
|
X121XPVInputs xpvInputs;
|
||||||
X121XATRInputs xatrInputs;
|
X121XATRInputs xatrInputs;
|
||||||
X121XSTRInputs xstrInputs;
|
X121XSTRInputs xstrInputs;
|
||||||
@@ -193,7 +194,7 @@ struct X121Conditions
|
|||||||
bool isRSICrossedOverOverSold;
|
bool isRSICrossedOverOverSold;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isCloseOverATRUper;
|
bool isCloseOverATRUpper;
|
||||||
bool isCloseOverATRLower;
|
bool isCloseOverATRLower;
|
||||||
bool isCloseUnderATRUpper;
|
bool isCloseUnderATRUpper;
|
||||||
bool isCloseUnderATRLower;
|
bool isCloseUnderATRLower;
|
||||||
@@ -285,6 +286,29 @@ struct X121Conditions
|
|||||||
bool isVWapSwitchedToBearishState;
|
bool isVWapSwitchedToBearishState;
|
||||||
bool isVWapSwitchedToNeuturalState;
|
bool isVWapSwitchedToNeuturalState;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Complex Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSarEqualsToPeak;
|
||||||
|
bool isSarEqualsToVale;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isNewPeakOverATRUpper;
|
||||||
|
bool isNewValeUnderATRLower;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isDonHighUpperEqualsToPeak;
|
||||||
|
bool isDonLowLowerEqualsToVale;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSTRUpperCrossedOverATRUpper;
|
||||||
|
bool isSTRLowerCrossedUnderATRLower;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSTRUpperCrossedOverDonHighUpper;
|
||||||
|
bool isSTRLowerCrossedUnderDonLowLower;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor ...
|
// Constructor ...
|
||||||
X121Conditions()
|
X121Conditions()
|
||||||
@@ -396,6 +420,9 @@ struct X121Conditions
|
|||||||
//
|
//
|
||||||
// Conditions ...
|
// Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// RSI ...
|
||||||
|
|
||||||
//
|
//
|
||||||
isRSIOverBought = false;
|
isRSIOverBought = false;
|
||||||
isRSICrossedOverOverBought = false;
|
isRSICrossedOverOverBought = false;
|
||||||
@@ -407,7 +434,10 @@ struct X121Conditions
|
|||||||
isRSICrossedOverOverSold = false;
|
isRSICrossedOverOverSold = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
isCloseOverATRUper = false;
|
// ATR ...
|
||||||
|
|
||||||
|
//
|
||||||
|
isCloseOverATRUpper = false;
|
||||||
isCloseOverATRLower = false;
|
isCloseOverATRLower = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -430,6 +460,9 @@ struct X121Conditions
|
|||||||
isBreakUpATRLower = false;
|
isBreakUpATRLower = false;
|
||||||
isBreakDownATRLower = false;
|
isBreakDownATRLower = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// DON ...
|
||||||
|
|
||||||
//
|
//
|
||||||
isRejectDonOpenUpper = false;
|
isRejectDonOpenUpper = false;
|
||||||
isRejectDonHighUpper = false;
|
isRejectDonHighUpper = false;
|
||||||
@@ -454,6 +487,9 @@ struct X121Conditions
|
|||||||
isBreakDonLowLower = false;
|
isBreakDonLowLower = false;
|
||||||
isBreakDonCloseLower = false;
|
isBreakDonCloseLower = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// SAR ...
|
||||||
|
|
||||||
//
|
//
|
||||||
isSarBullish = false;
|
isSarBullish = false;
|
||||||
isSarBearish = false;
|
isSarBearish = false;
|
||||||
@@ -462,6 +498,9 @@ struct X121Conditions
|
|||||||
isSarSwitchedToBullish = false;
|
isSarSwitchedToBullish = false;
|
||||||
isSarSwitchedToBearish = false;
|
isSarSwitchedToBearish = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// PV ...
|
||||||
|
|
||||||
//
|
//
|
||||||
isNewPeak = false;
|
isNewPeak = false;
|
||||||
isNewPeakOverLast = false;
|
isNewPeakOverLast = false;
|
||||||
@@ -472,6 +511,9 @@ struct X121Conditions
|
|||||||
isNewValeOverLast = false;
|
isNewValeOverLast = false;
|
||||||
isNewValeUnderLast = false;
|
isNewValeUnderLast = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// STR ...
|
||||||
|
|
||||||
//
|
//
|
||||||
isStrBullish = false;
|
isStrBullish = false;
|
||||||
isStrBearish = false;
|
isStrBearish = false;
|
||||||
@@ -480,30 +522,72 @@ struct X121Conditions
|
|||||||
isStrSwitchedToBullish = false;
|
isStrSwitchedToBullish = false;
|
||||||
isStrSwitchedToBearish = false;
|
isStrSwitchedToBearish = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// VWAP ...
|
||||||
|
|
||||||
//
|
//
|
||||||
isVWapFastBullish = false;
|
isVWapFastBullish = false;
|
||||||
isVWapFastBearish = false;
|
isVWapFastBearish = false;
|
||||||
isVWapFastNeutural = false;
|
isVWapFastNeutural = false;
|
||||||
|
|
||||||
|
//
|
||||||
isVWapMidBullish = false;
|
isVWapMidBullish = false;
|
||||||
isVWapMidBearish = false;
|
isVWapMidBearish = false;
|
||||||
isVWapMidNeutural = false;
|
isVWapMidNeutural = false;
|
||||||
|
|
||||||
|
//
|
||||||
isVWapSlowBullish = false;
|
isVWapSlowBullish = false;
|
||||||
isVWapSlowBearish = false;
|
isVWapSlowBearish = false;
|
||||||
isVWapSlowNeutural = false;
|
isVWapSlowNeutural = false;
|
||||||
|
|
||||||
|
//
|
||||||
isVWapFastOverMid = false;
|
isVWapFastOverMid = false;
|
||||||
isVWapMidOverSlow = false;
|
isVWapMidOverSlow = false;
|
||||||
|
|
||||||
|
//
|
||||||
isVWapFastUnderMid = false;
|
isVWapFastUnderMid = false;
|
||||||
isVWapMidUnderSlow = false;
|
isVWapMidUnderSlow = false;
|
||||||
|
|
||||||
|
//
|
||||||
isVWapBullishState = false;
|
isVWapBullishState = false;
|
||||||
isVWapBearishState = false;
|
isVWapBearishState = false;
|
||||||
isVWapNeuturalState = false;
|
isVWapNeuturalState = false;
|
||||||
|
|
||||||
|
//
|
||||||
isVWapBullishOrdered = false;
|
isVWapBullishOrdered = false;
|
||||||
isVWapBearishOrdered = false;
|
isVWapBearishOrdered = false;
|
||||||
isVWapSwitchedToBullishOrdered = false;
|
|
||||||
isVWapSwitchedToBearishOrdered = false;
|
//
|
||||||
isVWapSwitchedToBullishState = false;
|
isVWapSwitchedToBullishState = false;
|
||||||
isVWapSwitchedToBearishState = false;
|
isVWapSwitchedToBearishState = false;
|
||||||
|
|
||||||
|
//
|
||||||
isVWapSwitchedToNeuturalState = false;
|
isVWapSwitchedToNeuturalState = false;
|
||||||
|
isVWapSwitchedToBullishOrdered = false;
|
||||||
|
isVWapSwitchedToBearishOrdered = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Complex Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
isSarEqualsToPeak = false;
|
||||||
|
isSarEqualsToVale = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
isNewPeakOverATRUpper = false;
|
||||||
|
isNewValeUnderATRLower = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
isDonHighUpperEqualsToPeak = false;
|
||||||
|
isDonLowLowerEqualsToVale = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
isSTRUpperCrossedOverATRUpper = false;
|
||||||
|
isSTRLowerCrossedUnderATRLower = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
isSTRUpperCrossedOverDonHighUpper = false;
|
||||||
|
isSTRLowerCrossedUnderDonLowLower = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -573,13 +657,41 @@ struct X121Conditions
|
|||||||
//
|
//
|
||||||
string conditionsStr =
|
string conditionsStr =
|
||||||
//
|
//
|
||||||
|
"SAR ..." + separator +
|
||||||
|
"-----------------------" + separator +
|
||||||
|
ToString("isSarBullish", isSarBullish, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isSarBearish", isSarBearish, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isSarSwitchedToBullish", isSarSwitchedToBullish, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isSarSwitchedToBearish", isSarSwitchedToBearish, ignoreFalseConditions, separator) +
|
||||||
|
//
|
||||||
|
"STR ..." + separator +
|
||||||
|
"-----------------------" + separator +
|
||||||
|
ToString("isStrBullish", isStrBullish, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isStrBearish", isStrBearish, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isStrSwitchedToBullish", isStrSwitchedToBullish, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isStrSwitchedToBearish", isStrSwitchedToBearish, ignoreFalseConditions, separator) +
|
||||||
|
//
|
||||||
|
"PV ..." + separator +
|
||||||
|
"-----------------------" + separator +
|
||||||
|
ToString("isNewPeak", isNewPeak, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isNewPeakOverLast", isNewPeakOverLast, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isNewPeakUnderLast", isNewPeakUnderLast, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isNewVale", isNewVale, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isNewValeOverLast", isNewValeOverLast, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isNewValeUnderLast", isNewValeUnderLast, ignoreFalseConditions, separator) +
|
||||||
|
//
|
||||||
|
"> RSI ..." + separator +
|
||||||
|
"-----------------------" + separator +
|
||||||
ToString("isRSIOverBought", isRSIOverBought, ignoreFalseConditions, separator) +
|
ToString("isRSIOverBought", isRSIOverBought, ignoreFalseConditions, separator) +
|
||||||
ToString("isRSICrossedOverOverBought", isRSICrossedOverOverBought, ignoreFalseConditions, separator) +
|
ToString("isRSICrossedOverOverBought", isRSICrossedOverOverBought, ignoreFalseConditions, separator) +
|
||||||
ToString("isRSICrossedUnderOverBought", isRSICrossedUnderOverBought, ignoreFalseConditions, separator) +
|
ToString("isRSICrossedUnderOverBought", isRSICrossedUnderOverBought, ignoreFalseConditions, separator) +
|
||||||
ToString("isRSIOverSold", isRSIOverSold, ignoreFalseConditions, separator) +
|
ToString("isRSIOverSold", isRSIOverSold, ignoreFalseConditions, separator) +
|
||||||
ToString("isRSICrossedUnderOverSold", isRSICrossedUnderOverSold, ignoreFalseConditions, separator) +
|
ToString("isRSICrossedUnderOverSold", isRSICrossedUnderOverSold, ignoreFalseConditions, separator) +
|
||||||
ToString("isRSICrossedOverOverSold", isRSICrossedOverOverSold, ignoreFalseConditions, separator) +
|
ToString("isRSICrossedOverOverSold", isRSICrossedOverOverSold, ignoreFalseConditions, separator) +
|
||||||
ToString("isCloseOverATRUper", isCloseOverATRUper, ignoreFalseConditions, separator) +
|
//
|
||||||
|
"ATR ..." + separator +
|
||||||
|
"-----------------------" + separator +
|
||||||
|
ToString("isCloseOverATRUpper", isCloseOverATRUpper, ignoreFalseConditions, separator) +
|
||||||
ToString("isCloseOverATRLower", isCloseOverATRLower, ignoreFalseConditions, separator) +
|
ToString("isCloseOverATRLower", isCloseOverATRLower, ignoreFalseConditions, separator) +
|
||||||
ToString("isCloseUnderATRUpper", isCloseUnderATRUpper, ignoreFalseConditions, separator) +
|
ToString("isCloseUnderATRUpper", isCloseUnderATRUpper, ignoreFalseConditions, separator) +
|
||||||
ToString("isCloseUnderATRLower", isCloseUnderATRLower, ignoreFalseConditions, separator) +
|
ToString("isCloseUnderATRLower", isCloseUnderATRLower, ignoreFalseConditions, separator) +
|
||||||
@@ -590,6 +702,9 @@ struct X121Conditions
|
|||||||
ToString("isBreakUpATRUpper", isBreakUpATRUpper, ignoreFalseConditions, separator) +
|
ToString("isBreakUpATRUpper", isBreakUpATRUpper, ignoreFalseConditions, separator) +
|
||||||
ToString("isBreakDownATRUpper", isBreakDownATRUpper, ignoreFalseConditions, separator) +
|
ToString("isBreakDownATRUpper", isBreakDownATRUpper, ignoreFalseConditions, separator) +
|
||||||
ToString("isBreakUpATRLower", isBreakUpATRLower, ignoreFalseConditions, separator) +
|
ToString("isBreakUpATRLower", isBreakUpATRLower, ignoreFalseConditions, separator) +
|
||||||
|
//
|
||||||
|
"DON ..." + separator +
|
||||||
|
"-----------------------" + separator +
|
||||||
ToString("isBreakDownATRLower", isBreakDownATRLower, ignoreFalseConditions, separator) +
|
ToString("isBreakDownATRLower", isBreakDownATRLower, ignoreFalseConditions, separator) +
|
||||||
ToString("isRejectDonOpenUpper", isRejectDonOpenUpper, ignoreFalseConditions, separator) +
|
ToString("isRejectDonOpenUpper", isRejectDonOpenUpper, ignoreFalseConditions, separator) +
|
||||||
ToString("isRejectDonHighUpper", isRejectDonHighUpper, ignoreFalseConditions, separator) +
|
ToString("isRejectDonHighUpper", isRejectDonHighUpper, ignoreFalseConditions, separator) +
|
||||||
@@ -607,20 +722,9 @@ struct X121Conditions
|
|||||||
ToString("isBreakDonHighLower", isBreakDonHighLower, ignoreFalseConditions, separator) +
|
ToString("isBreakDonHighLower", isBreakDonHighLower, ignoreFalseConditions, separator) +
|
||||||
ToString("isBreakDonLowLower", isBreakDonLowLower, ignoreFalseConditions, separator) +
|
ToString("isBreakDonLowLower", isBreakDonLowLower, ignoreFalseConditions, separator) +
|
||||||
ToString("isBreakDonCloseLower", isBreakDonCloseLower, ignoreFalseConditions, separator) +
|
ToString("isBreakDonCloseLower", isBreakDonCloseLower, ignoreFalseConditions, separator) +
|
||||||
ToString("isSarBullish", isSarBullish, ignoreFalseConditions, separator) +
|
//
|
||||||
ToString("isSarBearish", isSarBearish, ignoreFalseConditions, separator) +
|
"VWAP ..." + separator +
|
||||||
ToString("isSarSwitchedToBullish", isSarSwitchedToBullish, ignoreFalseConditions, separator) +
|
"-----------------------" + separator +
|
||||||
ToString("isSarSwitchedToBearish", isSarSwitchedToBearish, ignoreFalseConditions, separator) +
|
|
||||||
ToString("isNewPeak", isNewPeak, ignoreFalseConditions, separator) +
|
|
||||||
ToString("isNewPeakOverLast", isNewPeakOverLast, ignoreFalseConditions, separator) +
|
|
||||||
ToString("isNewPeakUnderLast", isNewPeakUnderLast, ignoreFalseConditions, separator) +
|
|
||||||
ToString("isNewVale", isNewVale, ignoreFalseConditions, separator) +
|
|
||||||
ToString("isNewValeOverLast", isNewValeOverLast, ignoreFalseConditions, separator) +
|
|
||||||
ToString("isNewValeUnderLast", isNewValeUnderLast, ignoreFalseConditions, separator) +
|
|
||||||
ToString("isStrBullish", isStrBullish, ignoreFalseConditions, separator) +
|
|
||||||
ToString("isStrBearish", isStrBearish, ignoreFalseConditions, separator) +
|
|
||||||
ToString("isStrSwitchedToBullish", isStrSwitchedToBullish, ignoreFalseConditions, separator) +
|
|
||||||
ToString("isStrSwitchedToBearish", isStrSwitchedToBearish, ignoreFalseConditions, separator) +
|
|
||||||
ToString("isVWapFastBullish", isVWapFastBullish, ignoreFalseConditions, separator) +
|
ToString("isVWapFastBullish", isVWapFastBullish, ignoreFalseConditions, separator) +
|
||||||
ToString("isVWapFastBearish", isVWapFastBearish, ignoreFalseConditions, separator) +
|
ToString("isVWapFastBearish", isVWapFastBearish, ignoreFalseConditions, separator) +
|
||||||
ToString("isVWapFastNeutural", isVWapFastNeutural, ignoreFalseConditions, separator) +
|
ToString("isVWapFastNeutural", isVWapFastNeutural, ignoreFalseConditions, separator) +
|
||||||
@@ -645,6 +749,20 @@ struct X121Conditions
|
|||||||
ToString("isVWapSwitchedToBearishState", isVWapSwitchedToBearishState, ignoreFalseConditions, separator) +
|
ToString("isVWapSwitchedToBearishState", isVWapSwitchedToBearishState, ignoreFalseConditions, separator) +
|
||||||
ToString("isVWapSwitchedToNeuturalState", isVWapSwitchedToNeuturalState, ignoreFalseConditions, separator) +
|
ToString("isVWapSwitchedToNeuturalState", isVWapSwitchedToNeuturalState, ignoreFalseConditions, separator) +
|
||||||
//
|
//
|
||||||
|
"-----------------------" + separator +
|
||||||
|
"Coplex ..." + separator +
|
||||||
|
"-----------------------" + separator +
|
||||||
|
ToString("isSarEqualsToPeak", isSarEqualsToPeak, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isSarEqualsToVale", isSarEqualsToVale, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isNewPeakOverATRUpper", isNewPeakOverATRUpper, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isNewValeUnderATRLower", isNewValeUnderATRLower, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isDonHighUpperEqualsToPeak", isDonHighUpperEqualsToPeak, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isDonLowLowerEqualsToVale", isDonLowLowerEqualsToVale, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isSTRUpperCrossedOverATRUpper", isSTRUpperCrossedOverATRUpper, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isSTRLowerCrossedUnderATRLower", isSTRLowerCrossedUnderATRLower, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isSTRUpperCrossedOverDonHighUpper", isSTRUpperCrossedOverDonHighUpper, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isSTRLowerCrossedUnderDonLowLower", isSTRLowerCrossedUnderDonLowLower, ignoreFalseConditions, separator) +
|
||||||
|
//
|
||||||
""
|
""
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
@@ -844,6 +962,25 @@ class XCX121Helper : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (inputs.showRSI)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mRSIHandler = iRSI(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
xatrInputs.rsiLength,
|
||||||
|
xatrInputs.rsiAppliedTo //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = mRSIHandler != INVALID_HANDLE;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1245,7 +1382,7 @@ class XCX121Helper : public XCBase
|
|||||||
conditions.isRSIOverBought = xatrConditions.isRSIOverBought;
|
conditions.isRSIOverBought = xatrConditions.isRSIOverBought;
|
||||||
conditions.isBreakUpATRUpper = xatrConditions.isBreakUpATRUpper;
|
conditions.isBreakUpATRUpper = xatrConditions.isBreakUpATRUpper;
|
||||||
conditions.isBreakUpATRLower = xatrConditions.isBreakUpATRLower;
|
conditions.isBreakUpATRLower = xatrConditions.isBreakUpATRLower;
|
||||||
conditions.isCloseOverATRUper = xatrConditions.isCloseOverATRUper;
|
conditions.isCloseOverATRUpper = xatrConditions.isCloseOverATRUpper;
|
||||||
conditions.isRejectUpATRUpper = xatrConditions.isRejectUpATRUpper;
|
conditions.isRejectUpATRUpper = xatrConditions.isRejectUpATRUpper;
|
||||||
conditions.isRejectUpATRLower = xatrConditions.isRejectUpATRLower;
|
conditions.isRejectUpATRLower = xatrConditions.isRejectUpATRLower;
|
||||||
conditions.isCloseOverATRLower = xatrConditions.isCloseOverATRLower;
|
conditions.isCloseOverATRLower = xatrConditions.isCloseOverATRLower;
|
||||||
@@ -1389,49 +1526,49 @@ class XCX121Helper : public XCBase
|
|||||||
//
|
//
|
||||||
Copy(
|
Copy(
|
||||||
xvwapConditions.vwapFastBuffer,
|
xvwapConditions.vwapFastBuffer,
|
||||||
conditions.donOpenUpperBuffer //
|
conditions.vwapFastBuffer //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
Copy(
|
Copy(
|
||||||
xvwapConditions.vwapMidBuffer,
|
xvwapConditions.vwapMidBuffer,
|
||||||
conditions.donOpenLowerBuffer //
|
conditions.vwapMidBuffer //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
Copy(
|
Copy(
|
||||||
xvwapConditions.vwapSlowBuffer,
|
xvwapConditions.vwapSlowBuffer,
|
||||||
conditions.donHighUpperBuffer //
|
conditions.vwapSlowBuffer //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
Copy(
|
Copy(
|
||||||
xvwapConditions.vwapVolumeBuffer,
|
xvwapConditions.vwapVolumeBuffer,
|
||||||
conditions.donHighLowerBuffer //
|
conditions.vwapVolumeBuffer //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
Copy(
|
Copy(
|
||||||
xvwapConditions.vwapPriceBuffer,
|
xvwapConditions.vwapPriceBuffer,
|
||||||
conditions.donLowUpperBuffer //
|
conditions.vwapPriceBuffer //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
Copy(
|
Copy(
|
||||||
xvwapConditions.vwapFastStateBuffer,
|
xvwapConditions.vwapFastStateBuffer,
|
||||||
conditions.donLowLowerBuffer //
|
conditions.vwapFastStateBuffer //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
Copy(
|
Copy(
|
||||||
xvwapConditions.vwapMidStateBuffer,
|
xvwapConditions.vwapMidStateBuffer,
|
||||||
conditions.donCloseUpperBuffer //
|
conditions.vwapMidStateBuffer //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
Copy(
|
Copy(
|
||||||
xvwapConditions.vwapSlowStateBuffer,
|
xvwapConditions.vwapSlowStateBuffer,
|
||||||
conditions.donCloseLowerBuffer //
|
conditions.vwapSlowStateBuffer //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1462,6 +1599,77 @@ class XCX121Helper : public XCBase
|
|||||||
conditions.isVWapSwitchedToBullishOrdered = xvwapConditions.isVWapSwitchedToBullishOrdered;
|
conditions.isVWapSwitchedToBullishOrdered = xvwapConditions.isVWapSwitchedToBullishOrdered;
|
||||||
conditions.isVWapSwitchedToBearishOrdered = xvwapConditions.isVWapSwitchedToBearishOrdered;
|
conditions.isVWapSwitchedToBearishOrdered = xvwapConditions.isVWapSwitchedToBearishOrdered;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Complex Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
int cIDX = 1;
|
||||||
|
int pIDX = cIDX + 1;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSarEqualsToPeak =
|
||||||
|
conditions.sarBuffer[cIDX] == conditions.peaksBuffer[cIDX];
|
||||||
|
bool isSarEqualsToVale =
|
||||||
|
conditions.sarBuffer[cIDX] == conditions.valesBuffer[cIDX];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isNewPeakOverATRUpper =
|
||||||
|
conditions.isNewPeak &&
|
||||||
|
conditions.peaksBuffer[cIDX] > conditions.atrUpperBuffer[cIDX];
|
||||||
|
bool isNewValeUnderATRLower =
|
||||||
|
conditions.isNewVale &&
|
||||||
|
conditions.valesBuffer[cIDX] > conditions.atrLowerBuffer[cIDX];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isDonHighUpperEqualsToPeak =
|
||||||
|
conditions.donHighUpperBuffer[cIDX] == conditions.peaksBuffer[cIDX];
|
||||||
|
bool isDonLowLowerEqualsToVale =
|
||||||
|
conditions.donLowLowerBuffer[cIDX] == conditions.valesBuffer[cIDX];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSTRUpperOverATRUpper =
|
||||||
|
conditions.strUpBuffer[cIDX] > conditions.atrUpperBuffer[cIDX];
|
||||||
|
bool isSTRUpperOverATRUpperPrev =
|
||||||
|
conditions.strUpBuffer[pIDX] > conditions.atrUpperBuffer[pIDX];
|
||||||
|
bool isSTRUpperCrossedOverATRUpper = isSTRUpperOverATRUpper &&
|
||||||
|
!isSTRUpperOverATRUpperPrev;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSTRLowerUnderATRLower =
|
||||||
|
conditions.strDownBuffer[cIDX] < conditions.atrLowerBuffer[cIDX];
|
||||||
|
bool isSTRLowerUnderATRLowerPrev =
|
||||||
|
conditions.strDownBuffer[pIDX] < conditions.atrLowerBuffer[pIDX];
|
||||||
|
bool isSTRLowerCrossedUnderATRLower = isSTRLowerUnderATRLower &&
|
||||||
|
!isSTRLowerUnderATRLowerPrev;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSTRUpperOverDonHighUpper =
|
||||||
|
conditions.strUpBuffer[cIDX] > conditions.donHighUpperBuffer[cIDX];
|
||||||
|
bool isSTRUpperOverDonHighUpperPrev =
|
||||||
|
conditions.strUpBuffer[pIDX] > conditions.donHighUpperBuffer[pIDX];
|
||||||
|
bool isSTRUpperCrossedOverDonHighUpper = isSTRUpperOverDonHighUpper &&
|
||||||
|
!isSTRUpperOverDonHighUpperPrev;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSTRLowerUnderDonLowLower =
|
||||||
|
conditions.strDownBuffer[cIDX] < conditions.donLowLowerBuffer[cIDX];
|
||||||
|
bool isSTRLowerUnderDonLowLowerPrev =
|
||||||
|
conditions.strDownBuffer[pIDX] < conditions.donLowLowerBuffer[pIDX];
|
||||||
|
bool isSTRLowerCrossedUnderDonLowLower = isSTRLowerUnderDonLowLower &&
|
||||||
|
!isSTRLowerUnderDonLowLowerPrev;
|
||||||
|
|
||||||
|
//
|
||||||
|
conditions.isSarEqualsToPeak = isSarEqualsToPeak;
|
||||||
|
conditions.isSarEqualsToVale = isSarEqualsToVale;
|
||||||
|
conditions.isNewPeakOverATRUpper = isNewPeakOverATRUpper;
|
||||||
|
conditions.isNewValeUnderATRLower = isNewValeUnderATRLower;
|
||||||
|
conditions.isDonHighUpperEqualsToPeak = isDonHighUpperEqualsToPeak;
|
||||||
|
conditions.isDonLowLowerEqualsToVale = isDonLowLowerEqualsToVale;
|
||||||
|
conditions.isSTRUpperCrossedOverATRUpper = isSTRUpperCrossedOverATRUpper;
|
||||||
|
conditions.isSTRLowerCrossedUnderATRLower = isSTRLowerCrossedUnderATRLower;
|
||||||
|
conditions.isSTRUpperCrossedOverDonHighUpper = isSTRUpperCrossedOverDonHighUpper;
|
||||||
|
conditions.isSTRLowerCrossedUnderDonLowLower = isSTRLowerCrossedUnderDonLowLower;
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1486,6 +1694,9 @@ class XCX121Helper : public XCBase
|
|||||||
X121XDONInputs xdonInputs;
|
X121XDONInputs xdonInputs;
|
||||||
X121XSTRInputs xstrInputs;
|
X121XSTRInputs xstrInputs;
|
||||||
X121XVWAPInputs xvwapInputs;
|
X121XVWAPInputs xvwapInputs;
|
||||||
|
|
||||||
|
//
|
||||||
|
int mRSIHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -210,7 +210,7 @@ struct X121XATRConditions
|
|||||||
// ATR ...
|
// ATR ...
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isCloseOverATRUper;
|
bool isCloseOverATRUpper;
|
||||||
bool isCloseOverATRLower;
|
bool isCloseOverATRLower;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -296,7 +296,7 @@ struct X121XATRConditions
|
|||||||
// ATR ...
|
// ATR ...
|
||||||
|
|
||||||
//
|
//
|
||||||
isCloseOverATRUper = false;
|
isCloseOverATRUpper = false;
|
||||||
isCloseOverATRLower = false;
|
isCloseOverATRLower = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -402,7 +402,7 @@ struct X121XATRConditions
|
|||||||
ToString("isRSICrossedOverOverSold", isRSICrossedOverOverSold, ignoreFalseConditions, separator) +
|
ToString("isRSICrossedOverOverSold", isRSICrossedOverOverSold, ignoreFalseConditions, separator) +
|
||||||
//
|
//
|
||||||
// ATR ...
|
// ATR ...
|
||||||
ToString("isCloseOverATRUper", isCloseOverATRUper, ignoreFalseConditions, separator) +
|
ToString("isCloseOverATRUpper", isCloseOverATRUpper, ignoreFalseConditions, separator) +
|
||||||
ToString("isCloseOverATRLower", isCloseOverATRLower, ignoreFalseConditions, separator) +
|
ToString("isCloseOverATRLower", isCloseOverATRLower, ignoreFalseConditions, separator) +
|
||||||
ToString("isCloseUnderATRUpper", isCloseUnderATRUpper, ignoreFalseConditions, separator) +
|
ToString("isCloseUnderATRUpper", isCloseUnderATRUpper, ignoreFalseConditions, separator) +
|
||||||
ToString("isCloseUnderATRLower", isCloseUnderATRLower, ignoreFalseConditions, separator) +
|
ToString("isCloseUnderATRLower", isCloseUnderATRLower, ignoreFalseConditions, separator) +
|
||||||
@@ -1022,7 +1022,7 @@ class XCX121XATRHelper : public XCBaseHelper
|
|||||||
// ATR ...
|
// ATR ...
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isCloseOverATRUper = cBar.close > conditions.atrUpperBuffer[cIDX];
|
bool isCloseOverATRUpper = cBar.close > conditions.atrUpperBuffer[cIDX];
|
||||||
bool isCloseOverATRLower = cBar.close > conditions.atrLowerBuffer[cIDX];
|
bool isCloseOverATRLower = cBar.close > conditions.atrLowerBuffer[cIDX];
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1088,7 +1088,7 @@ class XCX121XATRHelper : public XCBaseHelper
|
|||||||
conditions.isBreakUpATRLower = isBreakUpATRLower;
|
conditions.isBreakUpATRLower = isBreakUpATRLower;
|
||||||
conditions.isRejectDownATRUpper = isRejectDownATRUpper;
|
conditions.isRejectDownATRUpper = isRejectDownATRUpper;
|
||||||
conditions.isRejectDownATRLower = isRejectDownATRLower;
|
conditions.isRejectDownATRLower = isRejectDownATRLower;
|
||||||
conditions.isCloseOverATRUper = isCloseOverATRUper;
|
conditions.isCloseOverATRUpper = isCloseOverATRUpper;
|
||||||
conditions.isCloseOverATRLower = isCloseOverATRLower;
|
conditions.isCloseOverATRLower = isCloseOverATRLower;
|
||||||
conditions.isBreakDownATRUpper = isBreakDownATRUpper;
|
conditions.isBreakDownATRUpper = isBreakDownATRUpper;
|
||||||
conditions.isBreakDownATRLower = isBreakDownATRLower;
|
conditions.isBreakDownATRLower = isBreakDownATRLower;
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ enum ENUM_X121_XSTR_BUFFERS
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
X121_XSTR_LINE = 0,
|
X121_XSTR_LINE = 0,
|
||||||
X121_XSTR_ATR_LINE = 2,
|
X121_XSTR_UP_LINE = 2,
|
||||||
X121_XSTR_PRICE_LINE = 3,
|
X121_XSTR_DOWN_LINE = 3,
|
||||||
X121_XSTR_UP_LINE = 4,
|
X121_XSTR_ATR_LINE = 4,
|
||||||
X121_XSTR_DOWN_LINE = 5,
|
X121_XSTR_PRICE_LINE = 5,
|
||||||
X121_XSTR_STATE_LINE = 6,
|
X121_XSTR_STATE_LINE = 6,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -52,7 +52,9 @@ struct X121XSTRInputs
|
|||||||
ENUM_APPLIED_PRICE strAppliedTo; // Applied To
|
ENUM_APPLIED_PRICE strAppliedTo; // Applied To
|
||||||
|
|
||||||
//
|
//
|
||||||
bool showStr; // Show Upper Zone
|
bool showStr; // Show Upper Zone
|
||||||
|
bool showStrUpper; // Show Str Upper
|
||||||
|
bool showStrLower; // Show Str Lower
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor(s) ...
|
// Constructor(s) ...
|
||||||
@@ -76,6 +78,8 @@ struct X121XSTRInputs
|
|||||||
|
|
||||||
//
|
//
|
||||||
showStr = false;
|
showStr = false;
|
||||||
|
showStrUpper = false;
|
||||||
|
showStrLower = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -89,6 +93,8 @@ struct X121XSTRInputs
|
|||||||
|
|
||||||
//
|
//
|
||||||
showStr = true;
|
showStr = true;
|
||||||
|
showStrUpper = true;
|
||||||
|
showStrLower = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -355,7 +361,7 @@ class XCX121XSTRHelper : public XCBaseHelper
|
|||||||
bool Init(
|
bool Init(
|
||||||
string symbol, // Trading Symbol
|
string symbol, // Trading Symbol
|
||||||
ENUM_TIMEFRAMES period, // Trading Period
|
ENUM_TIMEFRAMES period, // Trading Period
|
||||||
X121XSTRInputs &inputs // Inputs
|
X121XSTRInputs &inputs // Inputs
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -399,7 +405,9 @@ class XCX121XSTRHelper : public XCBaseHelper
|
|||||||
//
|
//
|
||||||
// Presentation ...
|
// Presentation ...
|
||||||
"",
|
"",
|
||||||
mInputs.showStr
|
mInputs.showStr,
|
||||||
|
mInputs.showStrUpper,
|
||||||
|
mInputs.showStrLower
|
||||||
//
|
//
|
||||||
);
|
);
|
||||||
result = mHandler != INVALID_HANDLE;
|
result = mHandler != INVALID_HANDLE;
|
||||||
@@ -738,8 +746,8 @@ class XCX121XSTRHelper : public XCBaseHelper
|
|||||||
//
|
//
|
||||||
bool GetConditions(
|
bool GetConditions(
|
||||||
X121XSTRConditions &conditions, //
|
X121XSTRConditions &conditions, //
|
||||||
int barIndex = 0, //
|
int barIndex = 0, //
|
||||||
int loopback = 5 //
|
int loopback = 5 //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -45,7 +45,9 @@ input ENUM_APPLIED_PRICE strAppliedTo = PRICE_MEDIAN; // Applied To
|
|||||||
input group "Presentation";
|
input group "Presentation";
|
||||||
|
|
||||||
//
|
//
|
||||||
input bool showStr = true; // Show Str
|
input bool showStr = true; // Show Str
|
||||||
|
input bool showStrUpper = true; // Show Str Upper
|
||||||
|
input bool showStrLower = true; // Show Str Lower
|
||||||
|
|
||||||
//
|
//
|
||||||
// Buffers ...
|
// Buffers ...
|
||||||
@@ -61,7 +63,7 @@ input bool showStr = true; // Show Str
|
|||||||
|
|
||||||
//
|
//
|
||||||
#property indicator_buffers 7
|
#property indicator_buffers 7
|
||||||
#property indicator_plots 1
|
#property indicator_plots 3
|
||||||
|
|
||||||
//
|
//
|
||||||
// STR ...
|
// STR ...
|
||||||
@@ -72,18 +74,44 @@ double strBuffer[];
|
|||||||
double strColorBuffer[];
|
double strColorBuffer[];
|
||||||
|
|
||||||
//
|
//
|
||||||
#define strPlotBufferIndex 1
|
#define strPlotBufferIndex 0
|
||||||
#property indicator_label1 "X121 STR"
|
#property indicator_label1 "X121 STR"
|
||||||
#property indicator_type1 DRAW_COLOR_LINE
|
#property indicator_type1 DRAW_COLOR_LINE
|
||||||
#property indicator_color1 CLR_NONE, clrLime, clrRed, clrGray
|
#property indicator_color1 CLR_NONE, clrLime, clrRed, clrGray
|
||||||
#property indicator_style1 STYLE_SOLID
|
#property indicator_style1 STYLE_SOLID
|
||||||
#property indicator_width1 2
|
#property indicator_width1 2
|
||||||
|
|
||||||
|
//
|
||||||
|
// Up ...
|
||||||
|
#define strUpBufferIndex 2
|
||||||
|
double strUpBuffer[];
|
||||||
|
|
||||||
|
//
|
||||||
|
#define strUpPlotBufferIndex 1
|
||||||
|
#property indicator_label2 "X121 STR U"
|
||||||
|
#property indicator_type2 DRAW_LINE
|
||||||
|
#property indicator_color2 C'255,106,0'
|
||||||
|
#property indicator_style2 STYLE_SOLID
|
||||||
|
#property indicator_width2 1
|
||||||
|
|
||||||
|
//
|
||||||
|
// Down ...
|
||||||
|
#define strDownBufferIndex 3
|
||||||
|
double strDownBuffer[];
|
||||||
|
|
||||||
|
//
|
||||||
|
#define strDownPlotBufferIndex 2
|
||||||
|
#property indicator_label3 "X121 STR D"
|
||||||
|
#property indicator_type3 DRAW_LINE
|
||||||
|
#property indicator_color3 C'255,106,0'
|
||||||
|
#property indicator_style3 STYLE_SOLID
|
||||||
|
#property indicator_width3 1
|
||||||
|
|
||||||
//
|
//
|
||||||
// Data Buffers ...
|
// Data Buffers ...
|
||||||
|
|
||||||
//
|
//
|
||||||
int mLastBufferIndex = 1;
|
int mLastBufferIndex = 3;
|
||||||
|
|
||||||
//
|
//
|
||||||
// STR ...
|
// STR ...
|
||||||
@@ -98,19 +126,9 @@ double atrBuffer[];
|
|||||||
#define strPriceBufferIndex mLastBufferIndex + 2
|
#define strPriceBufferIndex mLastBufferIndex + 2
|
||||||
double strPriceBuffer[];
|
double strPriceBuffer[];
|
||||||
|
|
||||||
//
|
|
||||||
// Up ...
|
|
||||||
#define strUpBufferIndex mLastBufferIndex + 3
|
|
||||||
double strUpBuffer[];
|
|
||||||
|
|
||||||
//
|
|
||||||
// Down ...
|
|
||||||
#define strDownBufferIndex mLastBufferIndex + 4
|
|
||||||
double strDownBuffer[];
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Trend ...
|
// Trend ...
|
||||||
#define strStateBufferIndex mLastBufferIndex + 5
|
#define strStateBufferIndex mLastBufferIndex + 3
|
||||||
double strStateBuffer[];
|
double strStateBuffer[];
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -245,21 +263,6 @@ int OnCalculate(
|
|||||||
//
|
//
|
||||||
// Prepare Buffers ...
|
// Prepare Buffers ...
|
||||||
|
|
||||||
//
|
|
||||||
// Fill All Buffers by Zero ...
|
|
||||||
if (prev_calculated == 0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int numOfRequiredAtrs = (prev_calculated > rates_total || prev_calculated < 0)
|
|
||||||
? rates_total
|
|
||||||
: rates_total - prev_calculated;
|
|
||||||
if (prev_calculated > 0)
|
|
||||||
{
|
|
||||||
numOfRequiredAtrs++;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Validate Calculated Bars ...
|
// Validate Calculated Bars ...
|
||||||
|
|
||||||
@@ -271,7 +274,7 @@ int OnCalculate(
|
|||||||
bool isPassedRequiredCalculatedBars =
|
bool isPassedRequiredCalculatedBars =
|
||||||
//
|
//
|
||||||
// ATR ...
|
// ATR ...
|
||||||
atrCalculatedBars >= numOfRequiredAtrs
|
atrCalculatedBars >= 0
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
if (!isPassedRequiredCalculatedBars)
|
if (!isPassedRequiredCalculatedBars)
|
||||||
@@ -292,14 +295,14 @@ int OnCalculate(
|
|||||||
|
|
||||||
//
|
//
|
||||||
// ATR ...
|
// ATR ...
|
||||||
int copiedAtrs = CopyBuffer(atrHandler, 0, 0, numOfRequiredAtrs, atrBuffer);
|
int copiedAtrs = CopyBuffer(atrHandler, 0, 0, rates_total, atrBuffer);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Validate Copied Items ...
|
// Validate Copied Items ...
|
||||||
bool isPassedRequiredCopiedItems =
|
bool isPassedRequiredCopiedItems =
|
||||||
//
|
//
|
||||||
// ATR ...
|
// ATR ...
|
||||||
copiedAtrs >= numOfRequiredAtrs
|
copiedAtrs >= 0
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
if (!isPassedRequiredCopiedItems)
|
if (!isPassedRequiredCopiedItems)
|
||||||
@@ -379,6 +382,20 @@ void DefineBuffers()
|
|||||||
SetIndexBuffer(strBufferIndex, strBuffer, INDICATOR_DATA);
|
SetIndexBuffer(strBufferIndex, strBuffer, INDICATOR_DATA);
|
||||||
SetIndexBuffer(strColorBufferIndex, strColorBuffer, INDICATOR_COLOR_INDEX);
|
SetIndexBuffer(strColorBufferIndex, strColorBuffer, INDICATOR_COLOR_INDEX);
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_DRAW_TYPE strUpDrawType = showStrUpper ? DRAW_LINE : DRAW_NONE;
|
||||||
|
SetIndexBuffer(strUpBufferIndex, strUpBuffer, INDICATOR_DATA);
|
||||||
|
PlotIndexSetDouble(strUpPlotBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
||||||
|
PlotIndexSetInteger(strUpPlotBufferIndex, PLOT_SHOW_DATA, showStrUpper);
|
||||||
|
PlotIndexSetInteger(strUpPlotBufferIndex, PLOT_DRAW_TYPE, strUpDrawType);
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_DRAW_TYPE strDownDrawType = showStrLower ? DRAW_LINE : DRAW_NONE;
|
||||||
|
SetIndexBuffer(strDownBufferIndex, strDownBuffer, INDICATOR_DATA);
|
||||||
|
PlotIndexSetDouble(strDownPlotBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
||||||
|
PlotIndexSetInteger(strDownPlotBufferIndex, PLOT_SHOW_DATA, showStrLower);
|
||||||
|
PlotIndexSetInteger(strDownPlotBufferIndex, PLOT_DRAW_TYPE, strDownDrawType);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Data Buffers ...
|
// Data Buffers ...
|
||||||
|
|
||||||
@@ -386,8 +403,6 @@ void DefineBuffers()
|
|||||||
// STR ...
|
// STR ...
|
||||||
|
|
||||||
//
|
//
|
||||||
SetIndexBuffer(strUpBufferIndex, strUpBuffer, INDICATOR_CALCULATIONS);
|
|
||||||
SetIndexBuffer(strDownBufferIndex, strDownBuffer, INDICATOR_CALCULATIONS);
|
|
||||||
SetIndexBuffer(strPriceBufferIndex, strPriceBuffer, INDICATOR_CALCULATIONS);
|
SetIndexBuffer(strPriceBufferIndex, strPriceBuffer, INDICATOR_CALCULATIONS);
|
||||||
SetIndexBuffer(strStateBufferIndex, strStateBuffer, INDICATOR_CALCULATIONS);
|
SetIndexBuffer(strStateBufferIndex, strStateBuffer, INDICATOR_CALCULATIONS);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -747,26 +747,6 @@ class XCBarZone : public XCZone
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ENUM_TIMEFRAMES GetPeriod()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
ENUM_TIMEFRAMES result = NULL;
|
|
||||||
|
|
||||||
//
|
|
||||||
XOHCL bar;
|
|
||||||
bool isFilled = FillBar(bar);
|
|
||||||
if (!isFilled)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = bar.period;
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set From Date ...
|
* Set From Date ...
|
||||||
*
|
*
|
||||||
@@ -817,6 +797,52 @@ class XCBarZone : public XCZone
|
|||||||
return mBar.time;
|
return mBar.time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Symbol ...
|
||||||
|
*
|
||||||
|
* @return ( string )
|
||||||
|
*/
|
||||||
|
string GetSymbol()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string result = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!mBar.IsValid())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return mBar.symbol;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Period ...
|
||||||
|
*
|
||||||
|
* @return ( int )
|
||||||
|
*/
|
||||||
|
ENUM_TIMEFRAMES GetPeriod()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ENUM_TIMEFRAMES result = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!mBar.IsValid())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return mBar.period;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides ...
|
// Overrides ...
|
||||||
|
|
||||||
@@ -1097,21 +1123,47 @@ class XCTwoBarZone : public XCZone
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Symbol ...
|
||||||
|
*
|
||||||
|
* @return ( string )
|
||||||
|
*/
|
||||||
|
string GetSymbol()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string result = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!mStartBar.IsValid())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return mStartBar.symbol;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Period ...
|
||||||
|
*
|
||||||
|
* @return ( int )
|
||||||
|
*/
|
||||||
ENUM_TIMEFRAMES GetPeriod()
|
ENUM_TIMEFRAMES GetPeriod()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
ENUM_TIMEFRAMES result = NULL;
|
ENUM_TIMEFRAMES result = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
XOHCL bar;
|
if (!mStartBar.IsValid())
|
||||||
bool isFilled = FillStartBar(bar);
|
|
||||||
if (!isFilled)
|
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result = bar.period;
|
return mStartBar.period;
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -2071,6 +2123,163 @@ class XCOrderBlock : public XCBarZone
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detect Order Blocks Breaker Bar ...
|
||||||
|
*
|
||||||
|
* @param breakerBar: XOHCL instance Reference ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool DetectBreakerBar(XOHCL &breakerBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
breakerBar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL fromBar;
|
||||||
|
result = FillBar(fromBar);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int fromIndex = fromBar.Index();
|
||||||
|
result = fromIndex > 0;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = IsBullish();
|
||||||
|
ENUM_X_DIRECTION dir =
|
||||||
|
isBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
double value =
|
||||||
|
isBullish
|
||||||
|
? Upper()
|
||||||
|
: Lower();
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = fromIndex - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOHCL iBar;
|
||||||
|
bool isInited = iBar.Init(
|
||||||
|
fromBar.symbol,
|
||||||
|
fromBar.period,
|
||||||
|
i //
|
||||||
|
);
|
||||||
|
if (!isInited)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
isInited = IsBarBreak(
|
||||||
|
value,
|
||||||
|
dir,
|
||||||
|
iBar //
|
||||||
|
);
|
||||||
|
if (isInited)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
breakerBar = iBar;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = breakerBar.IsValid();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check Order Block is Hunted or not ...
|
||||||
|
*
|
||||||
|
* @param huntedBar: XOHCL instance Reference ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool IsHunted(XOHCL &huntedBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
huntedBar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL breakerBar;
|
||||||
|
result = DetectBreakerBar(breakerBar);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = IsBullish();
|
||||||
|
|
||||||
|
//
|
||||||
|
int breakerIndex = breakerBar.Index();
|
||||||
|
for (int i = breakerIndex - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOHCL iBar;
|
||||||
|
result = iBar.Init(
|
||||||
|
breakerBar.symbol,
|
||||||
|
breakerBar.period,
|
||||||
|
i //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
double price =
|
||||||
|
isBullish
|
||||||
|
? iBar.low
|
||||||
|
: iBar.high;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsPriceInsideZone(
|
||||||
|
price,
|
||||||
|
Upper(),
|
||||||
|
Lower() //
|
||||||
|
);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
huntedBar = iBar;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = huntedBar.IsValid();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides ...
|
// Overrides ...
|
||||||
|
|
||||||
@@ -8208,6 +8417,48 @@ bool IsPriceInsideZone(
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
bool IsPriceInsideZone(
|
||||||
|
XOHCL &bar,
|
||||||
|
double upper,
|
||||||
|
double lower //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
upper > 0 &&
|
||||||
|
lower > 0 &&
|
||||||
|
upper > lower &&
|
||||||
|
bar.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double ask = GetAsk(bar.symbol);
|
||||||
|
double bid = GetBid(bar.symbol);
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
ask <= upper &&
|
||||||
|
bid <= upper &&
|
||||||
|
bar.low <= upper
|
||||||
|
//
|
||||||
|
&&
|
||||||
|
//
|
||||||
|
ask >= lower &&
|
||||||
|
bid >= lower &&
|
||||||
|
bar.low >= lower
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check Price Inside Specified Zone ...
|
* Check Price Inside Specified Zone ...
|
||||||
@@ -8246,6 +8497,40 @@ bool IsPriceInsideZone(
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
bool IsPriceInsideZone(
|
||||||
|
double price,
|
||||||
|
double upper,
|
||||||
|
double lower //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
price > 0 &&
|
||||||
|
upper > 0 &&
|
||||||
|
lower > 0 &&
|
||||||
|
upper > lower;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
price <= upper
|
||||||
|
//
|
||||||
|
&&
|
||||||
|
//
|
||||||
|
price >= lower
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate Target for Specified Direction ...
|
* Calculate Target for Specified Direction ...
|
||||||
|
|||||||
@@ -520,7 +520,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
XBarTracker mBarTracker; // Strategy Time Tracker ...
|
XBarTracker mBarTracker; // Strategy Time Tracker ...
|
||||||
XCBarAnalyser mBarAnalyser; // Bar Analyser Instance
|
XCBarAnalyser mBarAnalyser; // Bar Analyser Instance
|
||||||
// X121SMCStrategyConditions mConditions; // Market Conditions ...
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Actions ...
|
// Actions ...
|
||||||
|
|||||||
@@ -120,12 +120,18 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
bool Init(
|
bool Init(
|
||||||
string symbol,
|
string symbol,
|
||||||
ENUM_TIMEFRAMES period,
|
ENUM_TIMEFRAMES period,
|
||||||
X121Inputs &x121Inputs //
|
X121Inputs &x121Inputs,
|
||||||
|
int requiredPOIS = 50 //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (requiredPOIS < 10) {
|
||||||
|
requiredPOIS = 10;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result = IsValid(symbol) &&
|
result = IsValid(symbol) &&
|
||||||
IsValid(period);
|
IsValid(period);
|
||||||
@@ -152,7 +158,7 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
symbol,
|
symbol,
|
||||||
period //
|
period //
|
||||||
);
|
);
|
||||||
mPOIDetector.MaxNumberOfRequiredPOIs(10);
|
mPOIDetector.MaxNumberOfRequiredPOIs(requiredPOIS);
|
||||||
mPOIDetector.Init();
|
mPOIDetector.Init();
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -257,9 +257,10 @@ struct X121SMCStrategyConditions
|
|||||||
ENUM_X_DIRECTION signalDir;
|
ENUM_X_DIRECTION signalDir;
|
||||||
|
|
||||||
//
|
//
|
||||||
XPriceZones priceZones;
|
X121Conditions conditions;
|
||||||
XPriceZones decisionZones;
|
// XPriceZones priceZones;
|
||||||
XMarketStructure marketStructure;
|
// XPriceZones decisionZones;
|
||||||
|
// XMarketStructure marketStructure;
|
||||||
|
|
||||||
//
|
//
|
||||||
void X121SMCStrategyConditions()
|
void X121SMCStrategyConditions()
|
||||||
@@ -287,9 +288,10 @@ struct X121SMCStrategyConditions
|
|||||||
signalDir = X_DIRECTION_NONE;
|
signalDir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
//
|
//
|
||||||
priceZones.Clean();
|
conditions.Clean();
|
||||||
decisionZones.Clean();
|
// priceZones.Clean();
|
||||||
marketStructure.Clean();
|
// decisionZones.Clean();
|
||||||
|
// marketStructure.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -537,75 +539,75 @@ int DrawX121SMCStrategyConditions(
|
|||||||
//
|
//
|
||||||
bool isBullish = IsBullish(conditions.signalDir);
|
bool isBullish = IsBullish(conditions.signalDir);
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool hasPriceZones = conditions.priceZones.IsValid();
|
// bool hasPriceZones = conditions.priceZones.IsValid();
|
||||||
if (hasPriceZones &&
|
// if (hasPriceZones &&
|
||||||
drawPriceZones)
|
// drawPriceZones)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
XCBaseObject *objects[];
|
// XCBaseObject *objects[];
|
||||||
int objectsCount = drawer.DrawPriceZone(
|
// int objectsCount = drawer.DrawPriceZone(
|
||||||
conditions.priceZones,
|
// conditions.priceZones,
|
||||||
objects,
|
// objects,
|
||||||
conditions.signalDir,
|
// conditions.signalDir,
|
||||||
drawOnlyPriceZonesBoundary //
|
// drawOnlyPriceZonesBoundary //
|
||||||
);
|
// );
|
||||||
if (IsValidSize(objectsCount))
|
// if (IsValidSize(objectsCount))
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
Copy(
|
// Copy(
|
||||||
objects,
|
// objects,
|
||||||
drawnObjects,
|
// drawnObjects,
|
||||||
false //
|
// false //
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool hasDecisionZones = conditions.decisionZones.IsValid();
|
// bool hasDecisionZones = conditions.decisionZones.IsValid();
|
||||||
if (hasDecisionZones &&
|
// if (hasDecisionZones &&
|
||||||
drawDecisionZones)
|
// drawDecisionZones)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
XCBaseObject *objects[];
|
// XCBaseObject *objects[];
|
||||||
int objectsCount = drawer.DrawPriceZone(
|
// int objectsCount = drawer.DrawPriceZone(
|
||||||
conditions.decisionZones,
|
// conditions.decisionZones,
|
||||||
objects,
|
// objects,
|
||||||
conditions.signalDir,
|
// conditions.signalDir,
|
||||||
drawOnlyPriceZonesBoundary //
|
// drawOnlyPriceZonesBoundary //
|
||||||
);
|
// );
|
||||||
if (IsValidSize(objectsCount))
|
// if (IsValidSize(objectsCount))
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
Copy(
|
// Copy(
|
||||||
objects,
|
// objects,
|
||||||
drawnObjects,
|
// drawnObjects,
|
||||||
false //
|
// false //
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool hasMarketStructure = conditions.marketStructure.IsValid();
|
// bool hasMarketStructure = conditions.marketStructure.IsValid();
|
||||||
if (hasMarketStructure &&
|
// if (hasMarketStructure &&
|
||||||
drawMarketStructure)
|
// drawMarketStructure)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
XCBaseObject *objects[];
|
// XCBaseObject *objects[];
|
||||||
int objectsCount = drawer.DrawMarketStructure(
|
// int objectsCount = drawer.DrawMarketStructure(
|
||||||
conditions.marketStructure,
|
// conditions.marketStructure,
|
||||||
objects //
|
// objects //
|
||||||
);
|
// );
|
||||||
if (IsValidSize(objectsCount))
|
// if (IsValidSize(objectsCount))
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
Copy(
|
// Copy(
|
||||||
objects,
|
// objects,
|
||||||
drawnObjects,
|
// drawnObjects,
|
||||||
false //
|
// false //
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
//
|
||||||
result = ArraySize(drawnObjects);
|
result = ArraySize(drawnObjects);
|
||||||
@@ -714,3 +716,141 @@ ENUM_X_121_SMC_PROVIDERS ParseProvider(string value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
bool TestPOIState(
|
||||||
|
XCPOIDrawer *drawer,
|
||||||
|
ENUM_X_DIRECTION forDir, // Test For Specified Direction ...
|
||||||
|
XPOIState &biggerState, // Bigger TF POI(s) ...
|
||||||
|
XPOIState &midState, // Mid TF POI(s) ...
|
||||||
|
XPOIState &triggerState, // Trigger TF POI(s) ...
|
||||||
|
int barIndex = 0 // Bar Index ...
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (barIndex < 0)
|
||||||
|
{
|
||||||
|
barIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Args ...
|
||||||
|
result =
|
||||||
|
drawer != NULL &&
|
||||||
|
HasDirection(forDir) &&
|
||||||
|
biggerState.HasChild() &&
|
||||||
|
midState.HasChild() &&
|
||||||
|
triggerState.HasChild();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
string symbol = biggerState.symbol;
|
||||||
|
ENUM_TIMEFRAMES period = biggerState.period;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve Bars ...
|
||||||
|
XOHCL triggerCBar;
|
||||||
|
result = triggerCBar.Init(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Select Order Blocks Which Has Big Changes ...
|
||||||
|
int count = 0;
|
||||||
|
datetime cTime = TimeCurrent();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish ...
|
||||||
|
XCOrderBlock *bullishOrderBlocks[];
|
||||||
|
int bullishOrderBlocksCount = biggerState.CountBullishOrderBlocks();
|
||||||
|
count = bullishOrderBlocksCount;
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = count - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCOrderBlock *iOb = biggerState.bullishOrderBlocks[i];
|
||||||
|
iOb.To(cTime);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Find Exit Bar of Bullish OrderBlock Upper ...
|
||||||
|
XOHCL breakerBar;
|
||||||
|
bool hasBreakerBar = iOb.DetectBreakerBar(breakerBar);
|
||||||
|
if (!hasBreakerBar)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Order Block is Hunted Or Not ...
|
||||||
|
XOHCL huntedBar;
|
||||||
|
bool isHunted = iOb.IsHunted(huntedBar);
|
||||||
|
if (isHunted) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XCBullishOrderBlockObject *iOBObject;
|
||||||
|
bool isInited = drawer.CreateBullishOrderBlock(
|
||||||
|
iOb,
|
||||||
|
iOBObject //
|
||||||
|
);
|
||||||
|
if (isInited)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XCOHCLObject *iBarObj;
|
||||||
|
isInited = drawer.CreateBar(
|
||||||
|
breakerBar,
|
||||||
|
iBarObj,
|
||||||
|
cTime //
|
||||||
|
);
|
||||||
|
if (isInited)
|
||||||
|
{
|
||||||
|
Print("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish ...
|
||||||
|
XCOrderBlock *bearishOrderBlocks[];
|
||||||
|
int bearishOrderBlocksCount = biggerState.CountBearishOrderBlocks();
|
||||||
|
count = bearishOrderBlocksCount;
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = count - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCOrderBlock *iOb = biggerState.bearishOrderBlocks[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
IsValidSize(bullishOrderBlocksCount) ||
|
||||||
|
IsValidSize(bearishOrderBlocksCount)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
@@ -48,23 +48,6 @@ struct X121SMCStrategyXTWPVSignalConditions
|
|||||||
datetime setupTime;
|
datetime setupTime;
|
||||||
datetime triggerTime;
|
datetime triggerTime;
|
||||||
|
|
||||||
//
|
|
||||||
XMarketStructure consolidationMarketStructure;
|
|
||||||
XMarketStructure analyseMarketStructure;
|
|
||||||
|
|
||||||
//
|
|
||||||
datetime newPeakAboveAtrUpperAt;
|
|
||||||
datetime newValeBelowAtrLowerAt;
|
|
||||||
datetime sarSiwtchedToBullishAt;
|
|
||||||
datetime sarSiwtchedToBearishAt;
|
|
||||||
datetime rsiCrossedOverOverSoldAt;
|
|
||||||
datetime rsiCrossedUnderOverBoughtAt;
|
|
||||||
|
|
||||||
//
|
|
||||||
XPriceZones decisionZone;
|
|
||||||
XPriceZones peakPriceZone;
|
|
||||||
XPriceZones valePriceZone;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor ...
|
// Constructor ...
|
||||||
X121SMCStrategyXTWPVSignalConditions()
|
X121SMCStrategyXTWPVSignalConditions()
|
||||||
@@ -180,127 +163,6 @@ struct X121SMCStrategyXTWPVSignalConditions
|
|||||||
void ExtensionClean()
|
void ExtensionClean()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
decisionZone.Clean();
|
|
||||||
peakPriceZone.Clean();
|
|
||||||
valePriceZone.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
analyseMarketStructure.Clean();
|
|
||||||
consolidationMarketStructure.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
newPeakAboveAtrUpperAt = NULL;
|
|
||||||
newValeBelowAtrLowerAt = NULL;
|
|
||||||
sarSiwtchedToBullishAt = NULL;
|
|
||||||
sarSiwtchedToBearishAt = NULL;
|
|
||||||
rsiCrossedOverOverSoldAt = NULL;
|
|
||||||
rsiCrossedUnderOverBoughtAt = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check Required Market Strucutre Exists or not ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool HasMarketStrucutre()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
//
|
|
||||||
analyseMarketStructure.IsValid() &&
|
|
||||||
consolidationMarketStructure.IsValid()
|
|
||||||
//
|
|
||||||
&&
|
|
||||||
//
|
|
||||||
analyseMarketStructure.HasTrend() &&
|
|
||||||
consolidationMarketStructure.HasTrend()
|
|
||||||
//
|
|
||||||
&&
|
|
||||||
//
|
|
||||||
analyseMarketStructure.bias == consolidationMarketStructure.bias
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if Conditions Filled ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool IsFilled()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
result = HasMarketStrucutre();
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isBullish = IsBullish(analyseMarketStructure.bias);
|
|
||||||
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
isBullish
|
|
||||||
? IsValid(newValeBelowAtrLowerAt) &&
|
|
||||||
IsValid(sarSiwtchedToBullishAt) &&
|
|
||||||
IsValid(rsiCrossedOverOverSoldAt)
|
|
||||||
: IsValid(newPeakAboveAtrUpperAt) &&
|
|
||||||
IsValid(sarSiwtchedToBearishAt) &&
|
|
||||||
IsValid(rsiCrossedUnderOverBoughtAt);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if Has Price Zones ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool HasPriceZone()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
result = HasMarketStrucutre();
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isBullish = IsBullish(analyseMarketStructure.bias);
|
|
||||||
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
isBullish
|
|
||||||
? valePriceZone.IsValid()
|
|
||||||
: peakPriceZone.IsValid();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if Has Decision Zones ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool HasDecisionZone()
|
|
||||||
{
|
|
||||||
return HasPriceZone() &&
|
|
||||||
decisionZone.IsValid();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -322,7 +184,9 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
|||||||
XC121SMCCycleHelper *analyseCycleHelper,
|
XC121SMCCycleHelper *analyseCycleHelper,
|
||||||
XC121SMCCycleHelper *verificationCycleHelper,
|
XC121SMCCycleHelper *verificationCycleHelper,
|
||||||
XC121SMCCycleHelper *consolidationCycleHelper,
|
XC121SMCCycleHelper *consolidationCycleHelper,
|
||||||
XC121SMCCycleHelper *visionCycleHelper
|
XC121SMCCycleHelper *visionCycleHelper,
|
||||||
|
//
|
||||||
|
XCPOIDrawer *drawer //
|
||||||
//
|
//
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -517,348 +381,13 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
|||||||
// Setup Conditions ...
|
// Setup Conditions ...
|
||||||
|
|
||||||
//
|
//
|
||||||
bool hasMarketStructure = conditions.HasMarketStrucutre();
|
bool isBullishTested = TestPOIState(
|
||||||
if (!hasMarketStructure)
|
drawer,
|
||||||
{
|
X_DIRECTION_BULLISH,
|
||||||
//
|
consolidationState,
|
||||||
bool hasConsolidationMarketStructure =
|
analyseState,
|
||||||
consolidationCycleHelper
|
decisionState //
|
||||||
.DetectMarketStructure(conditions.consolidationMarketStructure);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
bool hasAnalyseMarketStructure =
|
|
||||||
analyseCycleHelper
|
|
||||||
.DetectMarketStructure(conditions.analyseMarketStructure);
|
|
||||||
|
|
||||||
//
|
|
||||||
hasMarketStructure = conditions.HasMarketStrucutre();
|
|
||||||
result = hasMarketStructure;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// We Are Sure we Have Direct Structure Bias ...
|
|
||||||
isBullish = IsBullish(conditions.analyseMarketStructure.bias);
|
|
||||||
isBearish = IsBearish(conditions.analyseMarketStructure.bias);
|
|
||||||
|
|
||||||
//
|
|
||||||
// RSI ...
|
|
||||||
double rsi = triggerConditions.x121Conditions.rsiBuffer[1];
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isRSICrossedOverOverBought = triggerConditions.x121Conditions.isRSICrossedOverOverBought;
|
|
||||||
bool isRSICrossedUnderOverBought = triggerConditions.x121Conditions.isRSICrossedUnderOverBought;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isRSICrossedOverOverSold = triggerConditions.x121Conditions.isRSICrossedOverOverSold;
|
|
||||||
bool isRSICrossedUnderOverSold = triggerConditions.x121Conditions.isRSICrossedUnderOverSold;
|
|
||||||
|
|
||||||
//
|
|
||||||
// PV ...
|
|
||||||
double peak = triggerConditions.x121Conditions.peaksBuffer[1];
|
|
||||||
double vale = triggerConditions.x121Conditions.valesBuffer[1];
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isNewPeak = triggerConditions.x121Conditions.isNewPeak;
|
|
||||||
bool isNewVale = triggerConditions.x121Conditions.isNewVale;
|
|
||||||
|
|
||||||
//
|
|
||||||
// ATR ...
|
|
||||||
double atr = triggerConditions.x121Conditions.atrBuffer[1];
|
|
||||||
double atrUpper = triggerConditions.x121Conditions.atrUpperBuffer[1];
|
|
||||||
double atrLower = triggerConditions.x121Conditions.atrLowerBuffer[1];
|
|
||||||
|
|
||||||
//
|
|
||||||
// SAR ...
|
|
||||||
double sar = triggerConditions.x121Conditions.sarBuffer[1];
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isSarSwitchedToBullish = triggerConditions.x121Conditions.isSarSwitchedToBullish;
|
|
||||||
bool isSarSwitchedToBearish = triggerConditions.x121Conditions.isSarSwitchedToBearish;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Complex Conditions ...
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isNewPeakAboveAtrUpper =
|
|
||||||
isNewPeak &&
|
|
||||||
peak > atrUpper;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isNewValeBelowAtrLower =
|
|
||||||
isNewVale &&
|
|
||||||
vale < atrLower;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Fill Conditions ...
|
|
||||||
bool isConditionsFilled = conditions.IsFilled();
|
|
||||||
if (!isConditionsFilled)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Cleanup ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Sar ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bullish ...
|
|
||||||
if (isBullish &&
|
|
||||||
isSarSwitchedToBearish &&
|
|
||||||
IsValid(conditions.sarSiwtchedToBullishAt))
|
|
||||||
{
|
|
||||||
conditions.sarSiwtchedToBullishAt = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bearish ...
|
|
||||||
if (isBearish &&
|
|
||||||
isSarSwitchedToBullish &&
|
|
||||||
IsValid(conditions.sarSiwtchedToBearishAt))
|
|
||||||
{
|
|
||||||
conditions.sarSiwtchedToBearishAt = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Rsi ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bullish ...
|
|
||||||
if (isBullish &&
|
|
||||||
isRSICrossedUnderOverSold &&
|
|
||||||
IsValid(conditions.rsiCrossedOverOverSoldAt))
|
|
||||||
{
|
|
||||||
conditions.rsiCrossedOverOverSoldAt = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bearish ...
|
|
||||||
if (isBearish &&
|
|
||||||
isRSICrossedOverOverBought &&
|
|
||||||
IsValid(conditions.rsiCrossedUnderOverBoughtAt))
|
|
||||||
{
|
|
||||||
conditions.rsiCrossedUnderOverBoughtAt = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Atr Change ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bullish ...
|
|
||||||
if (isBullish &&
|
|
||||||
isNewPeak &&
|
|
||||||
IsValid(conditions.newValeBelowAtrLowerAt))
|
|
||||||
{
|
|
||||||
conditions.newValeBelowAtrLowerAt = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bearish ...
|
|
||||||
if (isBearish &&
|
|
||||||
isNewVale &&
|
|
||||||
IsValid(conditions.newPeakAboveAtrUpperAt))
|
|
||||||
{
|
|
||||||
conditions.newPeakAboveAtrUpperAt = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Filling Up ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Sar Change ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bullish ...
|
|
||||||
if (isBullish &&
|
|
||||||
isSarSwitchedToBullish &&
|
|
||||||
!IsValid(conditions.sarSiwtchedToBullishAt))
|
|
||||||
{
|
|
||||||
conditions.sarSiwtchedToBullishAt = cTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bearish ...
|
|
||||||
if (isBearish &&
|
|
||||||
isSarSwitchedToBearish &&
|
|
||||||
!IsValid(conditions.sarSiwtchedToBearishAt))
|
|
||||||
{
|
|
||||||
conditions.sarSiwtchedToBearishAt = cTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Rsi Change ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bullish ...
|
|
||||||
if (isBullish &&
|
|
||||||
isRSICrossedOverOverSold &&
|
|
||||||
!IsValid(conditions.rsiCrossedOverOverSoldAt))
|
|
||||||
{
|
|
||||||
conditions.rsiCrossedOverOverSoldAt = cTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bearish ...
|
|
||||||
if (isBearish &&
|
|
||||||
isRSICrossedUnderOverBought &&
|
|
||||||
!IsValid(conditions.rsiCrossedUnderOverBoughtAt))
|
|
||||||
{
|
|
||||||
conditions.rsiCrossedUnderOverBoughtAt = cTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Atr Change ...
|
|
||||||
// New Peaks and Vale ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bullish ...
|
|
||||||
if (isBullish &&
|
|
||||||
isNewValeBelowAtrLower &&
|
|
||||||
!IsValid(conditions.newValeBelowAtrLowerAt))
|
|
||||||
{
|
|
||||||
conditions.newValeBelowAtrLowerAt = cTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bearish ...
|
|
||||||
if (isBearish &&
|
|
||||||
isNewPeakAboveAtrUpper &&
|
|
||||||
!IsValid(conditions.newPeakAboveAtrUpperAt))
|
|
||||||
{
|
|
||||||
conditions.newPeakAboveAtrUpperAt = cTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
isConditionsFilled = conditions.IsFilled();
|
|
||||||
result = isConditionsFilled;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Fill Price Zones ...
|
|
||||||
bool hasPriceZone = conditions.HasPriceZone();
|
|
||||||
if (!hasPriceZone)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (isBullish)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XPriceZones vPZone;
|
|
||||||
bool hasValeInsideZone = CalculatePriceInsideZones(
|
|
||||||
vPZone,
|
|
||||||
analyseState,
|
|
||||||
vale //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
XPriceZones cbPZone;
|
|
||||||
bool hasPriceInsideZone = CalculatePriceInsideZones(
|
|
||||||
cbPZone,
|
|
||||||
analyseState,
|
|
||||||
cBar //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
if (hasValeInsideZone &&
|
|
||||||
hasPriceInsideZone &&
|
|
||||||
vPZone.IsBullish() &&
|
|
||||||
cbPZone.IsBullish())
|
|
||||||
{
|
|
||||||
conditions.valePriceZone = cbPZone;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (isBearish)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XPriceZones pPZone;
|
|
||||||
bool hasPeakInsideZone = CalculatePriceInsideZones(
|
|
||||||
pPZone,
|
|
||||||
analyseState,
|
|
||||||
peak //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
XPriceZones cbPZone;
|
|
||||||
bool hasPriceInsideZone = CalculatePriceInsideZones(
|
|
||||||
cbPZone,
|
|
||||||
analyseState,
|
|
||||||
cBar //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
if (
|
|
||||||
hasPeakInsideZone &&
|
|
||||||
hasPriceInsideZone &&
|
|
||||||
pPZone.IsBearish() &&
|
|
||||||
cbPZone.IsBearish())
|
|
||||||
{
|
|
||||||
conditions.peakPriceZone = cbPZone;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
hasPriceZone = conditions.HasPriceZone();
|
|
||||||
result = hasPriceZone;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check for Decision ...
|
|
||||||
bool hasDecision = conditions.HasDecisionZone();
|
|
||||||
if (!hasDecision)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (isBullish)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XPriceZones pZone;
|
|
||||||
bool hasPZone = CalculatePriceInsideZones(
|
|
||||||
pZone,
|
|
||||||
decisionState,
|
|
||||||
vale //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
if (hasPZone &&
|
|
||||||
pZone.IsBullish())
|
|
||||||
{
|
|
||||||
conditions.decisionZone = pZone;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (isBearish)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XPriceZones pZone;
|
|
||||||
bool hasPZone = CalculatePriceInsideZones(
|
|
||||||
pZone,
|
|
||||||
decisionState,
|
|
||||||
peak //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
if (hasPZone &&
|
|
||||||
pZone.IsBearish())
|
|
||||||
{
|
|
||||||
conditions.decisionZone = pZone;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
hasDecision = conditions.HasDecisionZone();
|
|
||||||
result = hasDecision;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
result = isBullish ||
|
result = isBullish ||
|
||||||
@@ -1284,79 +813,6 @@ int DrawX121SMCXTWPVSiganl(
|
|||||||
//
|
//
|
||||||
bool isBullish = IsBullish(conditions.dir);
|
bool isBullish = IsBullish(conditions.dir);
|
||||||
|
|
||||||
//
|
|
||||||
XCBaseObject *priceZoneObjs[];
|
|
||||||
XCBaseObject *decisionZoneObjs[];
|
|
||||||
XCBaseObject *marketStructureObjs[];
|
|
||||||
|
|
||||||
//
|
|
||||||
bool hasMarketStructure = conditions.HasMarketStrucutre();
|
|
||||||
if (hasMarketStructure)
|
|
||||||
{
|
|
||||||
// //
|
|
||||||
// drawer.DrawMarketStructure(
|
|
||||||
// conditions.analyseMarketStructure,
|
|
||||||
// marketStructureObjs //
|
|
||||||
// );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool hasPriceZone = conditions.HasPriceZone();
|
|
||||||
if (hasPriceZone)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XPriceZones pZone;
|
|
||||||
if (isBullish)
|
|
||||||
{
|
|
||||||
pZone = conditions.valePriceZone;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pZone = conditions.peakPriceZone;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
drawer.DrawPriceZone(
|
|
||||||
pZone,
|
|
||||||
priceZoneObjs,
|
|
||||||
conditions.dir //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool hasDecisionZone = conditions.HasDecisionZone();
|
|
||||||
if (hasDecisionZone)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
drawer.DrawPriceZone(
|
|
||||||
conditions.decisionZone,
|
|
||||||
decisionZoneObjs
|
|
||||||
// ,
|
|
||||||
// conditions.dir //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
Copy(
|
|
||||||
priceZoneObjs,
|
|
||||||
drawnObjects,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
Copy(
|
|
||||||
decisionZoneObjs,
|
|
||||||
drawnObjects,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
Copy(
|
|
||||||
marketStructureObjs,
|
|
||||||
drawnObjects,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
result = ArraySize(drawnObjects);
|
result = ArraySize(drawnObjects);
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,36 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// 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 < 10)
|
||||||
|
{
|
||||||
|
value = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mMaxAllowedRequiredPOIs = value;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides Actions ...
|
// Overrides Actions ...
|
||||||
|
|
||||||
@@ -488,13 +518,30 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
mAnalyseCycleHelper,
|
mAnalyseCycleHelper,
|
||||||
mVerificationCycleHelper,
|
mVerificationCycleHelper,
|
||||||
mConsolidationCycleHelper,
|
mConsolidationCycleHelper,
|
||||||
mVisionCycleHelper //
|
mVisionCycleHelper,
|
||||||
|
mPOIDrawer //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
setupDir = mXTWPVConditions.dir;
|
setupDir = mXTWPVConditions.dir;
|
||||||
setupTime = mXTWPVConditions.setupTime;
|
setupTime = mXTWPVConditions.setupTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// if (mXTWPVConditions.HasPriceZone())
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// XCBaseObject *objects[];
|
||||||
|
// mPOIDrawer.DrawPriceZone(
|
||||||
|
// mXTWPVConditions.priceZone,
|
||||||
|
// objects //
|
||||||
|
// );
|
||||||
|
|
||||||
|
// //
|
||||||
|
// Print("");
|
||||||
|
// }
|
||||||
|
|
||||||
|
//
|
||||||
result = isSetuped;
|
result = isSetuped;
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
@@ -553,16 +600,17 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
conditions.target = mXTWPVConditions.target;
|
conditions.target = mXTWPVConditions.target;
|
||||||
|
|
||||||
//
|
//
|
||||||
conditions.decisionZones = mXTWPVConditions.decisionZone;
|
// TODO: Remove ...
|
||||||
conditions.marketStructure = mXTWPVConditions.analyseMarketStructure;
|
// conditions.decisionZones = mXTWPVConditions.decisionZone;
|
||||||
if (isBullish)
|
// conditions.marketStructure = mXTWPVConditions.analyseMarketStructure;
|
||||||
{
|
// if (isBullish)
|
||||||
conditions.priceZones = mXTWPVConditions.valePriceZone;
|
// {
|
||||||
}
|
// conditions.priceZones = mXTWPVConditions.valePriceZone;
|
||||||
else
|
// }
|
||||||
{
|
// else
|
||||||
conditions.priceZones = mXTWPVConditions.peakPriceZone;
|
// {
|
||||||
}
|
// conditions.priceZones = mXTWPVConditions.peakPriceZone;
|
||||||
|
// }
|
||||||
|
|
||||||
//
|
//
|
||||||
mXTWPVConditions.Clean();
|
mXTWPVConditions.Clean();
|
||||||
@@ -577,6 +625,9 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
int mMaxAllowedRequiredPOIs; // Max Allowed Required POI(s) to Find ...
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initial Required Indicators Helper ...
|
* Initial Required Indicators Helper ...
|
||||||
*/
|
*/
|
||||||
@@ -586,6 +637,12 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
string symbol = GetSymbol();
|
string symbol = GetSymbol();
|
||||||
ENUM_TIMEFRAMES period = GetPeriod();
|
ENUM_TIMEFRAMES period = GetPeriod();
|
||||||
|
|
||||||
|
//
|
||||||
|
if (mMaxAllowedRequiredPOIs <= 0)
|
||||||
|
{
|
||||||
|
mMaxAllowedRequiredPOIs = 50;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Short ...
|
// Short ...
|
||||||
ENUM_X_PERIOD_METHOD scMethod = X_PERIOD_AUTO; // How to Find Period
|
ENUM_X_PERIOD_METHOD scMethod = X_PERIOD_AUTO; // How to Find Period
|
||||||
@@ -613,6 +670,9 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
//
|
//
|
||||||
x121Inputs.Default();
|
x121Inputs.Default();
|
||||||
|
|
||||||
|
//
|
||||||
|
x121Inputs.showRSI = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isInited = false;
|
bool isInited = false;
|
||||||
|
|
||||||
@@ -629,6 +689,11 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
x121Inputs.xpvInputs.hcMethod = hcMethod;
|
x121Inputs.xpvInputs.hcMethod = hcMethod;
|
||||||
x121Inputs.xpvInputs.hcPeriod = hcPeriod;
|
x121Inputs.xpvInputs.hcPeriod = hcPeriod;
|
||||||
|
|
||||||
|
//
|
||||||
|
x121Inputs.xpvInputs.showSar = false;
|
||||||
|
x121Inputs.xpvInputs.showPeaks = false;
|
||||||
|
x121Inputs.xpvInputs.showVales = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XATR ...
|
// XATR ...
|
||||||
x121Inputs.xatrInputs.showATRUpper = false;
|
x121Inputs.xatrInputs.showATRUpper = false;
|
||||||
@@ -636,29 +701,36 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
|
|
||||||
//
|
//
|
||||||
// XSTR ...
|
// XSTR ...
|
||||||
|
x121Inputs.xstrInputs.showStr = false;
|
||||||
|
x121Inputs.xstrInputs.showStrUpper = false;
|
||||||
|
x121Inputs.xstrInputs.showStrLower = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XDON ...
|
// XDON ...
|
||||||
x121Inputs.xdonInputs.showOpen = false;
|
x121Inputs.xdonInputs.showOpen = false;
|
||||||
x121Inputs.xdonInputs.showClose = true;
|
x121Inputs.xdonInputs.showClose = false;
|
||||||
x121Inputs.xdonInputs.showLow = false;
|
x121Inputs.xdonInputs.showLow = false;
|
||||||
x121Inputs.xdonInputs.showHigh = false;
|
x121Inputs.xdonInputs.showHigh = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XVWAP ...
|
// XVWAP ...
|
||||||
x121Inputs.xvwapInputs.showVWapFast = true;
|
x121Inputs.xvwapInputs.showVWapFast = false;
|
||||||
x121Inputs.xvwapInputs.showVWapFast = true;
|
x121Inputs.xvwapInputs.showVWapFast = false;
|
||||||
x121Inputs.xvwapInputs.showVWapSlow = false;
|
x121Inputs.xvwapInputs.showVWapSlow = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize Cycle Helpers ...
|
// Initialize Cycle Helpers ...
|
||||||
|
|
||||||
|
//
|
||||||
|
int requiredPOIS = MaxAllowedRequiredPOIs();
|
||||||
|
|
||||||
//
|
//
|
||||||
mTriggerCycleHelper = new XC121SMCCycleHelper();
|
mTriggerCycleHelper = new XC121SMCCycleHelper();
|
||||||
isInited = mTriggerCycleHelper.Init(
|
isInited = mTriggerCycleHelper.Init(
|
||||||
symbol,
|
symbol,
|
||||||
PERIOD_M1,
|
PERIOD_M1,
|
||||||
x121Inputs //
|
x121Inputs,
|
||||||
|
requiredPOIS //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -666,7 +738,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
isInited = mDecisionCycleHelper.Init(
|
isInited = mDecisionCycleHelper.Init(
|
||||||
symbol,
|
symbol,
|
||||||
PERIOD_M5,
|
PERIOD_M5,
|
||||||
x121Inputs //
|
x121Inputs,
|
||||||
|
requiredPOIS //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -674,7 +747,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
isInited = mAnalyseCycleHelper.Init(
|
isInited = mAnalyseCycleHelper.Init(
|
||||||
symbol,
|
symbol,
|
||||||
PERIOD_M15,
|
PERIOD_M15,
|
||||||
x121Inputs //
|
x121Inputs,
|
||||||
|
requiredPOIS //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -682,7 +756,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
isInited = mVerificationCycleHelper.Init(
|
isInited = mVerificationCycleHelper.Init(
|
||||||
symbol,
|
symbol,
|
||||||
PERIOD_M30,
|
PERIOD_M30,
|
||||||
x121Inputs //
|
x121Inputs,
|
||||||
|
requiredPOIS //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -690,7 +765,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
isInited = mConsolidationCycleHelper.Init(
|
isInited = mConsolidationCycleHelper.Init(
|
||||||
symbol,
|
symbol,
|
||||||
PERIOD_H1,
|
PERIOD_H1,
|
||||||
x121Inputs //
|
x121Inputs,
|
||||||
|
requiredPOIS //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -698,7 +774,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
isInited = mVisionCycleHelper.Init(
|
isInited = mVisionCycleHelper.Init(
|
||||||
symbol,
|
symbol,
|
||||||
PERIOD_H4,
|
PERIOD_H4,
|
||||||
x121Inputs //
|
x121Inputs,
|
||||||
|
requiredPOIS //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user