This commit is contained in:
2024-12-30 22:20:32 +03:30
parent 0bfed000db
commit 8d90d3bcc2
8 changed files with 258 additions and 6565 deletions
+8 -5
View File
@@ -1755,24 +1755,27 @@ class XCSignalObject : public XCBaseObject
*/ */
bool Create( bool Create(
long chart_id, long chart_id,
const string name,
const int window, const int window,
XSignal &signal // XSignal &signal,
string prefix = NULL //
) )
{ {
// //
bool result = false; bool result = false;
// //
result = IsValid(name) && result = signal.IsValid();
signal
.IsValid();
if (!result) if (!result)
{ {
return result; return result;
} }
// //
string name = signal.GetTag();
if (IsValid(prefix))
{
name = prefix + "_" + name;
}
string nameMD5 = ToMD5(name); string nameMD5 = ToMD5(name);
// //
+61 -14
View File
@@ -2487,12 +2487,6 @@ class XCPOIDrawer : public XCBase
long chartID = ChartIdentification(); long chartID = ChartIdentification();
int window = SubWindowIdentification(); int window = SubWindowIdentification();
//
// bool fill = BearishFVGFill();
// int width = BearishFVGWidth();
// color crl = BearishFVGColor();
// ENUM_LINE_STYLE style = BearishFVGStyle();
// //
object = new XCTicksZoneObject(); object = new XCTicksZoneObject();
result = object.Create( result = object.Create(
@@ -2513,6 +2507,49 @@ class XCPOIDrawer : public XCBase
return result; return result;
} }
/**
* Create Consolidation Zone Object ...
*
* @param zone: XConsolidationZone instance Reference ...
*
* @return ( bool )
*/
bool CreateConsolidationZone(
XConsolidationZone &zone,
XCConsolidationZoneObject *&object //
)
{
//
bool result = false;
//
object = NULL;
//
result = zone.IsValid();
if (!result)
{
return result;
}
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
object = new XCConsolidationZoneObject();
result = object.Create(
chartID,
window,
zone,
prefix //
);
//
return result;
}
/** /**
* Draw Specified Signal ... * Draw Specified Signal ...
* *
@@ -2537,13 +2574,17 @@ class XCPOIDrawer : public XCBase
} }
// //
string name = signal.GetTag(); string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
object = new XCSignalObject(); object = new XCSignalObject();
result = object.Create( result = object.Create(
ChartIdentification(), chartID,
name, window,
SubWindowIdentification(), signal,
signal // prefix //
); );
if (!result) if (!result)
{ {
@@ -3155,14 +3196,20 @@ class XCPOIDrawer : public XCBase
return result; return result;
} }
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
// //
// Draw Pivot it self ... // Draw Pivot it self ...
XCXPVPivotObject *iPivotObj; XCXPVPivotObject *iPivotObj;
iPivotObj = new XCXPVPivotObject(); iPivotObj = new XCXPVPivotObject();
bool isCreated = iPivotObj.Create( bool isCreated = iPivotObj.Create(
ChartIdentification(), chartID,
SubWindowIdentification(), window,
pivot // pivot,
prefix //
); );
if (!isCreated) if (!isCreated)
{ {
-758
View File
@@ -1,758 +0,0 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Helper Class Library
// ----------------------------------------------
// Name: XSCX3MAHelper
// Description: provides all Indicator
// Helper requirements ...
//
//
// 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-saherelm.x-helper.class.mq5"
//
// Definitions ...
//
enum ENUM_X3MA_BUFFERS
{
//
X3MA_FAST_LINE = 0,
X3MA_MID_LINE = 1,
X3MA_SLOW_LINE = 2,
};
//
// Input Models ...
struct X3MAInputs
{
//
// Props ...
//
// Market ...
int fastLength; // Fast Length
int midLength; // Mid Length
int slowLength; // Slow Length
int shiftLength; // Shift
ENUM_MA_METHOD method; // Mode
ENUM_APPLIED_PRICE appliedTo; // Applied To
//
// Presentation ...
//
bool showFast; // Show Fast
bool showMid; // Show Mid
bool showSlow; // Show Slow
//
// Constructor(s) ...
X3MAInputs()
{
//
Clean();
}
//
// Tools ...
//
// Clean ...
void Clean()
{
//
fastLength = 0;
midLength = 0;
slowLength = 0;
shiftLength = 0;
method = MODE_SMA;
appliedTo = PRICE_CLOSE;
//
showFast = false;
showMid = false;
showSlow = false;
}
//
// Default ...
void Default()
{
//
fastLength = 50;
midLength = 100;
slowLength = 200;
shiftLength = 0;
method = MODE_SMA;
appliedTo = PRICE_CLOSE;
//
showFast = true;
showMid = true;
showSlow = true;
}
//
// Validate ...
bool IsValid()
{
//
bool result = false;
//
result =
//
fastLength > 2 &&
midLength > fastLength &&
slowLength > midLength &&
//
shiftLength >= 0
//
;
//
return result;
}
//
// Retrieve MAx Length ...
int Max()
{
//
int result = 0;
//
result = MathMax(fastLength, midLength);
result = MathMax(result, slowLength);
//
return result;
}
};
//
// Define Conditions ...
struct X3MAConditions
{
//
// Common ...
string symbol;
ENUM_TIMEFRAMES period;
datetime time;
//
// Buffers ...
//
double fasts[];
double mids[];
double slows[];
//
// Conditions ...
//
bool isFastOverMid;
bool isMidOverSlow;
//
bool isFastUnderMid;
bool isMidUnderSlow;
//
bool isBullishOrdered;
bool isBearishOrdered;
//
bool isSwitchedToBullishOrdered;
bool isSwitchedToBearishOrdered;
//
void X3MAConditions()
{
Clean();
}
//
void Clean()
{
//
Clean(fasts);
Clean(mids);
Clean(slows);
//
ArraySetAsSeries(fasts, true);
ArraySetAsSeries(mids, true);
ArraySetAsSeries(slows, true);
//
isFastOverMid = false;
isMidOverSlow = false;
isFastUnderMid = false;
isMidUnderSlow = false;
isBullishOrdered = false;
isBearishOrdered = false;
isSwitchedToBullishOrdered = false;
isSwitchedToBearishOrdered = false;
}
//
void GenerateScore(
double &bullishScore,
double &bearishScore //
)
{
//
bullishScore = 0;
bearishScore = 0;
//
// Since We have to Use this
// Only for Filtering Signals ...
// We Can Ignore Scoring ...
// or Complete this later ...
}
//
string GenerateSummary(
bool onlyCommons = false,
bool onlyConditions = false,
bool includeScores = true,
bool ignoreFalseConditions = true,
string separator = "\n" //
)
{
//
string result = NULL;
//
double bullishScore = 0;
double bearishScore = 0;
GenerateScore(
bullishScore,
bearishScore //
);
//
string scoresStr =
//
"Scores: " + separator +
"---------------" + separator +
"Bullish: " + ToString(bullishScore) + separator +
"Bearish: " + ToString(bearishScore) + separator +
""
//
;
//
string commonStr = GenerateSpecifiedCommonSummary(
this,
separator,
includeScores //
);
//
string conditionsStr =
//
""
//
;
//
result =
//
"[" + GetTag() + "]" + separator +
(onlyConditions
? ""
: commonStr) +
(!includeScores
? ""
: scoresStr) +
" " + separator +
(onlyCommons
? ""
: conditionsStr) +
""
//
;
//
return result;
}
//
string GetTag()
{
return "X3MA";
}
};
//
// Class ...
class XCX3MAHelper : public XCBaseHelper
{
//
// Public ...
public:
//
// Props ...
//
// Constructors ...
XCX3MAHelper()
: XCBaseHelper(_Symbol, _Period)
{
}
//
// Deconstructor ...
~XCX3MAHelper()
{
//
Clean(fastBuffer);
Clean(midBuffer);
Clean(slowBuffer);
}
//
// Tools ...
bool Init(
string symbol, // Trading Symbol
ENUM_TIMEFRAMES period, // Trading Period
X3MAInputs &inputs // Inputs
)
{
//
bool result = false;
//
mSymbol = symbol;
mPeriod = period;
//
result = inputs.IsValid();
if (!result)
{
return result;
}
//
mInputs = inputs;
//
ArraySetAsSeries(fastBuffer, true);
ArraySetAsSeries(midBuffer, true);
ArraySetAsSeries(slowBuffer, true);
//
mHandler = iCustom(
mSymbol,
mPeriod,
"x-saherelm.x3ma",
//
// Inputs ...
//
// Market ...
"",
mInputs.fastLength,
mInputs.midLength,
mInputs.slowLength,
mInputs.shiftLength,
mInputs.method,
mInputs.appliedTo,
//
// Presentation ...
"",
//
mInputs.showFast,
mInputs.showMid,
mInputs.showSlow
//
);
result = mHandler != INVALID_HANDLE;
if (!result)
{
return result;
}
//
return result;
}
//
// Inputs ...
//
X3MAInputs GetInputs()
{
return mInputs;
}
//
bool SetInputs(
X3MAInputs &inputs // Configs
)
{
//
return Init(
mSymbol,
mPeriod,
inputs
//
);
}
//
// Buffers ...
//
double GetFast(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(fastBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return fastBuffer[barIndex];
}
//
// Copy Required Items ...
int CopyFast(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
fastBuffer,
buffer,
forceClean
//
);
}
//
double GetMid(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(midBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return midBuffer[barIndex];
}
//
// Copy Required Items ...
int CopyMid(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
midBuffer,
buffer,
forceClean
//
);
}
//
double GetSlow(
int barIndex // Bar Index
)
{
//
if (barIndex < 0)
{
barIndex = 0;
}
//
Calculate();
//
int count = ArraySize(slowBuffer);
if (barIndex >= count)
{
barIndex = count - 1;
}
//
return slowBuffer[barIndex];
}
//
// Copy Required Items ...
int CopySlow(
int start, // Start
int count, // Number of Items for read
double &buffer[], // Dest Buffer
bool forceClean = true // Force To Clean buffer
)
{
//
// Update Calculations ...
Calculate();
//
// Copy Items ...
return Copy(
start,
count,
slowBuffer,
buffer,
forceClean
//
);
}
//
// Conditions ...
//
bool GetConditions(
X3MAConditions &conditions, //
int barIndex = 0, //
int loopback = 5 //
)
{
//
bool result = true;
//
if (loopback < 3)
{
loopback = 3;
}
//
conditions.Clean();
//
conditions.symbol = mSymbol;
conditions.period = mPeriod;
conditions.time = TimeCurrent();
//
int zIndex = barIndex;
int cIndex = zIndex + 1;
int pIndex = cIndex + 1;
int ppIndex = pIndex + 1;
//
// Buffers ...
//
// Fast ...
CopyFast(
zIndex,
loopback,
conditions.fasts //
);
//
// Mid ...
CopyMid(
zIndex,
loopback,
conditions.mids //
);
//
// Slow ...
CopySlow(
zIndex,
loopback,
conditions.slows //
);
//
// Conditions ...
//
bool isFastOverMid =
conditions.fasts[cIndex] > conditions.mids[cIndex];
bool isFastOverMidPrev =
conditions.fasts[pIndex] > conditions.mids[pIndex];
//
bool isMidOverSlow =
conditions.mids[cIndex] > conditions.slows[cIndex];
bool isMidOverSlowPrev =
conditions.mids[pIndex] > conditions.slows[pIndex];
//
bool isFastUnderMid =
conditions.fasts[cIndex] < conditions.mids[cIndex];
bool isFastUnderMidPrev =
conditions.fasts[pIndex] < conditions.mids[pIndex];
//
bool isMidUnderSlow =
conditions.mids[cIndex] < conditions.slows[cIndex];
bool isMidUnderSlowPrev =
conditions.mids[pIndex] < conditions.slows[pIndex];
//
bool isBullishOrdered = isFastOverMid &&
isMidOverSlow;
bool isBullishOrderedPrev = isFastOverMidPrev &&
isMidOverSlowPrev;
//
bool isBearishOrdered = isFastUnderMid &&
isMidUnderSlow;
bool isBearishOrderedPrev = isFastUnderMidPrev &&
isMidUnderSlowPrev;
//
bool isSwitchedToBullishOrdered = isBullishOrdered &&
!isBullishOrderedPrev;
bool isSwitchedToBearishOrdered = isBearishOrdered &&
!isBearishOrderedPrev;
//
conditions.isFastOverMid = isFastOverMid;
conditions.isMidOverSlow = isMidOverSlow;
conditions.isFastUnderMid = isFastUnderMid;
conditions.isMidUnderSlow = isMidUnderSlow;
conditions.isBullishOrdered = isBullishOrdered;
conditions.isBearishOrdered = isBearishOrdered;
conditions.isSwitchedToBullishOrdered = isSwitchedToBullishOrdered;
conditions.isSwitchedToBearishOrdered = isSwitchedToBearishOrdered;
//
return result;
}
//
// Protected ...
protected:
//
// Private ...
private:
//
// Props ...
X3MAInputs mInputs; // Inputs ...
//
// Buffers ...
double fastBuffer[];
double midBuffer[];
double slowBuffer[];
//
// Tools ...
//
// Calculate Values Until Now ...
void Calculate()
{
//
int totalBars = CountBars();
if (totalBars > 1000)
{
totalBars = 1000;
}
//
// Fast ...
CopyBuffer(
mHandler,
X3MA_FAST_LINE,
0,
totalBars,
fastBuffer
//
);
//
// Mid ...
CopyBuffer(
mHandler,
X3MA_MID_LINE,
0,
totalBars,
midBuffer
//
);
//
// Slow ...
CopyBuffer(
mHandler,
X3MA_SLOW_LINE,
0,
totalBars,
slowBuffer
//
);
}
};
//
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+112 -85
View File
@@ -122,6 +122,9 @@ struct X121SMCStrategyXTWPVSignalConditions
double point; double point;
XPVPivot pivot; XPVPivot pivot;
//
XConsolidationZone consolidationZone;
// //
string method; string method;
@@ -256,6 +259,7 @@ struct X121SMCStrategyXTWPVSignalConditions
// //
point = 0; point = 0;
pivot.Clean(); pivot.Clean();
consolidationZone.Clean();
// //
method = NULL; method = NULL;
@@ -419,6 +423,16 @@ struct X121SMCStrategyXTWPVSignalConditions
return pivot.IsValid(); return pivot.IsValid();
} }
/**
* Check Model Has Consolidation Zone or not ...
*
* @return ( bool )
*/
bool HasConsolidationZone()
{
return consolidationZone.IsValid();
}
// //
}; };
@@ -515,14 +529,6 @@ bool DetectX121SMCXTWPVSiganlSetup(
double llDown = cBar.FindLowesttDown(swingLoopback); double llDown = cBar.FindLowesttDown(swingLoopback);
double hhUp = cBar.FindHighestUp(swingLoopback); double hhUp = cBar.FindHighestUp(swingLoopback);
//
int zoneValidationDivider = 10;
int validPivotRepetition = triggerCycleHelper.mX121Helper
.GetDonChainLength();
//
double selectedSL = 0;
// //
// Cycles Conditions ... // Cycles Conditions ...
@@ -640,36 +646,43 @@ bool DetectX121SMCXTWPVSiganlSetup(
// //
// Setup Conditions ... // Setup Conditions ...
// // //
// Select Sources ... // // Select Sources ...
XC121SMCCycleHelper *helper = analyseCycleHelper; // XC121SMCCycleHelper *helper = analyseCycleHelper;
X121SMCCycleConditions helperConditions = analyseConditions; // X121SMCCycleConditions helperConditions = analyseConditions;
XPOIState helperState = analyseState; // XPOIState helperState = analyseState;
// //
// Instance Helper CBar ... XOHCL analyseCBar;
XOHCL helperCBar; result = analyseCycleHelper.GetBar(
result = helper.GetBar(
cBar, cBar,
helperCBar // analyseCBar //
); );
if (!result) if (!result)
{ {
return result; return result;
} }
//
XOHCL analysePBar;
result = analyseCBar.GetPreviousBar(analysePBar);
if (!result)
{
return result;
}
// //
double bullishFib = GetFibonacciLevel( double bullishFib = GetFibonacciLevel(
helperCBar.high, analyseCBar.high,
helperCBar.low, analyseCBar.low,
GetFiboLevelValue(X_FIBO_LEVEL_382), GetFiboLevelValue(X_FIBO_LEVEL_382),
-1 // -1 //
); );
// //
double bearishFib = GetFibonacciLevel( double bearishFib = GetFibonacciLevel(
helperCBar.high, analyseCBar.high,
helperCBar.low, analyseCBar.low,
GetFiboLevelValue(X_FIBO_LEVEL_382), GetFiboLevelValue(X_FIBO_LEVEL_382),
1 // 1 //
); );
@@ -705,12 +718,12 @@ bool DetectX121SMCXTWPVSiganlSetup(
// //
XPVPivot peakPivot; XPVPivot peakPivot;
bool hasPeakPivot = helper bool hasPeakPivot = analyseCycleHelper
.GetActivePeakPivot(peakPivot); .GetActivePeakPivot(peakPivot);
// //
XPVPivot valePivot; XPVPivot valePivot;
bool hasValePivot = helper bool hasValePivot = analyseCycleHelper
.GetActiveValePivot(valePivot); .GetActiveValePivot(valePivot);
// //
@@ -755,7 +768,7 @@ bool DetectX121SMCXTWPVSiganlSetup(
{ {
// //
conditions.pivot.to = cTime; conditions.pivot.to = cTime;
helper.FillPivotState(conditions.pivot); analyseCycleHelper.FillPivotState(conditions.pivot);
// //
// Check Pivot Renewation ... // Check Pivot Renewation ...
@@ -886,24 +899,24 @@ bool DetectX121SMCXTWPVSiganlSetup(
// PV Conditions ... // PV Conditions ...
// //
double peak = helperConditions.x121Conditions.peaksBuffer[1]; double analysePeak = analyseConditions.x121Conditions.peaksBuffer[1];
double peakPrev = helperConditions.x121Conditions.peaksBuffer[2]; double analysePeakPrev = analyseConditions.x121Conditions.peaksBuffer[2];
double peakDiff = MathAbs(peakPrev - peak); double analysePeakDiff = MathAbs(analysePeakPrev - analysePeak);
// //
bool isNewPeak = helperConditions.x121Conditions.isNewPeak; bool isNewAnalysePeak = analyseConditions.x121Conditions.isNewPeak;
bool isNewPeakOverLast = helperConditions.x121Conditions.isNewPeakOverLast; bool isNewAnalysePeakOverLast = analyseConditions.x121Conditions.isNewPeakOverLast;
bool isNewPeakUnderLast = helperConditions.x121Conditions.isNewPeakUnderLast; bool isNewAnalysePeakUnderLast = analyseConditions.x121Conditions.isNewPeakUnderLast;
// //
double vale = helperConditions.x121Conditions.valesBuffer[1]; double analyseVale = analyseConditions.x121Conditions.valesBuffer[1];
double valePrev = helperConditions.x121Conditions.valesBuffer[2]; double analyseValePrev = analyseConditions.x121Conditions.valesBuffer[2];
double valeDiff = MathAbs(valePrev - vale); double analyseValeDiff = MathAbs(analyseValePrev - analyseVale);
// //
bool isNewVale = helperConditions.x121Conditions.isNewVale; bool isNewAnalyseVale = analyseConditions.x121Conditions.isNewVale;
bool isNewValeOverLast = helperConditions.x121Conditions.isNewValeOverLast; bool isNewAnalyseValeOverLast = analyseConditions.x121Conditions.isNewValeOverLast;
bool isNewValeUnderLast = helperConditions.x121Conditions.isNewValeUnderLast; bool isNewAnalyseValeUnderLast = analyseConditions.x121Conditions.isNewValeUnderLast;
// //
double triggerPeak = triggerConditions.x121Conditions.peaksBuffer[1]; double triggerPeak = triggerConditions.x121Conditions.peaksBuffer[1];
@@ -911,19 +924,19 @@ bool DetectX121SMCXTWPVSiganlSetup(
// //
int condition2MinPVDiffPoint = 30; int condition2MinPVDiffPoint = 30;
bool isPeakDiffPointPassed = peakDiff >= (condition2MinPVDiffPoint * points); bool isPeakDiffPointPassed = analysePeakDiff >= (condition2MinPVDiffPoint * points);
bool isValeDiffPointPassed = valeDiff >= (condition2MinPVDiffPoint * points); bool isValeDiffPointPassed = analyseValeDiff >= (condition2MinPVDiffPoint * points);
// //
// DONCHAIN Conditions ... // DONCHAIN Conditions ...
// // //
double donCloseUpper = helperConditions.x121Conditions.donCloseUpperBuffer[1]; // double analyseDonCloseUpper = analyseConditions.x121Conditions.donCloseUpperBuffer[1];
double donCloseLower = helperConditions.x121Conditions.donCloseLowerBuffer[1]; // double analyseDonCloseLower = analyseConditions.x121Conditions.donCloseLowerBuffer[1];
// // //
double donOpenUpper = helperConditions.x121Conditions.donOpenUpperBuffer[1]; // double analyseonOpenUpper = analyseConditions.x121Conditions.donOpenUpperBuffer[1];
double donOpenLower = helperConditions.x121Conditions.donOpenLowerBuffer[1]; // double analyseonOpenLower = analyseConditions.x121Conditions.donOpenLowerBuffer[1];
// //
// OPEN ... // OPEN ...
@@ -1029,12 +1042,12 @@ bool DetectX121SMCXTWPVSiganlSetup(
// //
; ;
// // //
if (isRejectDonUpper || // if (isRejectDonUpper ||
isRejectDonLower) // isRejectDonLower)
{ // {
Print("Don Rejected ..."); // Print("Don Rejected ...");
} // }
// //
bool isBreakedDonUpper = bool isBreakedDonUpper =
@@ -1073,12 +1086,12 @@ bool DetectX121SMCXTWPVSiganlSetup(
// //
// false // false
hasBullishTrend && hasBullishTrend &&
isNewPeakOverLast &&
isBullishFiboPassed && isBullishFiboPassed &&
helperCBar.IsBullish() && analyseCBar.IsBullish() &&
conditions.pivot.upper < peak && isNewAnalysePeakOverLast &&
conditions.pivot.upper < helperCBar.GetUp() && conditions.pivot.upper < analysePeak &&
conditions.pivot.upper > helperCBar.GetDown() conditions.pivot.upper < analyseCBar.GetUp() &&
conditions.pivot.upper > analyseCBar.GetDown()
// //
; ;
if (bullishConditions1) if (bullishConditions1)
@@ -1094,12 +1107,12 @@ bool DetectX121SMCXTWPVSiganlSetup(
// //
// false // false
hasBearishTrend && hasBearishTrend &&
isNewValeUnderLast &&
isBearishFiboPassed && isBearishFiboPassed &&
helperCBar.IsBearish() && analyseCBar.IsBearish() &&
conditions.pivot.lower > vale && isNewAnalyseValeUnderLast &&
conditions.pivot.lower < helperCBar.GetUp() && conditions.pivot.lower > analyseVale &&
conditions.pivot.lower > helperCBar.GetDown() conditions.pivot.lower < analyseCBar.GetUp() &&
conditions.pivot.lower > analyseCBar.GetDown()
// //
; ;
if (bearishConditions1) if (bearishConditions1)
@@ -1126,7 +1139,7 @@ bool DetectX121SMCXTWPVSiganlSetup(
if (bullishConditions2) if (bullishConditions2)
{ {
// //
conditions.point = vale; conditions.point = analyseVale;
conditions.method = ToString(X_X121SMC_XTWPV_METHOD_2); conditions.method = ToString(X_X121SMC_XTWPV_METHOD_2);
} }
@@ -1144,7 +1157,7 @@ bool DetectX121SMCXTWPVSiganlSetup(
if (bearishConditions2) if (bearishConditions2)
{ {
// //
conditions.point = peak; conditions.point = analysePeak;
conditions.method = ToString(X_X121SMC_XTWPV_METHOD_2); conditions.method = ToString(X_X121SMC_XTWPV_METHOD_2);
} }
@@ -1161,7 +1174,7 @@ bool DetectX121SMCXTWPVSiganlSetup(
if (bullishConditions3) if (bullishConditions3)
{ {
// //
conditions.point = vale; conditions.point = analyseVale;
conditions.method = ToString(X_X121SMC_XTWPV_METHOD_3); conditions.method = ToString(X_X121SMC_XTWPV_METHOD_3);
} }
@@ -1175,7 +1188,7 @@ bool DetectX121SMCXTWPVSiganlSetup(
if (bearishConditions3) if (bearishConditions3)
{ {
// //
conditions.point = peak; conditions.point = analysePeak;
conditions.method = ToString(X_X121SMC_XTWPV_METHOD_3); conditions.method = ToString(X_X121SMC_XTWPV_METHOD_3);
} }
@@ -1306,22 +1319,30 @@ bool DetectX121SMCXTWPVSiganlTrigger(
return result; return result;
} }
//
XOHCL pBar;
result = pBar.Init(
symbol,
period,
pIndex //
);
if (!result)
{
return result;
}
// //
double ask = GetAsk(symbol); double ask = GetAsk(symbol);
double bid = GetBid(symbol); double bid = GetBid(symbol);
datetime cTime = TimeCurrent(); datetime cTime = TimeCurrent();
double points = GetPoints(symbol);
// //
double ll = cBar.FindLowest(9, MODE_LOW); int swingLoopback = 9;
double hh = cBar.FindHighest(9, MODE_HIGH); double ll = cBar.FindLowest(swingLoopback, MODE_LOW);
double hh = cBar.FindHighest(swingLoopback, MODE_HIGH);
// double llDown = cBar.FindLowesttDown(swingLoopback);
int zoneValidationDivider = 10; double hhUp = cBar.FindHighestUp(swingLoopback);
int validPivotRepetition = triggerCycleHelper.mX121Helper
.GetDonChainLength();
//
double selectedSL = 0;
// //
// Cycles Conditions ... // Cycles Conditions ...
@@ -1471,21 +1492,30 @@ bool DetectX121SMCXTWPVSiganlTrigger(
// //
// Detect Consolidation ... // Detect Consolidation ...
XConsolidationZone consolidationZone; bool hasConsolidationZone = conditions.HasConsolidationZone();
bool hasConsolidationZone = triggerCycleHelper if (hasConsolidationZone)
.GetLastConsolidationZone(consolidationZone); {
//
hasConsolidationZone = triggerCycleHelper
.GetLastConsolidationZone(conditions.consolidationZone);
//
if (hasConsolidationZone) if (hasConsolidationZone)
{ {
// //
hasConsolidationZone = hasConsolidationZone =
isBullish isBullish
? consolidationZone.upper <= conditions.point ? conditions.consolidationZone.upper <= conditions.point
: consolidationZone.lower >= conditions.point; : conditions.consolidationZone.lower >= conditions.point;
// //
if (!hasConsolidationZone) if (!hasConsolidationZone)
{ {
consolidationZone.Clean(); //
conditions
.consolidationZone
.Clean();
}
} }
} }
@@ -1551,9 +1581,6 @@ bool DetectX121SMCXTWPVSiganlTrigger(
Opposit(setupDir) // Opposit(setupDir) //
); );
//
double points = GetPoints(conditions.symbol);
// //
double entry = GetEntry( double entry = GetEntry(
conditions.symbol, conditions.symbol,
@@ -1569,14 +1596,14 @@ bool DetectX121SMCXTWPVSiganlTrigger(
if (isBullish) if (isBullish)
{ {
Add( Add(
consolidationZone.lower, conditions.consolidationZone.lower,
sls // sls //
); );
} }
else else
{ {
Add( Add(
consolidationZone.upper, conditions.consolidationZone.upper,
sls // sls //
); );
} }
+73 -45
View File
@@ -281,6 +281,16 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
// //
result = PrepareSignal(signal); result = PrepareSignal(signal);
//
if (result)
{
//
// TODO: Remove this ...
XCSignalObject *iObj;
mPOIDrawer.DrawSignal(signal, iObj);
Print("");
}
// //
hasLong = false; hasLong = false;
hasShort = false; hasShort = false;
@@ -712,56 +722,74 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
// Handle Required Drawings ... // Handle Required Drawings ...
bool hasPivot = mXTWPVConditions.HasPivot(); bool hasPivot = mXTWPVConditions.HasPivot();
bool hasPriceInsideZone = mXTWPVConditions.HasPriceInsideZones(); bool hasPriceInsideZone = mXTWPVConditions.HasPriceInsideZones();
bool hasConsolidationZone = mXTWPVConditions.HasConsolidationZone();
bool canDraw = hasPivot || bool canDraw = hasPivot ||
hasPriceInsideZone; hasPriceInsideZone ||
hasConsolidationZone;
if (canDraw) if (canDraw)
{ {
// // //
// ClearDraws(); ClearDraws();
// // //
// // Draw Pivot Zone ... // Draw Consolidation Zone ...
// if (hasPivot) if (hasConsolidationZone)
// { {
// // //
// XCBaseObject *drawnObjects[]; XCConsolidationZoneObject *iObj;
// int drawnObjectsCount = DrawXTWPVPivotZone( bool isCreated = mPOIDrawer.CreateConsolidationZone(
// mXTWPVConditions, mXTWPVConditions.consolidationZone,
// mPOIDrawer, iObj //
// drawnObjects, );
// true, // Draw State ... if (isCreated)
// true, // Draw Ticks Zone ... {
// true, // Ignore SwingHighs ... AddObjectIfNotExists(iObj);
// true, // Ignore SwingLows ... }
// true, // Ignore SupportZones ... }
// true, // Ignore ResistanceZones ...
// true, // Ignore SupplyZones ...
// true, // Ignore DemandZones ...
// true, // Ignore BullishOrderBlocks ...
// true, // Ignore BearishOrderBlocks ...
// true, // Ignore BullishFairValueGaps ...
// true, // Ignore BearishFairValueGaps ...
// true, // Ignore BullishRejectionBars ...
// true, // Ignore BearishRejectionBars ...
// true, // Ignore BullishMomentumBars ...
// true // Ignore BearishMomentumBars ...
// );
// AddObjectsIfNotExists(drawnObjects);
// }
// // //
// // Draw Price Inside Zones ... // Draw Pivot Zone ...
// if (hasPriceInsideZone) if (hasPivot)
// { {
// // //
// XCBaseObject *drawnObjects[]; XCBaseObject *drawnObjects[];
// int drawnObjectsCount = DrawTWPVPriceInsideZones( int drawnObjectsCount = DrawXTWPVPivotZone(
// mXTWPVConditions, mXTWPVConditions,
// mPOIDrawer, mPOIDrawer,
// drawnObjects // drawnObjects,
// ); false, // Draw State ...
// AddObjectsIfNotExists(drawnObjects); false, // Draw Ticks Zone ...
// } true, // Ignore SwingHighs ...
true, // Ignore SwingLows ...
true, // Ignore SupportZones ...
true, // Ignore ResistanceZones ...
true, // Ignore SupplyZones ...
true, // Ignore DemandZones ...
true, // Ignore BullishOrderBlocks ...
true, // Ignore BearishOrderBlocks ...
true, // Ignore BullishFairValueGaps ...
true, // Ignore BearishFairValueGaps ...
true, // Ignore BullishRejectionBars ...
true, // Ignore BearishRejectionBars ...
true, // Ignore BullishMomentumBars ...
true // Ignore BearishMomentumBars ...
);
AddObjectsIfNotExists(drawnObjects);
}
//
// Draw Price Inside Zones ...
if (hasPriceInsideZone)
{
//
XCBaseObject *drawnObjects[];
int drawnObjectsCount = DrawTWPVPriceInsideZones(
mXTWPVConditions,
mPOIDrawer,
drawnObjects //
);
AddObjectsIfNotExists(drawnObjects);
}
} }
// //