Fix Signalling Issues ...
This commit is contained in:
@@ -455,10 +455,10 @@ class XCXCATBEAExpert : public XCBase
|
||||
//
|
||||
// Provider Name ...
|
||||
iSignallerInputs.period = _Period;
|
||||
iSignallerInputs.allowDraws = true;
|
||||
iSignallerInputs.provider = "XTRGB";
|
||||
iSignallerInputs.allowGuards = eaAllowGuards;
|
||||
iSignallerInputs.riskToRewardRatio = eaSignalR2R;
|
||||
iSignallerInputs.allowDraws = IsRunningOnTestMode();
|
||||
iSignallerInputs.slATRMultiplier = eaSLATRMultiplier;
|
||||
|
||||
//
|
||||
|
||||
@@ -43,9 +43,9 @@ struct XCATBEASignallerInputs
|
||||
string provider;
|
||||
bool allowDraws;
|
||||
bool allowGuards;
|
||||
int riskToRewardRatio;
|
||||
ENUM_TIMEFRAMES period;
|
||||
double slATRMultiplier;
|
||||
double riskToRewardRatio;
|
||||
X121XCatbInputs catbInputs;
|
||||
XTriggerBlockFilters filters;
|
||||
XTriggerBlockValidationRules validations;
|
||||
@@ -111,17 +111,19 @@ class XCXCATBEASignaller : XCBase
|
||||
// Props ...
|
||||
|
||||
//
|
||||
bool allowDraws; // Allow Draws or not ...
|
||||
bool allowGuards; // Allow Guards or not ...
|
||||
double slATRMultiplier; // SL ATR Multiplier ...
|
||||
double riskToRewardRatio; // Signals R2R ...
|
||||
bool allowDraws; // Allow Draws or not ...
|
||||
bool allowGuards; // Allow Guards or not ...
|
||||
int riskToRewardRatio; // Signals R2R ...
|
||||
double slATRMultiplier; // SL ATR Multiplier ...
|
||||
|
||||
//
|
||||
XBarTracker barTraker; // Bar Tracker ...
|
||||
XCX121XCatbHelper *helper; // XCATB Helper Class instance ...
|
||||
XCBarAnalyser *barAnalyser; // Bar Analyser ...
|
||||
XCXCATBEAPOIDrawer *drawer; // POI Drawer ...
|
||||
XCXCATBEAPOIDetector *detector; // POI Detector ...
|
||||
XBarTracker barTraker; // Bar Tracker ...
|
||||
XCX121XCatbHelper *helper; // XCATB Helper Class instance ...
|
||||
XCBarAnalyser *barAnalyser; // Bar Analyser ...
|
||||
XCXCATBEAPOIDrawer *drawer; // POI Drawer ...
|
||||
XTriggerBlockFilters filters; // Trigger Block Filters ...
|
||||
XCXCATBEAPOIDetector *detector; // POI Detector ...
|
||||
XTriggerBlockValidationRules validations; // Trigger Block Validations ...
|
||||
|
||||
//
|
||||
XBoxZone unavailableZones[]; // Un Available Zones ...
|
||||
@@ -356,6 +358,101 @@ class XCXCATBEASignaller : XCBase
|
||||
// Normalize Args ...
|
||||
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 ...
|
||||
|
||||
@@ -409,6 +506,7 @@ class XCXCATBEASignaller : XCBase
|
||||
{
|
||||
//
|
||||
// Complete Conditions Here ...
|
||||
conditions.triggerTime = TimeCurrent();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -502,11 +600,17 @@ class XCXCATBEASignaller : XCBase
|
||||
//
|
||||
symbol = inputs.symbol;
|
||||
period = inputs.period;
|
||||
filters = inputs.filters;
|
||||
provider = inputs.provider;
|
||||
allowDraws = inputs.allowDraws;
|
||||
allowGuards = inputs.allowGuards;
|
||||
validations = inputs.validations;
|
||||
slATRMultiplier = inputs.slATRMultiplier;
|
||||
riskToRewardRatio = inputs.riskToRewardRatio;
|
||||
|
||||
//
|
||||
mObjects = new CArrayObj();
|
||||
|
||||
//
|
||||
// Initialize Bar Tracker ...
|
||||
has = barTraker.Init(
|
||||
@@ -548,6 +652,11 @@ class XCXCATBEASignaller : XCBase
|
||||
*/
|
||||
void DeInit()
|
||||
{
|
||||
//
|
||||
mObjects.Clear();
|
||||
delete mObjects;
|
||||
ZeroMemory(mObjects);
|
||||
|
||||
//
|
||||
drawer.Clear();
|
||||
delete drawer;
|
||||
@@ -659,6 +768,7 @@ class XCXCATBEASignaller : XCBase
|
||||
// Props ...
|
||||
string symbol;
|
||||
string provider;
|
||||
CArrayObj *mObjects;
|
||||
ENUM_TIMEFRAMES period;
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user