last works ...

This commit is contained in:
2025-09-23 23:47:18 +03:30
parent 727344d27a
commit 05d6c4afd7
4 changed files with 344 additions and 69 deletions
+103
View File
@@ -375,6 +375,16 @@ class XCBaseObject : public CChartObject
mObjName = value; mObjName = value;
} }
/**
* Destroy ...
*/
void virtual Destroy()
{
//
Detach();
Delete();
}
// //
private: private:
// //
@@ -1666,6 +1676,20 @@ class XCPivotAnalysisObject : public XCBaseObject
return X_PIVOT_OBJ; return X_PIVOT_OBJ;
} }
/**
* Destroy ...
*/
void virtual Destroy()
{
//
Detach();
Delete();
//
DestroyObject(mSupportBox);
DestroyObject(mResistanceBox);
}
// //
// Styling ... // Styling ...
@@ -2082,4 +2106,83 @@ class XCPivotAnalysisObject : public XCBaseObject
XCBoxObject *mResistanceBox; XCBoxObject *mResistanceBox;
}; };
//
// Extensions ...
/**
* Add all Items of Specified CArrayObj into another ...
*
* @param source: CArrayObj, pointer refrence Specified Data Source ...
* @param dest: CArrayObj, pointer refrence Specified Destination of Adding ...
*/
void AddObjects(
CArrayObj *&source,
CArrayObj &dest //
)
{
//
bool has = source != NULL &&
source.Total() > 0;
if (!has)
{
return;
}
//
for (int i = 0; i < source.Total(); i++)
{
dest.Add(source.At(i));
}
}
/**
* Destroy Object if Exists ...
*
* @param object: pointer refrence to Destroy ...
*/
void DestroyObject(XCBoxObject *&object) {
//
// Validate ...
bool has = object != NULL;
if (!has) {
return;
}
//
object.Destroy();
//
object.Detach();
object.Delete();
//
delete object;
ZeroMemory(object);
}
/**
* Destroy Object if Exists ...
*
* @param object: pointer refrence to Destroy ...
*/
void DestroyObject(XCPivotAnalysisObject *&object) {
//
// Validate ...
bool has = object != NULL;
if (!has) {
return;
}
//
object.Destroy();
//
object.Detach();
object.Delete();
//
delete object;
ZeroMemory(object);
}
// //
-29
View File
@@ -29,35 +29,6 @@
// //
// Definitions ... // Definitions ...
//
// Extensions ...
/**
* Add all Items of Specified CArrayObj into another ...
*
* @param source: CArrayObj, pointer refrence Specified Data Source ...
* @param dest: CArrayObj, pointer refrence Specified Destination of Adding ...
*/
void AddObjects(
CArrayObj *&source,
CArrayObj &dest //
)
{
//
bool has = source != NULL &&
source.Total() > 0;
if (!has)
{
return;
}
//
for (int i = 0; i < source.Total(); i++)
{
dest.Add(source.At(i));
}
}
// //
// Implementations ... // Implementations ...
class XCPOIDrawer : public XCBase class XCPOIDrawer : public XCBase
+106 -40
View File
@@ -150,6 +150,12 @@ XCXFIMAStrategy2Signaller *fima2Signaller; // XFIMA2 Signaller ...
// Drawer and eaDraws ... // Drawer and eaDraws ...
CArrayObj eaDraws; // Drawn Objects ... CArrayObj eaDraws; // Drawn Objects ...
//
XCPivotAnalysisObject *pvAnalysisObject; // PV Analysis Object ...
XCPivotAnalysisObject *maAnalysisObject; // MA Analysis Object ...
XCPivotAnalysisObject *sarAnalysisObject; // SAR Analysis Object ...
XCPivotAnalysisObject *zigzagAnalysisObject; // ZigZag Analysis Object ...
// //
XBarTracker eaBarTracker; // EA Bar Traker ... XBarTracker eaBarTracker; // EA Bar Traker ...
@@ -810,8 +816,8 @@ void DetectPatterns()
bool detectSwingTrendBreakes = false; bool detectSwingTrendBreakes = false;
// //
bool detectSupports = true; bool detectSupports = false;
bool detectResistance = true; bool detectResistance = false;
// //
// XFIMA Patetrns ... // XFIMA Patetrns ...
@@ -827,6 +833,10 @@ void DetectPatterns()
bool analyseFIMASARPivots = true; bool analyseFIMASARPivots = true;
bool analyseFIMAZigZagPivots = true; bool analyseFIMAZigZagPivots = true;
//
// Required Pivots ...
int numberOfRequiredPivots = 15;
// //
// Checking Momentum Bar ... // Checking Momentum Bar ...
if (detectMomentum) if (detectMomentum)
@@ -1161,11 +1171,11 @@ void DetectPatterns()
// //
XPivot pivots[]; XPivot pivots[];
int pivotsCount = fima2Signaller.poiDetector.ExtractPVPivots( int pivotsCount = fima2Signaller.poiDetector.ExtractPVPivots(
pivots, // Result ... pivots, // Result ...
cBar.Index(), // Bar Index ... cBar.Index(), // Bar Index ...
50, // Required Number of Pivots ... numberOfRequiredPivots, // Required Number of Pivots ...
1500, // Max Allowed Loopback ... 1500, // Max Allowed Loopback ...
10 // Validation Length ... 10 // Validation Length ...
); );
has = IsValidSize(pivotsCount); has = IsValidSize(pivotsCount);
if (has) if (has)
@@ -1186,7 +1196,7 @@ void DetectPatterns()
); );
// //
Print("Pivots Extracted ..."); // Print("Pivots Extracted ...");
} }
// //
@@ -1201,11 +1211,11 @@ void DetectPatterns()
// //
XPivot pivots[]; XPivot pivots[];
int pivotsCount = fima2Signaller.poiDetector.ExtractMAPivots( int pivotsCount = fima2Signaller.poiDetector.ExtractMAPivots(
pivots, // Result ... pivots, // Result ...
cBar.Index(), // Bar Index ... cBar.Index(), // Bar Index ...
50, // Required Number of Pivots ... numberOfRequiredPivots, // Required Number of Pivots ...
1500, // Max Allowed Loopback ... 1500, // Max Allowed Loopback ...
0 // Validation Length ... 0 // Validation Length ...
); );
has = IsValidSize(pivotsCount); has = IsValidSize(pivotsCount);
if (has) if (has)
@@ -1226,7 +1236,7 @@ void DetectPatterns()
); );
// //
Print("Pivots Extracted ..."); // Print("Pivots Extracted ...");
} }
// //
@@ -1241,10 +1251,10 @@ void DetectPatterns()
// //
XPivot pivots[]; XPivot pivots[];
int pivotsCount = fima2Signaller.poiDetector.ExtractSARPivots( int pivotsCount = fima2Signaller.poiDetector.ExtractSARPivots(
pivots, // Result ... pivots, // Result ...
cBar.Index(), // Bar Index ... cBar.Index(), // Bar Index ...
50, // Required Number of Pivots ... numberOfRequiredPivots, // Required Number of Pivots ...
1500 // Max Allowed Loopback ... 1500 // Max Allowed Loopback ...
); );
has = IsValidSize(pivotsCount); has = IsValidSize(pivotsCount);
if (has) if (has)
@@ -1265,7 +1275,7 @@ void DetectPatterns()
); );
// //
Print("Pivots Extracted ..."); // Print("Pivots Extracted ...");
} }
// //
@@ -1281,8 +1291,8 @@ void DetectPatterns()
XPivot pivots[]; XPivot pivots[];
int pivotsCount = fima2Signaller.poiDetector.ExtractZigZagPivots( int pivotsCount = fima2Signaller.poiDetector.ExtractZigZagPivots(
pivots, pivots,
0, cBar.Index(),
50, numberOfRequiredPivots,
1500 // 1500 //
); );
has = IsValidSize(pivotsCount); has = IsValidSize(pivotsCount);
@@ -1304,7 +1314,7 @@ void DetectPatterns()
); );
// //
Print("Pivots Extracted ..."); // Print("Pivots Extracted ...");
} }
// //
@@ -1317,33 +1327,34 @@ void DetectPatterns()
// //
// Analyse Based on PV ... // Analyse Based on PV ...
if (analyseFIMAPVPivots && false) if (analyseFIMAPVPivots)
{ {
// //
XPivotAnalysis analysis; XPivotAnalysis analysis;
has = fima2Signaller.poiDetector.AnalysePVPivots( has = fima2Signaller.poiDetector.AnalysePVPivots(
analysis, // Result ... analysis, // Result ...
cBar.Index(), // Bar Index ... cBar.Index(), // Bar Index ...
50, // Required Number of Pivots ... numberOfRequiredPivots, // Required Number of Pivots ...
1500, // Max Allowed Loopback ... 1500, // Max Allowed Loopback ...
10 // Validation Length ... 10 // Validation Length ...
); );
if (has) if (has)
{ {
// //
// Draw Analysis ... // Draw Analysis ...
XCPivotAnalysisObject *iObj; DestroyObject(pvAnalysisObject);
has = fima2Signaller.poiDrawer.DrawPivotAnalysis( has = fima2Signaller.poiDrawer.DrawPivotAnalysis(
analysis, analysis,
iObj // pvAnalysisObject,
true // Draw Pivots ...
); );
if (has) if (has)
{ {
// //
eaDraws.Add(iObj); // eaDraws.Add(iObj);
// //
Print("FIMA PV Pivots Analysed ..."); // Print("FIMA PV Pivots Analysed ...");
} }
} }
} }
@@ -1352,12 +1363,67 @@ void DetectPatterns()
// Analyse Based on MA ... // Analyse Based on MA ...
if (analyseFIMAMAPivots) if (analyseFIMAMAPivots)
{ {
//
XPivotAnalysis analysis;
has = fima2Signaller.poiDetector.AnalyseMAPivots(
analysis, // Result ...
cBar.Index(), // Bar Index ...
numberOfRequiredPivots, // Required Number of Pivots ...
1500, // Max Allowed Loopback ...
0 // Validation Length ...
);
if (has)
{
//
// Draw Analysis ...
DestroyObject(maAnalysisObject);
has = fima2Signaller.poiDrawer.DrawPivotAnalysis(
analysis,
maAnalysisObject,
true // Draw Pivots ...
);
if (has)
{
//
// eaDraws.Add(iObj);
//
// Print("FIMA MA Pivots Analysed ...");
}
}
} }
// //
// Analyse Based on SAR ... // Analyse Based on SAR ...
if (analyseFIMASARPivots) if (analyseFIMASARPivots)
{ {
//
XPivotAnalysis analysis;
has = fima2Signaller.poiDetector.AnalyseSARPivots(
analysis, // Result ...
cBar.Index(), // Bar Index ...
numberOfRequiredPivots, // Required Number of Pivots ...
1500 // Max Allowed Loopback ...
);
if (has)
{
//
// Draw Analysis ...
DestroyObject(sarAnalysisObject);
has = fima2Signaller.poiDrawer.DrawPivotAnalysis(
analysis,
sarAnalysisObject,
true // Draw Pivots ...
);
if (has)
{
//
// eaDraws.Add(iObj);
//
// Print("FIMA Sar Pivots Analysed ...");
}
}
} }
// //
@@ -1367,28 +1433,28 @@ void DetectPatterns()
// //
XPivotAnalysis analysis; XPivotAnalysis analysis;
has = fima2Signaller.poiDetector.AnalyseZigZagPivots( has = fima2Signaller.poiDetector.AnalyseZigZagPivots(
analysis, // Result ... analysis, // Result ...
0, // Bar Index ... cBar.Index(), // Bar Index ...
50, // Required Number of Pivots ... numberOfRequiredPivots, // Required Number of Pivots ...
1500 // Max Allowed Loopback ... 1500 // Max Allowed Loopback ...
); );
if (has) if (has)
{ {
// //
// Draw Analysis ... // Draw Analysis ...
XCPivotAnalysisObject *iObj; DestroyObject(zigzagAnalysisObject);
has = fima2Signaller.poiDrawer.DrawPivotAnalysis( has = fima2Signaller.poiDrawer.DrawPivotAnalysis(
analysis, analysis,
iObj, zigzagAnalysisObject,
true // Draw Pivots ... true // Draw Pivots ...
); );
if (has) if (has)
{ {
// //
eaDraws.Add(iObj); // eaDraws.Add(iObj);
// //
Print("FIMA ZigZag Pivots Analysed ..."); // Print("FIMA ZigZag Pivots Analysed ...");
} }
} }
} }
@@ -132,6 +132,141 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
return result; return result;
} }
/**
* Analyse Market based on Specified Kind of Pivots ...
*
* @param analysis: XPivotAnalysis, reference to hold result ...
* @param barIndex: int, Bar Index ...
* @param requiredNumberOFPivots: int, Specified which Number of Pivots must be Extracted ...
* @param maxAllowedLoopbackLength: int, Specified Maximum Loopback Length for Pivot Extraction ...
* @param validationLength: int, Specified Pivots Validation Length ignore if <= 0 ...
*
* @return ( bool )
*/
bool AnalyseMAPivots(
XPivotAnalysis &analysis,
int barIndex = 0,
int requiredNumberOFPivots = 50,
int maxAllowedLoopbackLength = 1500,
int validationLength = 0 //
)
{
//
bool result = false;
//
// Prepare ...
analysis.Clean();
//
// Reading Pivots ...
XPivot pivots[];
int count = ExtractMAPivots(
pivots, // Result ...
barIndex, // Bar Index ...
requiredNumberOFPivots, // Required Number of Pivots ...
maxAllowedLoopbackLength, // Max Allowed Loopback ...
validationLength // Validation Length ...
);
result = IsValidSize(count);
if (!result)
{
//
SpecifiedClean(pivots);
return result;
}
//
string symbol = fimaHelper.GetSymbol();
ENUM_TIMEFRAMES period = fimaHelper.GetPeriod();
//
// Initialize Analysis ...
result = analysis.Init(
"XFIMA_XMA",
symbol,
period,
pivots //
);
//
// Cleanup Resources ...
if (!result)
{
analysis.Clean();
}
SpecifiedClean(pivots);
//
return result;
}
/**
* Analyse Market based on Specified Kind of Pivots ...
*
* @param analysis: XPivotAnalysis, reference to hold result ...
* @param barIndex: int, Bar Index ...
* @param requiredNumberOFPivots: int, Specified which Number of Pivots must be Extracted ...
* @param maxAllowedLoopbackLength: int, Specified Maximum Loopback Length for Pivot Extraction ...
*
* @return ( bool )
*/
bool AnalyseSARPivots(
XPivotAnalysis &analysis,
int barIndex = 0,
int requiredNumberOFPivots = 50,
int maxAllowedLoopbackLength = 1500 //
)
{
//
bool result = false;
//
// Prepare ...
analysis.Clean();
//
// Reading Pivots ...
XPivot pivots[];
int count = ExtractSARPivots(
pivots, // Result ...
barIndex, // Bar Index ...
requiredNumberOFPivots, // Required Number of Pivots ...
maxAllowedLoopbackLength // Max Allowed Loopback ...
);
result = IsValidSize(count);
if (!result)
{
//
SpecifiedClean(pivots);
return result;
}
//
string symbol = fimaHelper.GetSymbol();
ENUM_TIMEFRAMES period = fimaHelper.GetPeriod();
//
// Initialize Analysis ...
result = analysis.Init(
"XFIMA_XSAR",
symbol,
period,
pivots //
);
//
// Cleanup Resources ...
if (!result)
{
analysis.Clean();
}
SpecifiedClean(pivots);
//
return result;
}
/** /**
* Analyse Market based on Specified Kind of Pivots ... * Analyse Market based on Specified Kind of Pivots ...
* *