last ...
This commit is contained in:
@@ -705,6 +705,13 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Bar Tracker if Waits ...
|
||||||
|
if (!mBarTracker.IsNewBar())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
mLock = true;
|
mLock = true;
|
||||||
@@ -1150,6 +1157,7 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
iBar.Clean();
|
iBar.Clean();
|
||||||
mLock = false;
|
mLock = false;
|
||||||
|
mBarTracker.Waits();
|
||||||
|
|
||||||
//
|
//
|
||||||
if (HasChild(events))
|
if (HasChild(events))
|
||||||
|
|||||||
@@ -0,0 +1,196 @@
|
|||||||
|
//+------------------------------------------------------------------+
|
||||||
|
//| HH_LH_LL_HL.mq5 |
|
||||||
|
//| Indicator for detecting HH, LH, LL, HL |
|
||||||
|
//| Created by [Your Name] |
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
|
||||||
|
#property copyright "Your Name"
|
||||||
|
#property link "yourwebsite.com"
|
||||||
|
#property version "1.00"
|
||||||
|
#property indicator_chart_window
|
||||||
|
#property indicator_buffers 4
|
||||||
|
#property indicator_plots 4
|
||||||
|
|
||||||
|
//--- Input parameters
|
||||||
|
input int LookbackPeriod = 20; // Number of bars to look back for pattern detection
|
||||||
|
|
||||||
|
//--- Buffer declarations
|
||||||
|
double HH_Buffer[]; // Buffer for Higher Highs
|
||||||
|
double HL_Buffer[]; // Buffer for Higher Lows
|
||||||
|
double LH_Buffer[]; // Buffer for Lower Highs
|
||||||
|
double LL_Buffer[]; // Buffer for Lower Lows
|
||||||
|
|
||||||
|
//--- Plot settings
|
||||||
|
#property indicator_label1 "Higher Highs"
|
||||||
|
#property indicator_type1 DRAW_ARROW
|
||||||
|
#property indicator_color1 clrGreen
|
||||||
|
#property indicator_style1 STYLE_SOLID
|
||||||
|
#property indicator_width1 1
|
||||||
|
|
||||||
|
#property indicator_label2 "Higher Lows"
|
||||||
|
#property indicator_type2 DRAW_ARROW
|
||||||
|
#property indicator_color2 clrBlue
|
||||||
|
#property indicator_style2 STYLE_SOLID
|
||||||
|
#property indicator_width2 1
|
||||||
|
|
||||||
|
#property indicator_label3 "Lower Highs"
|
||||||
|
#property indicator_type3 DRAW_ARROW
|
||||||
|
#property indicator_color3 clrRed
|
||||||
|
#property indicator_style3 STYLE_SOLID
|
||||||
|
#property indicator_width3 1
|
||||||
|
|
||||||
|
#property indicator_label4 "Lower Lows"
|
||||||
|
#property indicator_type4 DRAW_ARROW
|
||||||
|
#property indicator_color4 clrYellow
|
||||||
|
#property indicator_style4 STYLE_SOLID
|
||||||
|
#property indicator_width4 1
|
||||||
|
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
//| Initialization function |
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
int OnInit()
|
||||||
|
{
|
||||||
|
// Set buffer properties
|
||||||
|
SetIndexBuffer(0, HH_Buffer);
|
||||||
|
SetIndexBuffer(1, HL_Buffer);
|
||||||
|
SetIndexBuffer(2, LH_Buffer);
|
||||||
|
SetIndexBuffer(3, LL_Buffer);
|
||||||
|
|
||||||
|
// Clear buffers at each bar
|
||||||
|
ArrayInitialize(HH_Buffer, 0.0);
|
||||||
|
ArrayInitialize(HL_Buffer, 0.0);
|
||||||
|
ArrayInitialize(LH_Buffer, 0.0);
|
||||||
|
ArrayInitialize(LL_Buffer, 0.0);
|
||||||
|
|
||||||
|
return(INIT_SUCCEEDED);
|
||||||
|
}
|
||||||
|
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
//| Deinitialization function |
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
void OnDeinit(const int reason)
|
||||||
|
{
|
||||||
|
// Cleanup if necessary
|
||||||
|
}
|
||||||
|
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
//| Calculate function |
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
int OnCalculate(const int rates_total,
|
||||||
|
const int prev_calculated,
|
||||||
|
const datetime &time[],
|
||||||
|
const double &open[],
|
||||||
|
const double &high[],
|
||||||
|
const double &low[],
|
||||||
|
const double &close[],
|
||||||
|
const long &tick_volume[],
|
||||||
|
const long &volume[],
|
||||||
|
const int &spread[])
|
||||||
|
{
|
||||||
|
// Start from the last calculated bar
|
||||||
|
int start_bar = MathMax(prev_calculated - 1, 0);
|
||||||
|
|
||||||
|
// Loop through bars
|
||||||
|
for (int i = start_bar; i < rates_total; i++)
|
||||||
|
{
|
||||||
|
// Get current high and low
|
||||||
|
double current_high = high[i];
|
||||||
|
double current_low = low[i];
|
||||||
|
|
||||||
|
// Check for Higher High (HH)
|
||||||
|
if (IsHigherHigh(i, high, LookbackPeriod))
|
||||||
|
{
|
||||||
|
HH_Buffer[i] = current_high;
|
||||||
|
HL_Buffer[i] = 0.0; // Reset other buffers
|
||||||
|
LH_Buffer[i] = 0.0;
|
||||||
|
LL_Buffer[i] = 0.0;
|
||||||
|
}
|
||||||
|
// Check for Higher Low (HL)
|
||||||
|
else if (IsHigherLow(i, low, LookbackPeriod))
|
||||||
|
{
|
||||||
|
HL_Buffer[i] = current_low;
|
||||||
|
HH_Buffer[i] = 0.0;
|
||||||
|
LH_Buffer[i] = 0.0;
|
||||||
|
LL_Buffer[i] = 0.0;
|
||||||
|
}
|
||||||
|
// Check for Lower High (LH)
|
||||||
|
else if (IsLowerHigh(i, high, LookbackPeriod))
|
||||||
|
{
|
||||||
|
LH_Buffer[i] = current_high;
|
||||||
|
HH_Buffer[i] = 0.0;
|
||||||
|
HL_Buffer[i] = 0.0;
|
||||||
|
LL_Buffer[i] = 0.0;
|
||||||
|
}
|
||||||
|
// Check for Lower Low (LL)
|
||||||
|
else if (IsLowerLow(i, low, LookbackPeriod))
|
||||||
|
{
|
||||||
|
LL_Buffer[i] = current_low;
|
||||||
|
HH_Buffer[i] = 0.0;
|
||||||
|
HL_Buffer[i] = 0.0;
|
||||||
|
LH_Buffer[i] = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Reset all buffers if no pattern is detected
|
||||||
|
HH_Buffer[i] = 0.0;
|
||||||
|
HL_Buffer[i] = 0.0;
|
||||||
|
LH_Buffer[i] = 0.0;
|
||||||
|
LL_Buffer[i] = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return rates_total;
|
||||||
|
}
|
||||||
|
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
//| Function to detect Higher High |
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
bool IsHigherHigh(int index, const double &high[], int lookback)
|
||||||
|
{
|
||||||
|
for (int i = 1; i <= lookback; i++)
|
||||||
|
{
|
||||||
|
if (index - i < 0) continue; // Ensure we don't go out of bounds
|
||||||
|
if (high[index] <= high[index - i]) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
//| Function to detect Higher Low |
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
bool IsHigherLow(int index, const double &low[], int lookback)
|
||||||
|
{
|
||||||
|
for (int i = 1; i <= lookback; i++)
|
||||||
|
{
|
||||||
|
if (index - i < 0) continue; // Ensure we don't go out of bounds
|
||||||
|
if (low[index] <= low[index - i]) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
//| Function to detect Lower High |
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
bool IsLowerHigh(int index, const double &high[], int lookback)
|
||||||
|
{
|
||||||
|
for (int i = 1; i <= lookback; i++)
|
||||||
|
{
|
||||||
|
if (index - i < 0) continue; // Ensure we don't go out of bounds
|
||||||
|
if (high[index] >= high[index - i]) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
//| Function to detect Lower Low |
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
bool IsLowerLow(int index, const double &low[], int lookback)
|
||||||
|
{
|
||||||
|
for (int i = 1; i <= lookback; i++)
|
||||||
|
{
|
||||||
|
if (index - i < 0) continue; // Ensure we don't go out of bounds
|
||||||
|
if (low[index] >= low[index - i]) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
+742
-335
File diff suppressed because it is too large
Load Diff
@@ -109,8 +109,8 @@ struct X121XVWAPInputs
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
vwapFastLength = 20;
|
vwapFastLength = 20;
|
||||||
vwapMidLength = 40;
|
vwapMidLength = 50;
|
||||||
vwapSlowLength = 60;
|
vwapSlowLength = 100;
|
||||||
vwapAppliedTo = PRICE_CLOSE;
|
vwapAppliedTo = PRICE_CLOSE;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -3646,7 +3646,7 @@ int ExtractOBFVGs(
|
|||||||
XPOIState &fvgState,
|
XPOIState &fvgState,
|
||||||
//
|
//
|
||||||
ENUM_X_OBFVG_FVG_FILTERS filterFVGs = X_OBFVG_FVG_FILTER_INSIDE_OR,
|
ENUM_X_OBFVG_FVG_FILTERS filterFVGs = X_OBFVG_FVG_FILTER_INSIDE_OR,
|
||||||
ENUM_X_OBFVG_FVG_SELECTION selectFVG = X_OBFVG_FVG_SELECT_HIGHEST_LOWEST,
|
ENUM_X_OBFVG_FVG_SELECTION selectFVG = X_OBFVG_FVG_SELECT_OLDEST,
|
||||||
//
|
//
|
||||||
ENUM_TIMEFRAMES forPeriod = NULL,
|
ENUM_TIMEFRAMES forPeriod = NULL,
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -312,6 +312,9 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Setup Conditions ...
|
// Setup Conditions ...
|
||||||
|
XOBFVG selectedZone;
|
||||||
|
bool hasSelectedZone = false;
|
||||||
|
bool isSelectedZoneReversal = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// First We Have to Has Working Zone ...
|
// First We Have to Has Working Zone ...
|
||||||
@@ -358,7 +361,44 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
workingZone.HasInsideZones();
|
workingZone.HasInsideZones();
|
||||||
if (hasInsideZones)
|
if (hasInsideZones)
|
||||||
{
|
{
|
||||||
Print("Has Inside Zones");
|
//
|
||||||
|
int selectedIDX = -1;
|
||||||
|
int count = workingZone.CountInsideZones();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool has = CheckOBFVGXWZConditions(
|
||||||
|
isSelectedZoneReversal,
|
||||||
|
workingZone.insideZones[i],
|
||||||
|
decisionState,
|
||||||
|
decisionXConditions //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
selectedIDX = i;
|
||||||
|
selectedZone = workingZone.insideZones[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (IsValidIndex(selectedIDX))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ArrayRemove(
|
||||||
|
workingZone.insideZones,
|
||||||
|
selectedIDX,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
hasSelectedZone = selectedZone.IsValid();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -366,7 +406,55 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
workingZone.HasBreakedZones();
|
workingZone.HasBreakedZones();
|
||||||
if (hasBreakedZones)
|
if (hasBreakedZones)
|
||||||
{
|
{
|
||||||
Print("Has Breaked Zones");
|
//
|
||||||
|
if (!hasSelectedZone)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int selectedIDX = -1;
|
||||||
|
int count = workingZone.CountBreakedZones();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool has = CheckOBFVGXWZConditions(
|
||||||
|
isSelectedZoneReversal,
|
||||||
|
workingZone.breakedZones[i],
|
||||||
|
decisionState,
|
||||||
|
decisionXConditions //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
selectedIDX = i;
|
||||||
|
selectedZone = workingZone.breakedZones[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (IsValidIndex(selectedIDX))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ArrayRemove(
|
||||||
|
workingZone.breakedZones,
|
||||||
|
selectedIDX,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
hasSelectedZone = selectedZone.IsValid();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (hasSelectedZone)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Print("Has Selected Zone ...");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -378,14 +466,15 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
//
|
//
|
||||||
workingZone.Draw(
|
workingZone.Draw(
|
||||||
drawer,
|
drawer,
|
||||||
true, // Force Clean ...
|
true, // Draw Waiting Zones ..
|
||||||
true,
|
true, // Draw Inside Zones ..
|
||||||
true,
|
true, // Draw Breaked Zones ..
|
||||||
true,
|
false, // Draw Supply Zone ..
|
||||||
true,
|
false, // Draw Demand Zone ..
|
||||||
true,
|
false, // Draw Supply Zones ..
|
||||||
true,
|
false, // Draw Demand Zones ..
|
||||||
true //
|
false, // Draw Support Zones ..
|
||||||
|
false // Draw Resistance Zones ..
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,10 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
XOBFVG waitingZones[];
|
XOBFVG waitingZones[];
|
||||||
|
|
||||||
//
|
//
|
||||||
CArrayObj mObjects;
|
CArrayObj mInsideZoneObjects;
|
||||||
|
CArrayObj mBreakedZoneObjects;
|
||||||
|
CArrayObj mWaitingZoneObjects;
|
||||||
|
CArrayObj mWorkingZoneObjects;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor ...
|
// Constructor ...
|
||||||
@@ -121,7 +124,10 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
ZeroMemory(demandZone);
|
ZeroMemory(demandZone);
|
||||||
|
|
||||||
//
|
//
|
||||||
mObjects.Clear();
|
mInsideZoneObjects.Clear();
|
||||||
|
mBreakedZoneObjects.Clear();
|
||||||
|
mWaitingZoneObjects.Clear();
|
||||||
|
mWorkingZoneObjects.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -352,6 +358,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
// Detect OBFVG(s) ...
|
||||||
ExtractOBFVGs(
|
ExtractOBFVGs(
|
||||||
waitingZones,
|
waitingZones,
|
||||||
mtfState,
|
mtfState,
|
||||||
@@ -1088,14 +1095,39 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
has = HasInsideZones();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = CountInsideZones();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
insideZones[i].UpdateTo(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
has = HasBreakedZones();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = CountBreakedZones();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
breakedZones[i].UpdateTo(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
void Draw(
|
void Draw(
|
||||||
XCPOIDrawer *drawer,
|
XCPOIDrawer *drawer,
|
||||||
bool forceClean = false,
|
|
||||||
bool drawWaitingZones = true,
|
bool drawWaitingZones = true,
|
||||||
|
bool drawInsideZones = false,
|
||||||
|
bool drawBreakedZones = false,
|
||||||
bool drawSupplyZone = false,
|
bool drawSupplyZone = false,
|
||||||
bool drawDemandZone = false,
|
bool drawDemandZone = false,
|
||||||
bool drawSupplyZones = false,
|
bool drawSupplyZones = false,
|
||||||
@@ -1110,12 +1142,6 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
if (forceClean)
|
|
||||||
{
|
|
||||||
mObjects.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
int count = 0;
|
int count = 0;
|
||||||
bool has = false;
|
bool has = false;
|
||||||
@@ -1145,7 +1171,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
//
|
//
|
||||||
if (isCreated)
|
if (isCreated)
|
||||||
{
|
{
|
||||||
mObjects.Add(iObj);
|
mWorkingZoneObjects.Add(iObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1172,7 +1198,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
//
|
//
|
||||||
if (isCreated)
|
if (isCreated)
|
||||||
{
|
{
|
||||||
mObjects.Add(iObj);
|
mWorkingZoneObjects.Add(iObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1196,7 +1222,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
//
|
//
|
||||||
if (isCreated)
|
if (isCreated)
|
||||||
{
|
{
|
||||||
mObjects.Add(iObj);
|
mWorkingZoneObjects.Add(iObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1223,7 +1249,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
//
|
//
|
||||||
if (isCreated)
|
if (isCreated)
|
||||||
{
|
{
|
||||||
mObjects.Add(iObj);
|
mWorkingZoneObjects.Add(iObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1251,7 +1277,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
//
|
//
|
||||||
if (isCreated)
|
if (isCreated)
|
||||||
{
|
{
|
||||||
mObjects.Add(iObj);
|
mWorkingZoneObjects.Add(iObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1279,7 +1305,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
//
|
//
|
||||||
if (isCreated)
|
if (isCreated)
|
||||||
{
|
{
|
||||||
mObjects.Add(iObj);
|
mWorkingZoneObjects.Add(iObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1309,7 +1335,73 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
//
|
//
|
||||||
for (int j = 0; j < objectsCount; j++)
|
for (int j = 0; j < objectsCount; j++)
|
||||||
{
|
{
|
||||||
mObjects.Add(objects[j]);
|
mWaitingZoneObjects.Add(objects[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Inside Zones ...
|
||||||
|
if (drawInsideZones)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
has = HasInsideZones();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = CountInsideZones();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCBaseObject *objects[];
|
||||||
|
int objectsCount = drawer.DrawOBFVG(
|
||||||
|
insideZones[i],
|
||||||
|
objects //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
has = IsValidSize(objectsCount);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < objectsCount; i++)
|
||||||
|
{
|
||||||
|
mInsideZoneObjects.Add(objects[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Breaked Zones ...
|
||||||
|
if (drawBreakedZones)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
has = HasBreakedZones();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = CountBreakedZones();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCBaseObject *objects[];
|
||||||
|
int objectsCount = drawer.DrawOBFVG(
|
||||||
|
breakedZones[i],
|
||||||
|
objects //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
has = IsValidSize(objectsCount);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < objectsCount; i++)
|
||||||
|
{
|
||||||
|
mBreakedZoneObjects.Add(objects[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1348,7 +1440,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
zoneUpperLine.Color(clrRed);
|
zoneUpperLine.Color(clrRed);
|
||||||
|
|
||||||
//
|
//
|
||||||
mObjects.Add(zoneUpperLine);
|
mWaitingZoneObjects.Add(zoneUpperLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1367,7 +1459,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
zoneLowerLine.Color(clrRed);
|
zoneLowerLine.Color(clrRed);
|
||||||
|
|
||||||
//
|
//
|
||||||
mObjects.Add(zoneLowerLine);
|
mWaitingZoneObjects.Add(zoneLowerLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1386,7 +1478,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
upperLine.Color(clrLime);
|
upperLine.Color(clrLime);
|
||||||
|
|
||||||
//
|
//
|
||||||
mObjects.Add(upperLine);
|
mWaitingZoneObjects.Add(upperLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1405,7 +1497,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
lowerLine.Color(clrLime);
|
lowerLine.Color(clrLime);
|
||||||
|
|
||||||
//
|
//
|
||||||
mObjects.Add(lowerLine);
|
mWaitingZoneObjects.Add(lowerLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1427,7 +1519,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
q1Line.Color(clrYellow);
|
q1Line.Color(clrYellow);
|
||||||
|
|
||||||
//
|
//
|
||||||
mObjects.Add(q1Line);
|
mWaitingZoneObjects.Add(q1Line);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1446,7 +1538,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
q2Line.Color(clrYellow);
|
q2Line.Color(clrYellow);
|
||||||
|
|
||||||
//
|
//
|
||||||
mObjects.Add(q2Line);
|
mWaitingZoneObjects.Add(q2Line);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1465,7 +1557,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
q3Line.Color(clrYellow);
|
q3Line.Color(clrYellow);
|
||||||
|
|
||||||
//
|
//
|
||||||
mObjects.Add(q3Line);
|
mWaitingZoneObjects.Add(q3Line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1660,4 +1752,216 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extension Functions ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check an XOBFVG instance has Required Conditions ...
|
||||||
|
*
|
||||||
|
* @param zone: XOBFVG instance ...
|
||||||
|
* @param state: XPOIState instance ...
|
||||||
|
* @param conditions: X121Conditions instance ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool CheckOBFVGXWZConditions(
|
||||||
|
bool &isReversal,
|
||||||
|
XOBFVG &zone,
|
||||||
|
XPOIState &state,
|
||||||
|
X121Conditions &conditions //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
isReversal = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
zone.IsValid() &&
|
||||||
|
state.IsValid() &&
|
||||||
|
state.HasChild();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = zone.IsBullish();
|
||||||
|
bool isBearish = zone.IsBearish();
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullishTrend = conditions.isTrendBullish ||
|
||||||
|
conditions.isTrendSwitchedToBullish;
|
||||||
|
bool isBearishTrend = conditions.isTrendBearish ||
|
||||||
|
conditions.isTrendSwitchedToBearish;
|
||||||
|
|
||||||
|
//
|
||||||
|
double bullishScore = 0;
|
||||||
|
double bearishScore = 0;
|
||||||
|
conditions.GenerateScore(
|
||||||
|
bullishScore,
|
||||||
|
bearishScore //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// VWap ...
|
||||||
|
|
||||||
|
//
|
||||||
|
double vwapFast = conditions.vwapFastBuffer[0];
|
||||||
|
double vwapMid = conditions.vwapMidBuffer[0];
|
||||||
|
double vwapSlow = conditions.vwapSlowBuffer[0];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isVWapInside =
|
||||||
|
//
|
||||||
|
vwapFast > zone.ob.Lower() &&
|
||||||
|
vwapFast < zone.ob.Upper()
|
||||||
|
//
|
||||||
|
&&
|
||||||
|
vwapMid > zone.ob.Lower() &&
|
||||||
|
vwapMid < zone.ob.Upper()
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isVWapBullish =
|
||||||
|
//
|
||||||
|
(conditions.isVWapBullishState &&
|
||||||
|
conditions.isVWapSwitchedToBullishOrdered)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(conditions.isVWapBullishOrdered &&
|
||||||
|
conditions.isVWapSwitchedToBullishState)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isVWapBearish =
|
||||||
|
//
|
||||||
|
(conditions.isVWapBearishState &&
|
||||||
|
conditions.isVWapSwitchedToBearishOrdered)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(conditions.isVWapBearishOrdered &&
|
||||||
|
conditions.isVWapSwitchedToBearishState)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
// X3Ma ...
|
||||||
|
|
||||||
|
//
|
||||||
|
double x3maFast = conditions.x3maFastBuffer[0];
|
||||||
|
double x3maMid = conditions.x3maMidBuffer[0];
|
||||||
|
double x3maSlow = conditions.x3maSlowBuffer[0];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isX3MaInside =
|
||||||
|
//
|
||||||
|
x3maFast > zone.ob.Lower() &&
|
||||||
|
x3maFast < zone.ob.Upper()
|
||||||
|
//
|
||||||
|
&&
|
||||||
|
x3maMid > zone.ob.Lower() &&
|
||||||
|
x3maMid < zone.ob.Upper()
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isX3MaBullish =
|
||||||
|
//
|
||||||
|
(conditions.isX3MaBullishState &&
|
||||||
|
conditions.isX3MaSwitchedToBullishOrdered)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(conditions.isX3MaBullishOrdered &&
|
||||||
|
conditions.isX3MaSwitchedToBullishState)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isX3MaBearish =
|
||||||
|
//
|
||||||
|
(conditions.isX3MaBearishState &&
|
||||||
|
conditions.isX3MaSwitchedToBearishOrdered)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(conditions.isX3MaBearishOrdered &&
|
||||||
|
conditions.isX3MaSwitchedToBearishState)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isInside =
|
||||||
|
//
|
||||||
|
isVWapInside ||
|
||||||
|
isX3MaInside
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isVWap3MaBullish =
|
||||||
|
isVWapBullish ||
|
||||||
|
isX3MaBullish;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isVWap3MaBearish =
|
||||||
|
isVWapBearish ||
|
||||||
|
isX3MaBearish;
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isDirectionalBullishPassed =
|
||||||
|
//
|
||||||
|
isInside &&
|
||||||
|
isBullish &&
|
||||||
|
isBullishTrend &&
|
||||||
|
isVWap3MaBullish &&
|
||||||
|
bullishScore > 0 &&
|
||||||
|
bearishScore >= 0 &&
|
||||||
|
bullishScore > bearishScore
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isDirectionalBearishPassed =
|
||||||
|
//
|
||||||
|
isInside &&
|
||||||
|
isBearish &&
|
||||||
|
isBearishTrend &&
|
||||||
|
isVWap3MaBearish &&
|
||||||
|
bearishScore > 0 &&
|
||||||
|
bullishScore >= 0 &&
|
||||||
|
bearishScore > bullishScore
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isInside)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Print("X3MA VWAP Inside ...");
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isDirectionalBullishPassed ||
|
||||||
|
isDirectionalBearishPassed;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
Reference in New Issue
Block a user