Fix Signalling Issues ...
This commit is contained in:
@@ -455,10 +455,10 @@ class XCXCATBEAExpert : public XCBase
|
|||||||
//
|
//
|
||||||
// Provider Name ...
|
// Provider Name ...
|
||||||
iSignallerInputs.period = _Period;
|
iSignallerInputs.period = _Period;
|
||||||
|
iSignallerInputs.allowDraws = true;
|
||||||
iSignallerInputs.provider = "XTRGB";
|
iSignallerInputs.provider = "XTRGB";
|
||||||
iSignallerInputs.allowGuards = eaAllowGuards;
|
iSignallerInputs.allowGuards = eaAllowGuards;
|
||||||
iSignallerInputs.riskToRewardRatio = eaSignalR2R;
|
iSignallerInputs.riskToRewardRatio = eaSignalR2R;
|
||||||
iSignallerInputs.allowDraws = IsRunningOnTestMode();
|
|
||||||
iSignallerInputs.slATRMultiplier = eaSLATRMultiplier;
|
iSignallerInputs.slATRMultiplier = eaSLATRMultiplier;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -43,9 +43,9 @@ struct XCATBEASignallerInputs
|
|||||||
string provider;
|
string provider;
|
||||||
bool allowDraws;
|
bool allowDraws;
|
||||||
bool allowGuards;
|
bool allowGuards;
|
||||||
|
int riskToRewardRatio;
|
||||||
ENUM_TIMEFRAMES period;
|
ENUM_TIMEFRAMES period;
|
||||||
double slATRMultiplier;
|
double slATRMultiplier;
|
||||||
double riskToRewardRatio;
|
|
||||||
X121XCatbInputs catbInputs;
|
X121XCatbInputs catbInputs;
|
||||||
XTriggerBlockFilters filters;
|
XTriggerBlockFilters filters;
|
||||||
XTriggerBlockValidationRules validations;
|
XTriggerBlockValidationRules validations;
|
||||||
@@ -111,17 +111,19 @@ class XCXCATBEASignaller : XCBase
|
|||||||
// Props ...
|
// Props ...
|
||||||
|
|
||||||
//
|
//
|
||||||
bool allowDraws; // Allow Draws or not ...
|
bool allowDraws; // Allow Draws or not ...
|
||||||
bool allowGuards; // Allow Guards or not ...
|
bool allowGuards; // Allow Guards or not ...
|
||||||
double slATRMultiplier; // SL ATR Multiplier ...
|
int riskToRewardRatio; // Signals R2R ...
|
||||||
double riskToRewardRatio; // Signals R2R ...
|
double slATRMultiplier; // SL ATR Multiplier ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XBarTracker barTraker; // Bar Tracker ...
|
XBarTracker barTraker; // Bar Tracker ...
|
||||||
XCX121XCatbHelper *helper; // XCATB Helper Class instance ...
|
XCX121XCatbHelper *helper; // XCATB Helper Class instance ...
|
||||||
XCBarAnalyser *barAnalyser; // Bar Analyser ...
|
XCBarAnalyser *barAnalyser; // Bar Analyser ...
|
||||||
XCXCATBEAPOIDrawer *drawer; // POI Drawer ...
|
XCXCATBEAPOIDrawer *drawer; // POI Drawer ...
|
||||||
XCXCATBEAPOIDetector *detector; // POI Detector ...
|
XTriggerBlockFilters filters; // Trigger Block Filters ...
|
||||||
|
XCXCATBEAPOIDetector *detector; // POI Detector ...
|
||||||
|
XTriggerBlockValidationRules validations; // Trigger Block Validations ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XBoxZone unavailableZones[]; // Un Available Zones ...
|
XBoxZone unavailableZones[]; // Un Available Zones ...
|
||||||
@@ -356,6 +358,101 @@ class XCXCATBEASignaller : XCBase
|
|||||||
// Normalize Args ...
|
// Normalize Args ...
|
||||||
barIndex = NormalizeInt(barIndex, 0);
|
barIndex = NormalizeInt(barIndex, 0);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Update All Required Buffers ...
|
||||||
|
helper.Update(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Trigger Block Detection ...
|
||||||
|
result = DetectTriggerBlock1(
|
||||||
|
helper,
|
||||||
|
barAnalyser,
|
||||||
|
mConditions.triggerBlock,
|
||||||
|
mConditions.conditions,
|
||||||
|
validations,
|
||||||
|
filters,
|
||||||
|
barIndex,
|
||||||
|
10 // Loopback ...
|
||||||
|
);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Prepare Condition ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Prepare Signal ...
|
||||||
|
mConditions.dir =
|
||||||
|
mConditions
|
||||||
|
.triggerBlock
|
||||||
|
.GetDirection();
|
||||||
|
mConditions.symbol = symbol;
|
||||||
|
mConditions.period = period;
|
||||||
|
mConditions.provider = provider;
|
||||||
|
mConditions.reward = riskToRewardRatio;
|
||||||
|
mConditions.time = mConditions.conditions.bars[0].time;
|
||||||
|
mConditions.setupTime = mConditions.conditions.bars[0].time;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Prepare Target ...
|
||||||
|
double targets[];
|
||||||
|
for (int i = 1; i <= riskToRewardRatio; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(double)i,
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculate SL Additions ...
|
||||||
|
double iATR = 0;
|
||||||
|
if (barIndex > 0 &&
|
||||||
|
barIndex < ArraySize(helper.atrBuffer))
|
||||||
|
{
|
||||||
|
iATR = helper.atrBuffer[barIndex];
|
||||||
|
}
|
||||||
|
double slAdditional = slATRMultiplier * iATR;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Preparing Signal ...
|
||||||
|
result = ToSignal(
|
||||||
|
mConditions.triggerBlock.trigger,
|
||||||
|
mConditions.triggerBlock.signal,
|
||||||
|
targets,
|
||||||
|
slAdditional //
|
||||||
|
);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mConditions.triggerBlock.signal.provider = provider;
|
||||||
|
mConditions.sl = mConditions.triggerBlock.signal.sl;
|
||||||
|
mConditions.tp = mConditions.triggerBlock.signal.tp;
|
||||||
|
mConditions.pivot = mConditions.triggerBlock.signal.sl;
|
||||||
|
mConditions.entry = mConditions.triggerBlock.signal.entry;
|
||||||
|
mConditions.point = mConditions.triggerBlock.signal.entry;
|
||||||
|
mConditions.type = ToPositionType(mConditions.triggerBlock.signal.type);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draw Trigger Block ...
|
||||||
|
if (allowDraws)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
DrawTriggerBlock(
|
||||||
|
mConditions.triggerBlock,
|
||||||
|
drawer.drawer,
|
||||||
|
mObjects,
|
||||||
|
NULL, // To ...
|
||||||
|
false // Draw Signal ...
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = mConditions.IsValid() &&
|
||||||
|
mConditions.IsSetuped();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup Resource ...
|
// Cleanup Resource ...
|
||||||
|
|
||||||
@@ -409,6 +506,7 @@ class XCXCATBEASignaller : XCBase
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Complete Conditions Here ...
|
// Complete Conditions Here ...
|
||||||
|
conditions.triggerTime = TimeCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -502,11 +600,17 @@ class XCXCATBEASignaller : XCBase
|
|||||||
//
|
//
|
||||||
symbol = inputs.symbol;
|
symbol = inputs.symbol;
|
||||||
period = inputs.period;
|
period = inputs.period;
|
||||||
|
filters = inputs.filters;
|
||||||
provider = inputs.provider;
|
provider = inputs.provider;
|
||||||
|
allowDraws = inputs.allowDraws;
|
||||||
allowGuards = inputs.allowGuards;
|
allowGuards = inputs.allowGuards;
|
||||||
|
validations = inputs.validations;
|
||||||
slATRMultiplier = inputs.slATRMultiplier;
|
slATRMultiplier = inputs.slATRMultiplier;
|
||||||
riskToRewardRatio = inputs.riskToRewardRatio;
|
riskToRewardRatio = inputs.riskToRewardRatio;
|
||||||
|
|
||||||
|
//
|
||||||
|
mObjects = new CArrayObj();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize Bar Tracker ...
|
// Initialize Bar Tracker ...
|
||||||
has = barTraker.Init(
|
has = barTraker.Init(
|
||||||
@@ -548,6 +652,11 @@ class XCXCATBEASignaller : XCBase
|
|||||||
*/
|
*/
|
||||||
void DeInit()
|
void DeInit()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
mObjects.Clear();
|
||||||
|
delete mObjects;
|
||||||
|
ZeroMemory(mObjects);
|
||||||
|
|
||||||
//
|
//
|
||||||
drawer.Clear();
|
drawer.Clear();
|
||||||
delete drawer;
|
delete drawer;
|
||||||
@@ -659,6 +768,7 @@ class XCXCATBEASignaller : XCBase
|
|||||||
// Props ...
|
// Props ...
|
||||||
string symbol;
|
string symbol;
|
||||||
string provider;
|
string provider;
|
||||||
|
CArrayObj *mObjects;
|
||||||
ENUM_TIMEFRAMES period;
|
ENUM_TIMEFRAMES period;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Include Common Library ...
|
// Include Common Library ...
|
||||||
#include "../../Classes/x-saherelm.x-guard.class.mq5"
|
#include "../Classes/x-saherelm.x-guard.class.mq5"
|
||||||
#include "../../Classes/x-saherelm.x-volume.class.mq5"
|
#include "../Classes/x-saherelm.x-volume.class.mq5"
|
||||||
#include "../XCATBEA/Classes/xcatbea.signaller.class.mq5"
|
#include "../XCATBEA/Classes/xcatbea.signaller.class.mq5"
|
||||||
#include "../XCATBEA/Classes/xcatbea.x-trade.manager.class.mq5"
|
#include "../XCATBEA/Classes/xcatbea.x-trade.manager.class.mq5"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user