Add support for Detect and Draw Market Structure ...
This commit is contained in:
@@ -41,13 +41,14 @@ class XCXFIMABaseSignaller : public XCBaseSignaller
|
||||
// Props ...
|
||||
|
||||
//
|
||||
bool ignoreTargets; // Ignore Signal Targets ...
|
||||
CArrayObj drawnObjects; // Drawing Objects Holder ...
|
||||
XFIMAInputs fimaInputs; // XFIMA Inputs ...
|
||||
XCXFIMAHelper *fimaHelper; // XFIMA Indicator Helper ...
|
||||
XCXFIMAPOIDrawer *poiDrawer; // XFIMA POI Drawer ...
|
||||
XCXFIMAPOIDetector *poiDetector; // XFIMA POI Detector ...
|
||||
XPatternAnalysisConfig patternAnalyserConfig; // Bar Pattern Analyser Config ...
|
||||
bool ignoreTargets; // Ignore Signal Targets ...
|
||||
CArrayObj drawnObjects; // Drawing Objects Holder ...
|
||||
XFIMAInputs fimaInputs; // XFIMA Inputs ...
|
||||
XCXFIMAHelper *fimaHelper; // XFIMA Indicator Helper ...
|
||||
XCXFIMAPOIDrawer *poiDrawer; // XFIMA POI Drawer ...
|
||||
XCXFIMAPOIDetector *poiDetector; // XFIMA POI Detector ...
|
||||
XFIMAMarketStructureConfig structureConfig; // XFIMA Market Structure Detector Config ...
|
||||
XFIMAMarketStructureDrawerConfig structureDrawConfig; // XFIMA Market Structure Draw Config ...
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
@@ -98,11 +99,8 @@ class XCXFIMABaseSignaller : public XCBaseSignaller
|
||||
|
||||
//
|
||||
// Configure ...
|
||||
|
||||
//
|
||||
patternAnalyserConfig.Clean();
|
||||
patternAnalyserConfig.Default();
|
||||
patternAnalyserConfig.FullPattern();
|
||||
structureConfig.Default();
|
||||
structureDrawConfig.Default();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -142,8 +140,8 @@ class XCXFIMABaseSignaller : public XCBaseSignaller
|
||||
ZeroMemory(poiDetector);
|
||||
|
||||
//
|
||||
// analyserConfig.Clean();
|
||||
patternAnalyserConfig.Clean();
|
||||
structureConfig.Clean();
|
||||
structureDrawConfig.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -254,7 +252,7 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
public:
|
||||
//
|
||||
// Props ...
|
||||
// XFIMAPatternDetectorConfig analyserConfig;
|
||||
XFIMAMarketStructure structure; // XFIMA Market Structure ...
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
@@ -277,12 +275,12 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
)
|
||||
{
|
||||
//
|
||||
// Configures ...
|
||||
// Configure ...
|
||||
structureConfig.Default();
|
||||
structureDrawConfig.Default();
|
||||
|
||||
//
|
||||
patternAnalyserConfig.Clean();
|
||||
patternAnalyserConfig.Default();
|
||||
patternAnalyserConfig.FullPattern();
|
||||
structure.Clean();
|
||||
|
||||
//
|
||||
// Ignore Signal Targets ...
|
||||
@@ -293,7 +291,11 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
// Deconstructor ...
|
||||
~XCXFIMAStrategy1Signaller()
|
||||
{
|
||||
//
|
||||
Destroy();
|
||||
|
||||
//
|
||||
structure.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -366,67 +368,17 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
}
|
||||
|
||||
//
|
||||
// Analyse Market ...
|
||||
// poiDetector.AnalyseMarket(
|
||||
// iBar,
|
||||
// iStructure,
|
||||
// analyserConfig //
|
||||
// );
|
||||
|
||||
//
|
||||
// Bar Pattern Analysis Detection Test ...
|
||||
// has = poiDetector.AnalyseBarPatterns(
|
||||
// iBar,
|
||||
// iBarAnalysis,
|
||||
// patternAnalyserConfig //
|
||||
// );
|
||||
// DrawBarPatternAnalysis(iBarAnalysis, patternAnalyserDrawConfig);
|
||||
|
||||
// //
|
||||
// has = fimaHelper.IsBoundaryFakeBreaked(
|
||||
// iDir,
|
||||
// iBar.Index() //
|
||||
// );
|
||||
// if (has)
|
||||
// {
|
||||
// Print("Hot Place Detected");
|
||||
// }
|
||||
|
||||
// //
|
||||
// XPivot pvPivots[];
|
||||
// count = fimaHelper.ExtractPVPivots(
|
||||
// pvPivots,
|
||||
// iBar.Index(),
|
||||
// 25,
|
||||
// 1500,
|
||||
// 5 //
|
||||
// );
|
||||
// has = IsValidSize(count);
|
||||
// if (has) {
|
||||
// //
|
||||
// XPivotAnalysis pvAnalysis;
|
||||
// has = pvAnalysis.Init(
|
||||
// "XPV",
|
||||
// symbol,
|
||||
// period,
|
||||
// pvPivots //
|
||||
// );
|
||||
// if (has) {
|
||||
// //
|
||||
// XPivotAnalysisDrawConfig iC;
|
||||
// iC.Default();
|
||||
// iC.drawPivots = true;
|
||||
// iC.drawPeakTrend = true;
|
||||
// iC.drawValeTrend = true;
|
||||
// poiDrawer.DrawPivotAnalysis(
|
||||
// pvAnalysis,
|
||||
// iC //
|
||||
// );
|
||||
|
||||
// //
|
||||
// Print("PV Analysis ...");
|
||||
// }
|
||||
// }
|
||||
structure.Clean();
|
||||
poiDetector.AnalyseMarket(
|
||||
structure,
|
||||
structureConfig,
|
||||
barIndex //
|
||||
);
|
||||
poiDrawer.drawnObjects.Clear();
|
||||
poiDrawer.DrawMarketStructure(
|
||||
structure,
|
||||
structureDrawConfig //
|
||||
);
|
||||
|
||||
//
|
||||
// Disable Signallers ...
|
||||
@@ -571,7 +523,7 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
XTarget &targets[],
|
||||
ENUM_X_DIRECTION &dir,
|
||||
XFIMAConditions &conditions,
|
||||
XFIMAMarketStructure &structure //
|
||||
XFIMAMarketStructure &_structure //
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -655,7 +607,7 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
XTarget &targets[],
|
||||
ENUM_X_DIRECTION &dir,
|
||||
XFIMAConditions &conditions,
|
||||
XFIMAMarketStructure &structure //
|
||||
XFIMAMarketStructure &_structure //
|
||||
)
|
||||
{
|
||||
//
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -36,22 +36,14 @@
|
||||
struct XFIMAMarketStructure
|
||||
{
|
||||
//
|
||||
XOHCL bar; // Spacified Start Bar for Analysing ...
|
||||
int length; // Loopback Length for Analyse Structure ...
|
||||
XOHCL bar; // Spacified Start Bar for Analysing ...
|
||||
|
||||
//
|
||||
XPivotAnalysis pvAnalysis; // PV Pivot Analysis Result ...
|
||||
XPivotAnalysis zgAnalysis; // ZG Pivot Analysis Result ...
|
||||
XPivotAnalysis barsPivotsAnalysis; // Bars Pivot Analysis Result ...
|
||||
|
||||
//
|
||||
XPatternAnalysis barsAnalysis[]; // Anaysed Bars ...
|
||||
XPatternAnalysisConfig barsAnalysisConfig; // Bars Analyser Config ...
|
||||
|
||||
//
|
||||
// Configure Pivots Detection ...
|
||||
int requiredPivots; // Required Extracted Pivots for Analysis ...
|
||||
|
||||
XPatternAnalysis barsAnalysis[]; // Anaysed Bars ...
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
@@ -70,13 +62,11 @@ struct XFIMAMarketStructure
|
||||
{
|
||||
//
|
||||
bar.Clean();
|
||||
length = 0;
|
||||
|
||||
//
|
||||
pvAnalysis.Clean();
|
||||
zgAnalysis.Clean();
|
||||
XClean(barsAnalysis);
|
||||
barsAnalysisConfig.Clean();
|
||||
|
||||
//
|
||||
ZeroMemory(this);
|
||||
@@ -93,8 +83,7 @@ struct XFIMAMarketStructure
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = bar.IsValid() &&
|
||||
length > 0;
|
||||
result = bar.IsValid();
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -103,6 +92,120 @@ struct XFIMAMarketStructure
|
||||
//
|
||||
};
|
||||
|
||||
struct XFIMAMarketStructureConfig
|
||||
{
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
// Detector Flags ...
|
||||
|
||||
//
|
||||
bool analysePVPivots; // Analyse PV Pivots ...
|
||||
bool analyseZGPivots; // Analyse ZG Pivots ...
|
||||
|
||||
//
|
||||
bool analyseBarPatterns; // Analyse Bar Patterns ...
|
||||
|
||||
//
|
||||
// Detector Configs ...
|
||||
|
||||
//
|
||||
int loopback; // Max Allowed Looping Back Length ...
|
||||
int requiredPivots; // Required Extracted Pivots for Analysis ...
|
||||
|
||||
//
|
||||
int pvPivotsValidationLength; // PV Pivots Validation Length ...
|
||||
double maCrossValidationDiffMultiplier; // a Point Distance to Validate MA Crosses ...
|
||||
|
||||
//
|
||||
XPatternAnalysisConfig barsAnalysisConfig; // Bars Analyser Config ...
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
XFIMAMarketStructureConfig()
|
||||
{
|
||||
Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
/**
|
||||
* This function fulfills the will of the developer
|
||||
*/
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
// Detector Flags ...
|
||||
analysePVPivots = false;
|
||||
analyseZGPivots = false;
|
||||
analyseBarPatterns = false;
|
||||
|
||||
//
|
||||
// Configure Detectors ...
|
||||
loopback = 0;
|
||||
requiredPivots = 0;
|
||||
pvPivotsValidationLength = 0;
|
||||
maCrossValidationDiffMultiplier = 0;
|
||||
|
||||
//
|
||||
barsAnalysisConfig.Clean();
|
||||
|
||||
//
|
||||
ZeroMemory(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Configurations ...
|
||||
*/
|
||||
void Default()
|
||||
{
|
||||
//
|
||||
// Detector Flags ...
|
||||
analysePVPivots = true;
|
||||
analyseZGPivots = true;
|
||||
analyseBarPatterns = true;
|
||||
|
||||
//
|
||||
// Configure Detectors ...
|
||||
loopback = 500;
|
||||
requiredPivots = 25;
|
||||
pvPivotsValidationLength = 5;
|
||||
maCrossValidationDiffMultiplier = 4;
|
||||
|
||||
//
|
||||
barsAnalysisConfig.Default();
|
||||
barsAnalysisConfig.FullPattern();
|
||||
}
|
||||
|
||||
/**
|
||||
* No Draw Abilioty ...
|
||||
*/
|
||||
void Off()
|
||||
{
|
||||
//
|
||||
// Detector Flags ...
|
||||
analysePVPivots = false;
|
||||
analyseZGPivots = false;
|
||||
analyseBarPatterns = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Full Draw Abilioty ...
|
||||
*/
|
||||
void Full()
|
||||
{
|
||||
//
|
||||
// Detector Flags ...
|
||||
analysePVPivots = true;
|
||||
analyseZGPivots = true;
|
||||
analyseBarPatterns = true;
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
/**
|
||||
* Configure Market Structure Drawer ...
|
||||
**/
|
||||
@@ -110,6 +213,15 @@ struct XFIMAMarketStructureDrawerConfig
|
||||
{
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
bool drawPVAnalysis;
|
||||
bool drawZGAnalysis;
|
||||
bool drawBarsAnalysis;
|
||||
|
||||
//
|
||||
XPOIDrawConfig drawConfig;
|
||||
XPivotAnalysisDrawConfig pivotAnalysisDrawConfig;
|
||||
XPatternAnalysisDrawConfig barAnalysisDrawConfig;
|
||||
|
||||
//
|
||||
@@ -123,27 +235,110 @@ struct XFIMAMarketStructureDrawerConfig
|
||||
// Tools ...
|
||||
|
||||
/**
|
||||
* Cleanup Model ...
|
||||
* This function fulfills the will of the developer
|
||||
*/
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
// Drawing Flags ...
|
||||
|
||||
//
|
||||
drawPVAnalysis = false;
|
||||
drawZGAnalysis = false;
|
||||
drawBarsAnalysis = false;
|
||||
|
||||
//
|
||||
// Drawing Configs ...
|
||||
drawConfig.Clean();
|
||||
barAnalysisDrawConfig.Clean();
|
||||
pivotAnalysisDrawConfig.Clean();
|
||||
|
||||
//
|
||||
ZeroMemory(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Model ...
|
||||
* Default Configurations ...
|
||||
*/
|
||||
void Default()
|
||||
{
|
||||
//
|
||||
// Drawing Flags ...
|
||||
|
||||
//
|
||||
drawPVAnalysis = true;
|
||||
drawZGAnalysis = true;
|
||||
drawBarsAnalysis = true;
|
||||
|
||||
//
|
||||
// Drawing Configs ...
|
||||
drawConfig.Default();
|
||||
pivotAnalysisDrawConfig.Default();
|
||||
|
||||
//
|
||||
barAnalysisDrawConfig.Default();
|
||||
barAnalysisDrawConfig.Full();
|
||||
XClean(barAnalysisDrawConfig.allowedDrawZones);
|
||||
Add(
|
||||
X_BAR_PATTERN_SUPPORT,
|
||||
barAnalysisDrawConfig.allowedDrawZones
|
||||
);
|
||||
Add(
|
||||
X_BAR_PATTERN_RESISTANCE,
|
||||
barAnalysisDrawConfig.allowedDrawZones
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure for Full Drawing ...
|
||||
* No Draw Abilioty ...
|
||||
*/
|
||||
void FullDraw()
|
||||
void Off()
|
||||
{
|
||||
//
|
||||
// Drawing Flags ...
|
||||
|
||||
//
|
||||
drawPVAnalysis = false;
|
||||
drawZGAnalysis = false;
|
||||
drawBarsAnalysis = false;
|
||||
|
||||
//
|
||||
// Drawing Configs ...
|
||||
barAnalysisDrawConfig.Off();
|
||||
pivotAnalysisDrawConfig.Off();
|
||||
}
|
||||
|
||||
/**
|
||||
* Full Draw Abilioty ...
|
||||
*/
|
||||
void Full()
|
||||
{
|
||||
//
|
||||
// Drawing Flags ...
|
||||
|
||||
//
|
||||
drawPVAnalysis = false;
|
||||
drawZGAnalysis = false;
|
||||
drawBarsAnalysis = false;
|
||||
|
||||
//
|
||||
// Drawing Configs ...
|
||||
barAnalysisDrawConfig.Full();
|
||||
pivotAnalysisDrawConfig.Full();
|
||||
}
|
||||
|
||||
void ApplyDrawConfig()
|
||||
{
|
||||
//
|
||||
barAnalysisDrawConfig.drawConfig = drawConfig;
|
||||
pivotAnalysisDrawConfig.drawConfig = drawConfig;
|
||||
}
|
||||
|
||||
void ApplyDrawConfig(XPOIDrawConfig &_drawConfig)
|
||||
{
|
||||
//
|
||||
drawConfig = _drawConfig;
|
||||
ApplyDrawConfig();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user