last works ...
This commit is contained in:
@@ -993,23 +993,237 @@ if (has)
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
XOHCL pBar;
|
||||
bool has = cBar.GetPreviousBar(pBar);
|
||||
if (marketStructure.isPTest)
|
||||
{
|
||||
//
|
||||
// Check For PrevZoneExistanse ...
|
||||
has = marketStructure.pTestedZone.IsValid();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Draw Prev Zone ...
|
||||
XCBoxObject *iPrevZoneObj;
|
||||
marketStructure.pTestedZone.to = pBar.time;
|
||||
has = fima2Signaller.poiDrawer.DrawBox(
|
||||
marketStructure.pTestedZone,
|
||||
iPrevZoneObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
XPOIStyle style;
|
||||
fima2Signaller.poiDrawer.GetBoxStyle(
|
||||
style,
|
||||
marketStructure.pTestedZone.dir //
|
||||
);
|
||||
style.clr = clrYellow;
|
||||
fima2Signaller.poiDrawer.ApplyBoxStyle(
|
||||
iPrevZoneObj,
|
||||
style //
|
||||
);
|
||||
|
||||
//
|
||||
style.Clean();
|
||||
eaDraws.Add(iPrevZoneObj);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
Print("Previous Tested ...");
|
||||
}
|
||||
pBar.Clean();
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// Previous Bar must Has Support or Resistance ...
|
||||
|
||||
//
|
||||
// Check Supports ...
|
||||
idx = GetYoungestBefore(
|
||||
pForBar.time,
|
||||
supports //
|
||||
);
|
||||
has =
|
||||
pForBar.IsValid() &&
|
||||
IsValidIndex(idx);
|
||||
if (has)
|
||||
{
|
||||
pSupport = supports[idx];
|
||||
}
|
||||
|
||||
//
|
||||
// Check Resistances ...
|
||||
idx = GetYoungestBefore(
|
||||
pForBar.time,
|
||||
resistances //
|
||||
);
|
||||
has =
|
||||
pForBar.IsValid() &&
|
||||
IsValidIndex(idx);
|
||||
if (has)
|
||||
{
|
||||
pResistance = resistances[idx];
|
||||
}
|
||||
|
||||
//
|
||||
bool isPSupportTouched =
|
||||
pSupport.IsValid() &&
|
||||
pForBar.low < pSupport.upper;
|
||||
|
||||
//
|
||||
bool isPResistanceTouched =
|
||||
pResistance.IsValid() &&
|
||||
pForBar.high > pResistance.lower;
|
||||
|
||||
//
|
||||
has =
|
||||
isPSupportTouched ||
|
||||
isPResistanceTouched;
|
||||
structure.isPTest = has;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
if (isPSupportTouched)
|
||||
{
|
||||
//
|
||||
// Validate Previously Tested Zone Price ...
|
||||
structure.pTestedZone = pSupport;
|
||||
}
|
||||
else if (isPResistanceTouched)
|
||||
{
|
||||
//
|
||||
// Validate Previously Tested Zone Price ...
|
||||
structure.pTestedZone = pResistance;
|
||||
}
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
// //
|
||||
// // Here We Apply Custom Detecting ...
|
||||
// detectorConfig.OffDetectors();
|
||||
// detectorConfig.detectSupport = true;
|
||||
// detectorConfig.detectResistance= true;
|
||||
// detectorConfig.detectSignalKeyBarPattern = true;
|
||||
|
||||
// //
|
||||
// // Initial Bar for Analysis ...
|
||||
// // at Signal Time ...
|
||||
// XOHCL signalBar;
|
||||
// bool isInited = signalBar.Init(
|
||||
// signal.symbol,
|
||||
// signal.period,
|
||||
// signal.time //
|
||||
// );
|
||||
|
||||
// //
|
||||
// // Analyse Market ...
|
||||
// fima1Signaller.poiDetector.AnalyseMarket(
|
||||
// signalBar,
|
||||
// marketStructure,
|
||||
// detectorConfig //
|
||||
// );
|
||||
// CArrayObj *iObjects;
|
||||
// int drawnsCount = fima2Signaller.poiDrawer.DrawMarketStructure(
|
||||
// marketStructure,
|
||||
// marketStructureDrawerConfig,
|
||||
// iObjects //
|
||||
// );
|
||||
// if (IsValidSize(drawnsCount))
|
||||
// {
|
||||
// //
|
||||
// AddObjects(
|
||||
// iObjects,
|
||||
// eaDraws //
|
||||
// );
|
||||
// }
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// On Tick Handler ...
|
||||
void OnTick()
|
||||
{
|
||||
//
|
||||
eaIsNewBar = eaBarTracker.IsNewBar();
|
||||
bool canProcess = eaProcessAllTicks
|
||||
? true
|
||||
: eaIsNewBar;
|
||||
//
|
||||
eaExpert.HandleOnTick();
|
||||
|
||||
//
|
||||
if (!canProcess)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
fima1Signaller.OnTick();
|
||||
fima2Signaller.OnTick();
|
||||
|
||||
//
|
||||
// Initial Bar for Analysis ...
|
||||
XOHCL cBar;
|
||||
bool isInited = cBar.Init(
|
||||
_Symbol,
|
||||
_Period,
|
||||
0 //
|
||||
);
|
||||
|
||||
//
|
||||
// Here We Apply Custom Detecting ...
|
||||
detectorConfig.OffDetectors();
|
||||
detectorConfig.detectSupport = true;
|
||||
detectorConfig.detectResistance = true;
|
||||
detectorConfig.detectSignalKeyBarPattern = false;
|
||||
detectorConfig.supportAndResistanceValidationLength = 21;
|
||||
|
||||
//
|
||||
// Analyse Market ...
|
||||
fima2Signaller.poiDetector.AnalyseMarket(
|
||||
cBar,
|
||||
marketStructure,
|
||||
detectorConfig //
|
||||
);
|
||||
CArrayObj *iObjects;
|
||||
int drawnsCount = fima2Signaller.poiDrawer.DrawMarketStructure(
|
||||
marketStructure,
|
||||
marketStructureDrawerConfig,
|
||||
iObjects //
|
||||
);
|
||||
if (IsValidSize(drawnsCount))
|
||||
{
|
||||
//
|
||||
AddObjects(
|
||||
iObjects,
|
||||
eaDraws //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// TODO: Remove this ...
|
||||
XOHCL pBar;
|
||||
bool has = cBar.GetPreviousBar(pBar);
|
||||
if (marketStructure.isPTest)
|
||||
if (marketStructure.fakeBreakedZone.IsValid())
|
||||
{
|
||||
//
|
||||
// Check For PrevZoneExistanse ...
|
||||
has = marketStructure.pTestedZone.IsValid();
|
||||
has = marketStructure.fakeBreakedZone.IsValid();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Draw Prev Zone ...
|
||||
XCBoxObject *iPrevZoneObj;
|
||||
marketStructure.pTestedZone.to = pBar.time;
|
||||
marketStructure.fakeBreakedZone.to = pBar.time;
|
||||
has = fima2Signaller.poiDrawer.DrawBox(
|
||||
marketStructure.pTestedZone,
|
||||
marketStructure.fakeBreakedZone,
|
||||
iPrevZoneObj //
|
||||
);
|
||||
if (has)
|
||||
@@ -1018,7 +1232,7 @@ if (has)
|
||||
XPOIStyle style;
|
||||
fima2Signaller.poiDrawer.GetBoxStyle(
|
||||
style,
|
||||
marketStructure.pTestedZone.dir //
|
||||
marketStructure.fakeBreakedZone.dir //
|
||||
);
|
||||
style.clr = clrYellow;
|
||||
fima2Signaller.poiDrawer.ApplyBoxStyle(
|
||||
@@ -1033,124 +1247,30 @@ if (has)
|
||||
}
|
||||
|
||||
//
|
||||
Print("Previous Tested ...");
|
||||
Print("Fake Breaked Detection ...");
|
||||
}
|
||||
if (HasChild(marketStructure.recentlyTestedZones))
|
||||
{
|
||||
//
|
||||
int idx = GetYoungest(marketStructure.recentlyTestedZones);
|
||||
bool has = IsValidIndex(idx);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
has = IsTested(
|
||||
pBar,
|
||||
marketStructure.recentlyTestedZones[idx] //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
if (has)
|
||||
{
|
||||
Print("PrevZone Exists ...");
|
||||
}
|
||||
}
|
||||
pBar.Clean();
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// Previous Bar must Has Support or Resistance ...
|
||||
|
||||
//
|
||||
// Check Supports ...
|
||||
idx = GetYoungestBefore(
|
||||
pForBar.time,
|
||||
supports //
|
||||
);
|
||||
has =
|
||||
pForBar.IsValid() &&
|
||||
IsValidIndex(idx);
|
||||
if (has)
|
||||
{
|
||||
pSupport = supports[idx];
|
||||
}
|
||||
|
||||
//
|
||||
// Check Resistances ...
|
||||
idx = GetYoungestBefore(
|
||||
pForBar.time,
|
||||
resistances //
|
||||
);
|
||||
has =
|
||||
pForBar.IsValid() &&
|
||||
IsValidIndex(idx);
|
||||
if (has)
|
||||
{
|
||||
pResistance = resistances[idx];
|
||||
}
|
||||
|
||||
//
|
||||
bool isPSupportTouched =
|
||||
pSupport.IsValid() &&
|
||||
pForBar.low < pSupport.upper;
|
||||
|
||||
//
|
||||
bool isPResistanceTouched =
|
||||
pResistance.IsValid() &&
|
||||
pForBar.high > pResistance.lower;
|
||||
|
||||
//
|
||||
has =
|
||||
isPSupportTouched ||
|
||||
isPResistanceTouched;
|
||||
structure.isPTest = has;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
if (isPSupportTouched)
|
||||
{
|
||||
//
|
||||
// Validate Previously Tested Zone Price ...
|
||||
structure.pTestedZone = pSupport;
|
||||
}
|
||||
else if (isPResistanceTouched)
|
||||
{
|
||||
//
|
||||
// Validate Previously Tested Zone Price ...
|
||||
structure.pTestedZone = pResistance;
|
||||
}
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
// //
|
||||
// // Here We Apply Custom Detecting ...
|
||||
// detectorConfig.OffDetectors();
|
||||
// detectorConfig.detectSupport = true;
|
||||
// detectorConfig.detectResistance= true;
|
||||
// detectorConfig.detectSignalKeyBarPattern = true;
|
||||
|
||||
// //
|
||||
// // Initial Bar for Analysis ...
|
||||
// // at Signal Time ...
|
||||
// XOHCL signalBar;
|
||||
// bool isInited = signalBar.Init(
|
||||
// signal.symbol,
|
||||
// signal.period,
|
||||
// signal.time //
|
||||
// );
|
||||
|
||||
// //
|
||||
// // Analyse Market ...
|
||||
// fima1Signaller.poiDetector.AnalyseMarket(
|
||||
// signalBar,
|
||||
// marketStructure,
|
||||
// detectorConfig //
|
||||
// );
|
||||
// CArrayObj *iObjects;
|
||||
// int drawnsCount = fima2Signaller.poiDrawer.DrawMarketStructure(
|
||||
// marketStructure,
|
||||
// marketStructureDrawerConfig,
|
||||
// iObjects //
|
||||
// );
|
||||
// if (IsValidSize(drawnsCount))
|
||||
// {
|
||||
// //
|
||||
// AddObjects(
|
||||
// iObjects,
|
||||
// eaDraws //
|
||||
// );
|
||||
// }
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//
|
||||
cBar.Clean();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user