last ...
This commit is contained in:
@@ -621,6 +621,19 @@ class XCBackTesterEA : public XCBase
|
|||||||
*/
|
*/
|
||||||
void HandleOnSignalTriggered(XSignal &signal)
|
void HandleOnSignalTriggered(XSignal &signal)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Draw Signal ...
|
||||||
|
XCSignalObject *iSignalObj = new XCSignalObject();
|
||||||
|
bool isCreated = iSignalObj.Create(
|
||||||
|
eaChartHelper.ChartId(),
|
||||||
|
0,
|
||||||
|
signal,
|
||||||
|
3 //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Handle Volume ...
|
// Handle Volume ...
|
||||||
double iVolume = eaVolume.CalculateVolume(signal);
|
double iVolume = eaVolume.CalculateVolume(signal);
|
||||||
|
|||||||
@@ -554,12 +554,14 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Testing Porposes ...
|
// Testing Porposes ...
|
||||||
result = fimaHelper.IsBoundaryFakeBreaked(
|
result =
|
||||||
dir,
|
result &&
|
||||||
bar.Index(),
|
fimaHelper.IsBoundaryFakeBreaked(
|
||||||
X_PRICE_CLOSE,
|
dir,
|
||||||
X_PRICE_CLOSE //
|
bar.Index(),
|
||||||
);
|
X_PRICE_CLOSE,
|
||||||
|
X_PRICE_CLOSE //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Nearest Noisy ZG Pivot Must has Same Direction
|
// Nearest Noisy ZG Pivot Must has Same Direction
|
||||||
@@ -709,6 +711,18 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
|||||||
? bullishScore > bearishScore
|
? bullishScore > bearishScore
|
||||||
: bearishScore > bullishScore;
|
: bearishScore > bullishScore;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Last Validation is Candlestick Patterns of Bar ...
|
||||||
|
// XPatternAnalysis barAnalysis;
|
||||||
|
// result =
|
||||||
|
// result &&
|
||||||
|
// poiDetector.AnalyseBarPatterns(
|
||||||
|
// bar,
|
||||||
|
// barAnalysis,
|
||||||
|
// structureConfig.barsAnalysisConfig //
|
||||||
|
// );
|
||||||
|
|
||||||
|
//
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -719,59 +733,100 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Validating ...
|
// Drawa ...
|
||||||
// Print("Validate ZG ...");
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Affected Zone ...
|
||||||
|
XCBoxObject *iObj;
|
||||||
|
has = poiDrawer.DrawBox(
|
||||||
|
affectedZone,
|
||||||
|
iObj,
|
||||||
|
true,
|
||||||
|
affectedZone.type + "_" + ToXString(TimeToSeconds(affectedZone.from)) //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPOIStyle iStyle;
|
||||||
|
poiDrawer.GetBoxStyle(
|
||||||
|
iStyle,
|
||||||
|
affectedZone.dir //
|
||||||
|
);
|
||||||
|
iStyle.clr = clrYellow;
|
||||||
|
poiDrawer.ApplyBoxStyle(
|
||||||
|
iObj,
|
||||||
|
iStyle //
|
||||||
|
);
|
||||||
|
iStyle.Clean();
|
||||||
|
|
||||||
// //
|
//
|
||||||
// dir = X_DIRECTION_NONE;
|
Print("Affected Zone ...");
|
||||||
// result = false;
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draw Bar Pattern ...
|
||||||
|
// poiDrawer.DrawPatternAnalysis(barAnalysis, structureDrawConfig.barAnalysisDrawConfig);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Prepare zone ...
|
// Prepare zone ...
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
zone.to = bar.time;
|
zone = affectedZone;
|
||||||
zone.from = GetBarTime(
|
|
||||||
bar.symbol,
|
//
|
||||||
bar.period,
|
|
||||||
bar.Index() + 2 //
|
|
||||||
);
|
|
||||||
zone.dir = dir;
|
|
||||||
zone.symbol = bar.symbol;
|
|
||||||
zone.period = bar.period;
|
|
||||||
zone.type = name + "_" + ToXString(dir);
|
zone.type = name + "_" + ToXString(dir);
|
||||||
// zone.lower = bar.FindLowest(2, MODE_LOW);
|
|
||||||
// zone.upper = bar.FindHighest(2, MODE_HIGH);
|
//
|
||||||
double entry = GetEntry(bar.symbol, dir);
|
double entry = GetEntry(bar.symbol, dir);
|
||||||
double points = GetPoints(bar.symbol);
|
double points = GetPoints(bar.symbol);
|
||||||
zone.lower = entry - (100 * points);
|
double risk = MathAbs(entry - (isBullish ? zone.lower : zone.upper));
|
||||||
zone.upper = entry + (100 * points);
|
double reward = risk * defaultSignalR2R;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
// Partially Close on TP 1 ...
|
||||||
double tp1 = isBullish
|
double tp1 = isBullish
|
||||||
? entry + (100 * points)
|
? entry + (risk * 1)
|
||||||
: entry - (100 * points);
|
: entry - (risk * 1);
|
||||||
XTarget target1;
|
XTarget target1;
|
||||||
target1.target = tp1;
|
target1.target = tp1;
|
||||||
target1.doRF = true;
|
target1.doRF = false;
|
||||||
target1.actingDistance = 10;
|
target1.actingDistance = 2;
|
||||||
|
target1.volumeMultiplier = 0.5;
|
||||||
|
|
||||||
double tp2 = isBullish
|
//
|
||||||
? entry + (200 * points)
|
// TP 3 ...
|
||||||
: entry - (200 * points);
|
double tp3 = isBullish
|
||||||
XTarget target2;
|
? entry + (risk * 3)
|
||||||
target2.target = tp2;
|
: entry - (risk * 3);
|
||||||
target2.doRF = true;
|
XTarget target3;
|
||||||
target2.actingDistance = 10;
|
target3.target = tp3;
|
||||||
|
target3.doRF = true;
|
||||||
|
target3.actingDistance = 10;
|
||||||
|
|
||||||
|
//
|
||||||
|
// TP 5 ...
|
||||||
|
double tp5 = isBullish
|
||||||
|
? entry + (risk * 5)
|
||||||
|
: entry - (risk * 5);
|
||||||
|
XTarget target5;
|
||||||
|
target5.target = tp5;
|
||||||
|
target5.doRF = true;
|
||||||
|
target5.actingDistance = 10;
|
||||||
|
|
||||||
//
|
//
|
||||||
// AddRef(
|
|
||||||
// target1,
|
|
||||||
// targets //
|
|
||||||
// );
|
|
||||||
AddRef(
|
AddRef(
|
||||||
target2,
|
target1,
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
AddRef(
|
||||||
|
target3,
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
AddRef(
|
||||||
|
target5,
|
||||||
targets //
|
targets //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user