last ...
This commit is contained in:
@@ -1601,6 +1601,67 @@ class XCBarAnalyser : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check Fibonacci Level 382 Pressure ...
|
||||||
|
*
|
||||||
|
* @param bar: XOHCL instance ...
|
||||||
|
* @param dir: ENUM_X_DIRECTION member ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool HasFiboPressure(
|
||||||
|
XOHCL &bar,
|
||||||
|
ENUM_X_DIRECTION &dir //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
dir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = bar.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double bearishFib382 = GetFibonacciLevel(
|
||||||
|
bar.high,
|
||||||
|
bar.low,
|
||||||
|
0.382,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
double bullishFib382 = GetFibonacciLevel(
|
||||||
|
bar.high,
|
||||||
|
bar.low,
|
||||||
|
0.382,
|
||||||
|
-1 //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = bar.GetDown() > bearishFib382;
|
||||||
|
bool isBearish = bar.GetUp() < bullishFib382;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
dir = isBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Support and Resistance Zones ...
|
// Support and Resistance Zones ...
|
||||||
|
|
||||||
|
|||||||
+3232
-2853
File diff suppressed because it is too large
Load Diff
@@ -463,287 +463,6 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
|
|
||||||
/**
|
|
||||||
* Detect Nearest Supply/Demand Zones ...
|
|
||||||
*
|
|
||||||
* @param bar: XOHCL instance, Start Bar ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool DetectValisSupplyZone(
|
|
||||||
XOHCL &bar,
|
|
||||||
XCSupplyZone *&supplyZone,
|
|
||||||
XCDemandZone *&demandZone //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
result = bar.IsValid();
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int index = bar.Index();
|
|
||||||
|
|
||||||
//
|
|
||||||
double bid = GetBid(bar.symbol);
|
|
||||||
double ask = GetAsk(bar.symbol);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Retrieve X121 Cnditions ...
|
|
||||||
int conditionsLoopback = 10;
|
|
||||||
X121Conditions x121Conditions;
|
|
||||||
result = mX121Helper.GetConditions(
|
|
||||||
x121Conditions,
|
|
||||||
index,
|
|
||||||
conditionsLoopback //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
int validPeaksCount = ArraySize(x121Conditions.validPeaksBuffer);
|
|
||||||
int validValesCount = ArraySize(x121Conditions.validValesBuffer);
|
|
||||||
|
|
||||||
//
|
|
||||||
XPOIState state;
|
|
||||||
ENUM_XPOI_EVENTS events[];
|
|
||||||
mPOIDetector.Update(events);
|
|
||||||
mPOIDetector.GetState(state);
|
|
||||||
result = state.IsValid() &&
|
|
||||||
state.HasChild();
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Supply Zones ...
|
|
||||||
XCSupplyZone *supplies[];
|
|
||||||
int suppliesCount = state.CountSupplyZones();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Select Bar Validated Supply Zones ...
|
|
||||||
if (IsValidSize(suppliesCount))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < suppliesCount; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCSupplyZone *iZone = state.supplyZones[i];
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check Zone is Valid For Bar ...
|
|
||||||
bool isValid = bar.high < iZone.Lower() &&
|
|
||||||
ask < iZone.Lower() &&
|
|
||||||
bid < iZone.Lower();
|
|
||||||
if (isValid)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Add(
|
|
||||||
iZone,
|
|
||||||
supplies //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
suppliesCount = ArraySize(supplies);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Select Valid Peaks Filtered Supplies ...
|
|
||||||
if (IsValidSize(suppliesCount))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Check Valid Peaks ...
|
|
||||||
XCSupplyZone *tmp[];
|
|
||||||
if (IsValidSize(validPeaksCount))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < suppliesCount; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCSupplyZone *iZone = supplies[i];
|
|
||||||
|
|
||||||
//
|
|
||||||
for (int j = 0; j < validPeaksCount; j++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
double value = x121Conditions.validPeaksBuffer[j];
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check Valid Peaks in Zone ...
|
|
||||||
bool isZoneContainsValidValue =
|
|
||||||
value >= iZone.Lower() &&
|
|
||||||
value <= iZone.Upper();
|
|
||||||
if (isZoneContainsValidValue)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Add(
|
|
||||||
iZone,
|
|
||||||
tmp //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
Clean(supplies);
|
|
||||||
Copy(
|
|
||||||
tmp,
|
|
||||||
supplies //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
suppliesCount = ArraySize(supplies);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Select Nearest Supply Zone ...
|
|
||||||
if (IsValidSize(suppliesCount))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Check Nearest Supplies ...
|
|
||||||
for (int i = 0; i < suppliesCount; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCSupplyZone *iZone = supplies[i];
|
|
||||||
if (supplyZone == NULL)
|
|
||||||
{
|
|
||||||
supplyZone = iZone;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool canChange =
|
|
||||||
iZone.Lower() < supplyZone.Lower();
|
|
||||||
if (canChange)
|
|
||||||
{
|
|
||||||
supplyZone = iZone;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Demand Zones ...
|
|
||||||
XCDemandZone *demands[];
|
|
||||||
int demandsCount = state.CountDemandZones();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Select Bar Validated Demand Zones ...
|
|
||||||
if (IsValidSize(demandsCount))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < demandsCount; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCDemandZone *iZone = state.demandZones[i];
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check Zone is Valid For Bar ...
|
|
||||||
bool isValid = bar.low > iZone.Upper() &&
|
|
||||||
ask > iZone.Upper() &&
|
|
||||||
bid > iZone.Upper();
|
|
||||||
if (isValid)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Add(
|
|
||||||
iZone,
|
|
||||||
demands //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
demandsCount = ArraySize(demands);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Select Valid Vales Filtered Demands ...
|
|
||||||
if (IsValidSize(demandsCount))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Check Valid Vales ...
|
|
||||||
XCDemandZone *tmp[];
|
|
||||||
if (IsValidSize(validValesCount))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < demandsCount; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCDemandZone *iZone = demands[i];
|
|
||||||
|
|
||||||
//
|
|
||||||
for (int j = 0; j < validValesCount; j++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
double value = x121Conditions.validValesBuffer[j];
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check Valid Peaks in Zone ...
|
|
||||||
bool isZoneContainsValidValue =
|
|
||||||
value >= iZone.Lower() &&
|
|
||||||
value <= iZone.Upper();
|
|
||||||
if (isZoneContainsValidValue)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Add(
|
|
||||||
iZone,
|
|
||||||
tmp //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
Clean(demands);
|
|
||||||
Copy(
|
|
||||||
tmp,
|
|
||||||
demands //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
demandsCount = ArraySize(demands);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Select Nearest Demand Zone ...
|
|
||||||
if (IsValidSize(demandsCount))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Check Nearest Demands ...
|
|
||||||
for (int i = 0; i < demandsCount; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCDemandZone *iZone = demands[i];
|
|
||||||
if (demandZone == NULL)
|
|
||||||
{
|
|
||||||
demandZone = iZone;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool canChange =
|
|
||||||
iZone.Upper() > demandZone.Upper();
|
|
||||||
if (canChange)
|
|
||||||
{
|
|
||||||
demandZone = iZone;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Validate Founded Zones ...
|
|
||||||
result = (supplyZone != NULL &&
|
|
||||||
supplyZone.IsValid()) &&
|
|
||||||
(demandZone != NULL &&
|
|
||||||
demandZone.IsValid());
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect XPV Based POI(s) ...
|
* Detect XPV Based POI(s) ...
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -470,7 +470,8 @@ struct XPVPivotPoint
|
|||||||
/**
|
/**
|
||||||
* Cleanup ...
|
* Cleanup ...
|
||||||
*/
|
*/
|
||||||
void Clean() {
|
void Clean()
|
||||||
|
{
|
||||||
//
|
//
|
||||||
value = 0;
|
value = 0;
|
||||||
repetition = 0;
|
repetition = 0;
|
||||||
@@ -479,19 +480,20 @@ struct XPVPivotPoint
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate ...
|
* Validate ...
|
||||||
*
|
*
|
||||||
* @return ( bool )
|
* @return ( bool )
|
||||||
*/
|
*/
|
||||||
bool IsValid() {
|
bool IsValid()
|
||||||
|
{
|
||||||
//
|
//
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
//
|
//
|
||||||
value > 0 &&
|
value > 0 &&
|
||||||
repetition > 0 &&
|
repetition > 0 &&
|
||||||
type != XPV_NONE
|
type != XPV_NONE
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -1965,5 +1967,195 @@ ENUM_X_121_SMC_PROVIDERS ParseProvider(string value)
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Custom Providers Conditions ...
|
// Custom Providers Conditions ...
|
||||||
|
struct XTestProiderConditions
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
string symbol;
|
||||||
|
ENUM_TIMEFRAMES period;
|
||||||
|
|
||||||
|
//
|
||||||
|
double sl;
|
||||||
|
ENUM_X_POSITION_TYPES type;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Setup Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isNewPeak;
|
||||||
|
bool isNewVale;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasVisionSupplyZone;
|
||||||
|
XCSupplyZone *visionSupplyZone;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasVisionDemandZone;
|
||||||
|
XCDemandZone *visionDemandZone;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasConsolidationSupportZone;
|
||||||
|
XCSupportZone *consolidationSupportZone;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasConsolidationResistanceZone;
|
||||||
|
XCResistanceZone *consolidationResistanceZone;
|
||||||
|
|
||||||
|
//
|
||||||
|
double peak;
|
||||||
|
double vale;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasSamePeaks;
|
||||||
|
bool hasSameVales;
|
||||||
|
|
||||||
|
//
|
||||||
|
datetime setupTime;
|
||||||
|
datetime triggerTime;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Trigger Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor ...
|
||||||
|
XTestProiderConditions()
|
||||||
|
{
|
||||||
|
Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tools ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleaning Up ...
|
||||||
|
*/
|
||||||
|
void Clean()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
sl = 0;
|
||||||
|
peak = 0;
|
||||||
|
vale = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
isNewPeak = false;
|
||||||
|
isNewVale = false;
|
||||||
|
hasSamePeaks = false;
|
||||||
|
hasSameVales = false;
|
||||||
|
hasVisionSupplyZone = false;
|
||||||
|
hasVisionDemandZone = false;
|
||||||
|
hasConsolidationSupportZone = false;
|
||||||
|
hasConsolidationResistanceZone = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
type = X_POSITION_TYPE_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
symbol = NULL;
|
||||||
|
period = NULL;
|
||||||
|
triggerTime = NULL;
|
||||||
|
setupTime = NULL;
|
||||||
|
visionSupplyZone = NULL;
|
||||||
|
visionDemandZone = NULL;
|
||||||
|
consolidationSupportZone = NULL;
|
||||||
|
consolidationResistanceZone = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check Condition is Setting Up ...
|
||||||
|
*
|
||||||
|
* @param dir: ENUM_X_DIRECTION member, Setting Up Direction ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool IsSetuped(
|
||||||
|
ENUM_X_DIRECTION &dir //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
dir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsValid(setupTime);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish =
|
||||||
|
//
|
||||||
|
isNewVale &&
|
||||||
|
hasSamePeaks &&
|
||||||
|
hasSameVales &&
|
||||||
|
hasVisionDemandZone &&
|
||||||
|
visionDemandZone != NULL &&
|
||||||
|
visionDemandZone.IsValid()
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBearish =
|
||||||
|
//
|
||||||
|
isNewPeak &&
|
||||||
|
hasSamePeaks &&
|
||||||
|
hasSameVales &&
|
||||||
|
hasVisionSupplyZone &&
|
||||||
|
visionSupplyZone != NULL &&
|
||||||
|
visionSupplyZone.IsValid()
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
dir =
|
||||||
|
isBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user