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;
}
/**
* Destroy ...
*/
void virtual Destroy()
{
//
Detach();
Delete();
}
//
private:
//
@@ -1666,6 +1676,20 @@ class XCPivotAnalysisObject : public XCBaseObject
return X_PIVOT_OBJ;
}
/**
* Destroy ...
*/
void virtual Destroy()
{
//
Detach();
Delete();
//
DestroyObject(mSupportBox);
DestroyObject(mResistanceBox);
}
//
// Styling ...
@@ -2082,4 +2106,83 @@ class XCPivotAnalysisObject : public XCBaseObject
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 ...
//
// 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 ...
class XCPOIDrawer : public XCBase
+106 -40
View File
@@ -150,6 +150,12 @@ XCXFIMAStrategy2Signaller *fima2Signaller; // XFIMA2 Signaller ...
// Drawer and eaDraws ...
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 ...
@@ -810,8 +816,8 @@ void DetectPatterns()
bool detectSwingTrendBreakes = false;
//
bool detectSupports = true;
bool detectResistance = true;
bool detectSupports = false;
bool detectResistance = false;
//
// XFIMA Patetrns ...
@@ -827,6 +833,10 @@ void DetectPatterns()
bool analyseFIMASARPivots = true;
bool analyseFIMAZigZagPivots = true;
//
// Required Pivots ...
int numberOfRequiredPivots = 15;
//
// Checking Momentum Bar ...
if (detectMomentum)
@@ -1161,11 +1171,11 @@ void DetectPatterns()
//
XPivot pivots[];
int pivotsCount = fima2Signaller.poiDetector.ExtractPVPivots(
pivots, // Result ...
cBar.Index(), // Bar Index ...
50, // Required Number of Pivots ...
1500, // Max Allowed Loopback ...
10 // Validation Length ...
pivots, // Result ...
cBar.Index(), // Bar Index ...
numberOfRequiredPivots, // Required Number of Pivots ...
1500, // Max Allowed Loopback ...
10 // Validation Length ...
);
has = IsValidSize(pivotsCount);
if (has)
@@ -1186,7 +1196,7 @@ void DetectPatterns()
);
//
Print("Pivots Extracted ...");
// Print("Pivots Extracted ...");
}
//
@@ -1201,11 +1211,11 @@ void DetectPatterns()
//
XPivot pivots[];
int pivotsCount = fima2Signaller.poiDetector.ExtractMAPivots(
pivots, // Result ...
cBar.Index(), // Bar Index ...
50, // Required Number of Pivots ...
1500, // Max Allowed Loopback ...
0 // Validation Length ...
pivots, // Result ...
cBar.Index(), // Bar Index ...
numberOfRequiredPivots, // Required Number of Pivots ...
1500, // Max Allowed Loopback ...
0 // Validation Length ...
);
has = IsValidSize(pivotsCount);
if (has)
@@ -1226,7 +1236,7 @@ void DetectPatterns()
);
//
Print("Pivots Extracted ...");
// Print("Pivots Extracted ...");
}
//
@@ -1241,10 +1251,10 @@ void DetectPatterns()
//
XPivot pivots[];
int pivotsCount = fima2Signaller.poiDetector.ExtractSARPivots(
pivots, // Result ...
cBar.Index(), // Bar Index ...
50, // Required Number of Pivots ...
1500 // Max Allowed Loopback ...
pivots, // Result ...
cBar.Index(), // Bar Index ...
numberOfRequiredPivots, // Required Number of Pivots ...
1500 // Max Allowed Loopback ...
);
has = IsValidSize(pivotsCount);
if (has)
@@ -1265,7 +1275,7 @@ void DetectPatterns()
);
//
Print("Pivots Extracted ...");
// Print("Pivots Extracted ...");
}
//
@@ -1281,8 +1291,8 @@ void DetectPatterns()
XPivot pivots[];
int pivotsCount = fima2Signaller.poiDetector.ExtractZigZagPivots(
pivots,
0,
50,
cBar.Index(),
numberOfRequiredPivots,
1500 //
);
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 ...
if (analyseFIMAPVPivots && false)
if (analyseFIMAPVPivots)
{
//
XPivotAnalysis analysis;
has = fima2Signaller.poiDetector.AnalysePVPivots(
analysis, // Result ...
cBar.Index(), // Bar Index ...
50, // Required Number of Pivots ...
1500, // Max Allowed Loopback ...
10 // Validation Length ...
analysis, // Result ...
cBar.Index(), // Bar Index ...
numberOfRequiredPivots, // Required Number of Pivots ...
1500, // Max Allowed Loopback ...
10 // Validation Length ...
);
if (has)
{
//
// Draw Analysis ...
XCPivotAnalysisObject *iObj;
DestroyObject(pvAnalysisObject);
has = fima2Signaller.poiDrawer.DrawPivotAnalysis(
analysis,
iObj //
pvAnalysisObject,
true // Draw Pivots ...
);
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 ...
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 ...
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;
has = fima2Signaller.poiDetector.AnalyseZigZagPivots(
analysis, // Result ...
0, // Bar Index ...
50, // Required Number of Pivots ...
1500 // Max Allowed Loopback ...
analysis, // Result ...
cBar.Index(), // Bar Index ...
numberOfRequiredPivots, // Required Number of Pivots ...
1500 // Max Allowed Loopback ...
);
if (has)
{
//
// Draw Analysis ...
XCPivotAnalysisObject *iObj;
DestroyObject(zigzagAnalysisObject);
has = fima2Signaller.poiDrawer.DrawPivotAnalysis(
analysis,
iObj,
zigzagAnalysisObject,
true // Draw Pivots ...
);
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;
}
/**
* 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 ...
*