last works ...
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
// Imports ...
|
||||
#include "../../Classes/x-saherelm.x-signaller.class.mq5"
|
||||
#include "../../Helpers/x-saherelm.xfima.helper.mq5"
|
||||
#include "../Classes/x-saherelm.xfima.x-poi.detector.class.mq5"
|
||||
|
||||
//
|
||||
// Implementation ...
|
||||
@@ -39,8 +40,9 @@ class XCXFIMABaseSignaller : public XCBaseSignaller
|
||||
// Props ...
|
||||
|
||||
//
|
||||
XFIMAInputs fimaInputs; // XFIMA Inputs ...
|
||||
XCXFIMAHelper *fimaHelper; // XFIMA Indicator Helper ...
|
||||
XFIMAInputs fimaInputs; // XFIMA Inputs ...
|
||||
XCXFIMAHelper *fimaHelper; // XFIMA Indicator Helper ...
|
||||
XCXFIMAPOIDetector *fimaPOIDetector; // XFIMA POI Detector ...
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
@@ -84,6 +86,9 @@ class XCXFIMABaseSignaller : public XCBaseSignaller
|
||||
ZeroMemory(fimaHelper);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
fimaPOIDetector = new XCXFIMAPOIDetector();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -113,6 +118,10 @@ class XCXFIMABaseSignaller : public XCBaseSignaller
|
||||
//
|
||||
delete fimaHelper;
|
||||
ZeroMemory(fimaHelper);
|
||||
|
||||
//
|
||||
delete fimaPOIDetector;
|
||||
ZeroMemory(fimaPOIDetector);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -182,7 +191,8 @@ class XCXFIMABaseSignaller : public XCBaseSignaller
|
||||
//
|
||||
// Validate Fima Helper Requirements ...
|
||||
result = fimaInputs.IsValid() &&
|
||||
fimaHelper != NULL;
|
||||
fimaHelper != NULL &&
|
||||
fimaPOIDetector != NULL;
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -518,4 +528,246 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
// XFIMA Strategy 2 Signaller Class ...
|
||||
class XCXFIMAStrategy2Signaller : public XCXFIMABaseSignaller
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
public:
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
XCXFIMAStrategy2Signaller(
|
||||
string _symbol, // Symbol ...
|
||||
ENUM_TIMEFRAMES _period, // Period ...
|
||||
XFIMAInputs &_fimaInputs, // XFIMAInputs ...
|
||||
bool _processAllTicks = false, // Process All Ticks ...
|
||||
double _defaultSignalR2R = 1.5, // Default Signal Risk To Reward Ratio ...
|
||||
double _defaultSignalRiskInPoint = 50, // Default Signal Risk In Point ...
|
||||
double _defaultSignalVolume = 0.01 // Default Signal Volume ...
|
||||
) : XCXFIMABaseSignaller("XFIMA2",
|
||||
_symbol,
|
||||
_period,
|
||||
_fimaInputs,
|
||||
_processAllTicks,
|
||||
_defaultSignalR2R,
|
||||
_defaultSignalRiskInPoint,
|
||||
_defaultSignalVolume //
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Reading ZigZag ...
|
||||
|
||||
//
|
||||
bool GetZigZagPoint()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Overrides ...
|
||||
|
||||
/**
|
||||
* Processing Tick ...
|
||||
*
|
||||
* @param barIndex: int, Specified Bar Index ...
|
||||
*/
|
||||
virtual void ProcessTick(int barIndex = 0)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Processing New Bar ...
|
||||
*
|
||||
* @param barIndex: int, Specified Bar Index ...
|
||||
*/
|
||||
virtual void ProcessNewBar(int barIndex = 0)
|
||||
{
|
||||
//
|
||||
// Normalize ...
|
||||
barIndex = NormalizeInt(barIndex, 0);
|
||||
|
||||
//
|
||||
// Update Helper ...
|
||||
fimaHelper.Update(barIndex);
|
||||
|
||||
//
|
||||
XOHCL bar;
|
||||
XSignal signal;
|
||||
bool has = false;
|
||||
int cIdx = barIndex + 1;
|
||||
int pIdx = cIdx + 1;
|
||||
ENUM_X_DIRECTION signalDir = X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
// Initialize Bar as CBar ...
|
||||
has = bar.Init(
|
||||
symbol,
|
||||
period,
|
||||
cIdx //
|
||||
);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
bar.Clean();
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Conditions ...
|
||||
XFIMAConditions fimaConditions;
|
||||
has = fimaHelper.GetConditions(
|
||||
fimaConditions,
|
||||
barIndex,
|
||||
10 // Loopback ...
|
||||
);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
bar.Clean();
|
||||
fimaConditions.Clean();
|
||||
|
||||
//
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Analyse Conditions for Finding Signal ...
|
||||
bool isBullish = false;
|
||||
bool isBearish = false;
|
||||
|
||||
//
|
||||
// Chekc Bullish or Bearish Starter Conditions ...
|
||||
has =
|
||||
isBullish ||
|
||||
isBearish;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Do Conditions Validating ...
|
||||
|
||||
//
|
||||
// Bullish Validation ...
|
||||
isBullish =
|
||||
//
|
||||
isBullish
|
||||
//
|
||||
&&
|
||||
//
|
||||
// Validations ...
|
||||
(
|
||||
//
|
||||
false
|
||||
//
|
||||
)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
// Bearish Validation ...
|
||||
isBearish =
|
||||
//
|
||||
isBearish
|
||||
//
|
||||
&&
|
||||
//
|
||||
// Validations ...
|
||||
(
|
||||
//
|
||||
false
|
||||
//
|
||||
)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
has =
|
||||
(isBullish && !isBearish) ||
|
||||
(isBearish && !isBullish);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Specified Signal Directions ...
|
||||
signalDir =
|
||||
isBullish
|
||||
? X_DIRECTION_BULLISH
|
||||
: X_DIRECTION_BEARISH;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Check Signal Founded ...
|
||||
has = HasDirection(signalDir);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// TODO: Provided SL ...
|
||||
|
||||
//
|
||||
// Prepare Founded Signal ...
|
||||
XTarget targets[];
|
||||
has = PrepareSignal(
|
||||
signal,
|
||||
signalDir,
|
||||
targets //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Notify On Signal Event ...
|
||||
NotifySignalEventListeners(signal);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
bar.Clean();
|
||||
signal.Clean();
|
||||
fimaConditions.Clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Guards Based on MarketConditions ...
|
||||
*
|
||||
* @param guards: XGuard[]
|
||||
* @param barIndex: int
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int virtual CheckForGuard(
|
||||
XGuard &guards[],
|
||||
int barIndex = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
SpecifiedClean(guards);
|
||||
|
||||
//
|
||||
result = ArraySize(guards);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Private ...
|
||||
private:
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user