last works on Testing XPivot and XZone structures in test ea ...

This commit is contained in:
2024-07-08 05:10:47 +03:30
parent 44600bc62f
commit 677ee2e33e
3 changed files with 1193 additions and 311 deletions
+303 -143
View File
@@ -25,6 +25,7 @@
//
// Imports ...
#include "../Test/x-saherelm.test.xea.mq5"
#include "../Libraries/x-saherelm.tools.mq5"
#include "../Helpers/x-saherelm.xct.helper.mq5"
#include "../Helpers/x-saherelm.xcc.helper.mq5"
@@ -48,6 +49,16 @@ XSCXTestSetup *iSetup;
XSCXCTHelper *mCTHelper;
XSCXCCHelper *mCCHelper;
//
// For Pivot Checking ...
XPivot lastSupportPivot;
XPivot lastResistancePivot;
//
// For Zone Checking ...
XZone lastSupportZone;
XZone lastResistanceZone;
//
// Event Handlers ...
@@ -119,138 +130,12 @@ void OnTick()
}
//
XTestConditions conditions;
bool hasConditions = iSetup.GetConditions(
conditions,
0,
5 //
);
if (hasConditions)
{
//
bool isCHMAOverUnder1 =
//
(conditions.chmaConditions.isFastOverMin &&
conditions.chmaConditions.isFastUnderMin)
//
;
//
bool isCHMAOverUnder2 =
//
(conditions.chmaConditions.isSlowOverMin &&
conditions.chmaConditions.isSlowUnderMin)
//
;
//
bool isCHMAOverUnder3 =
//
(conditions.chmaConditions.isFastOverMax &&
conditions.chmaConditions.isFastUnderMax)
//
;
//
bool isCHMAOverUnder4 =
//
(conditions.chmaConditions.isSlowOverMax &&
conditions.chmaConditions.isSlowUnderMax)
//
;
//
if (isCHMAOverUnder1 || isCHMAOverUnder2 || isCHMAOverUnder3 || isCHMAOverUnder4)
{
Print("isCHMAOverUnder");
}
}
// Check Pivots ...
// HandleCheckPivots();
// //
// XOHCL cBar;
// bool isInit = cBar.Init(
// _Symbol,
// _Period,
// 1 //
// );
// if (!isInit)
// {
// return;
// }
// //
// datetime time1 = iTime(
// _Symbol,
// _Period,
// 2 //
// );
// //
// double fib382 = 0;
// //
// bool isHammer = cBar.IsHammer();
// if (isHammer)
// {
// //
// fib382 = GetFibonacciLevel(
// cBar.high,
// cBar.low,
// 0.382,
// -1 //
// );
// DrawTrendLine(
// ChartID(),
// "HMR_TR",
// 0,
// time1,
// fib382,
// cBar.time,
// fib382,
// clrYellow //
// );
// Print("Hammer ...");
// eaBarTracker.Waits();
// }
// //
// bool isShootingStar = cBar.IsShootingStar();
// if (isShootingStar)
// {
// //
// fib382 = GetFibonacciLevel(
// cBar.high,
// cBar.low,
// 0.382,
// 1 //
// );
// DrawTrendLine(
// ChartID(),
// "HMR_TR",
// 0,
// time1,
// fib382,
// cBar.time,
// fib382,
// clrYellow //
// );
// Print("ShootingStar ...");
// eaBarTracker.Waits();
// }
// //
// bool isBullishEngulf = cBar.IsBullishEngulf();
// if (isBullishEngulf)
// {
// //
// Print("Bullish Engulf ...");
// eaBarTracker.Waits();
// }
// //
// bool isBearishEngulf = cBar.IsBearishEngulf();
// if (isBearishEngulf)
// {
// //
// Print("Bearish Engulf ...");
// eaBarTracker.Waits();
// }
//
// Check Zones ...
HandleCheckZones();
}
//
@@ -457,18 +342,293 @@ void PreConfigureStyles(XTestInputs &inputs)
//
// XCHMA ...
inputs.chmaInputs.showFast = true;
inputs.chmaInputs.showSlow = true;
inputs.chmaInputs.showCCFast = true;
inputs.chmaInputs.showCCSlow = true;
inputs.chmaInputs.showSCFast = true;
inputs.chmaInputs.showSCSlow = true;
inputs.chmaInputs.showMCFast = true;
inputs.chmaInputs.showMCSlow = true;
inputs.chmaInputs.showLCFast = true;
inputs.chmaInputs.showLCSlow = true;
inputs.chmaInputs.showHCFast = true;
inputs.chmaInputs.showHCSlow = true;
inputs.chmaInputs.showFast = false;
inputs.chmaInputs.showSlow = false;
inputs.chmaInputs.showCCFast = false;
inputs.chmaInputs.showCCSlow = false;
inputs.chmaInputs.showSCFast = false;
inputs.chmaInputs.showSCSlow = false;
inputs.chmaInputs.showMCFast = false;
inputs.chmaInputs.showMCSlow = false;
inputs.chmaInputs.showLCFast = false;
inputs.chmaInputs.showLCSlow = false;
inputs.chmaInputs.showHCFast = false;
inputs.chmaInputs.showHCSlow = false;
}
//
// Custom Testing Functions ...
//
void HandleCheckPivots()
{
//
XOHCL cBar;
bool isInited = cBar.Init(
_Symbol,
_Period,
1 //
);
if (!isInited)
{
return;
}
//
// Check Resistance ...
if (!lastResistancePivot.isResistance)
{
//
isInited = lastResistancePivot.FindLastResistance(
_Symbol,
_Period //
);
if (!isInited)
{
//
lastResistancePivot.Clean();
return;
}
//
bool isDrawn = lastResistancePivot.Draw(ChartID());
if (isDrawn)
{
Print("Valid Resistance ...");
}
}
//
// Check Support ...
if (!lastSupportPivot.isSupport)
{
//
isInited = lastSupportPivot.FindLastSupport(
_Symbol,
_Period //
);
if (!isInited)
{
//
lastSupportPivot.Clean();
return;
}
//
bool isDrawn = lastSupportPivot.Draw(ChartID());
if (isDrawn)
{
Print("Valid Support ...");
}
}
else
{
//
bool isBreaked = lastSupportPivot.IsBreaked();
bool isRejected = lastSupportPivot.IsRejected();
//
if (isBreaked)
{
//
lastSupportPivot.Clean();
Print("Support Breaked ...");
}
//
if (isRejected)
{
//
lastSupportPivot.Clean();
Print("Support Rejected ...");
}
}
}
//
void HandleCheckZones() {
//
bool result = false;
//
// Find Last Support Zone ...
if (!lastSupportZone.IsValid()) {
//
result = lastSupportZone.FindLastSupportZone(
_Symbol,
_Period //
);
if (!result) {
return;
}
//
result = lastSupportZone.Draw(ChartID());
if (result) {
Print("Valid Support Zone ...");
}
} else {
}
//
// Find Last Resistance Zone ...
if (!lastResistanceZone.IsValid()) {
//
result = lastResistanceZone.FindLastResistanceZone(
_Symbol,
_Period //
);
if (!result) {
return;
}
//
result = lastResistanceZone.Draw(ChartID());
if (result) {
Print("Valid Resistance Zone ...");
}
} else {
}
}
//
void OldTests()
{
// //
// XTestConditions conditions;
// bool hasConditions = iSetup.GetConditions(
// conditions,
// 0,
// 5 //
// );
// if (hasConditions)
// {
// //
// bool isCHMAOverUnder1 =
// //
// (conditions.chmaConditions.isFastOverMin &&
// conditions.chmaConditions.isFastUnderMin)
// //
// ;
// //
// bool isCHMAOverUnder2 =
// //
// (conditions.chmaConditions.isSlowOverMin &&
// conditions.chmaConditions.isSlowUnderMin)
// //
// ;
// //
// bool isCHMAOverUnder3 =
// //
// (conditions.chmaConditions.isFastOverMax &&
// conditions.chmaConditions.isFastUnderMax)
// //
// ;
// //
// bool isCHMAOverUnder4 =
// //
// (conditions.chmaConditions.isSlowOverMax &&
// conditions.chmaConditions.isSlowUnderMax)
// //
// ;
// //
// if (isCHMAOverUnder1 || isCHMAOverUnder2 || isCHMAOverUnder3 || isCHMAOverUnder4)
// {
// Print("isCHMAOverUnder");
// }
// }
// //
// XOHCL cBar;
// bool isInit = cBar.Init(
// _Symbol,
// _Period,
// 1 //
// );
// if (!isInit)
// {
// return;
// }
// //
// datetime time1 = iTime(
// _Symbol,
// _Period,
// 2 //
// );
// //
// double fib382 = 0;
// //
// bool isHammer = cBar.IsHammer();
// if (isHammer)
// {
// //
// fib382 = GetFibonacciLevel(
// cBar.high,
// cBar.low,
// 0.382,
// -1 //
// );
// DrawTrendLine(
// ChartID(),
// "HMR_TR",
// 0,
// time1,
// fib382,
// cBar.time,
// fib382,
// clrYellow //
// );
// Print("Hammer ...");
// eaBarTracker.Waits();
// }
// //
// bool isShootingStar = cBar.IsShootingStar();
// if (isShootingStar)
// {
// //
// fib382 = GetFibonacciLevel(
// cBar.high,
// cBar.low,
// 0.382,
// 1 //
// );
// DrawTrendLine(
// ChartID(),
// "HMR_TR",
// 0,
// time1,
// fib382,
// cBar.time,
// fib382,
// clrYellow //
// );
// Print("ShootingStar ...");
// eaBarTracker.Waits();
// }
// //
// bool isBullishEngulf = cBar.IsBullishEngulf();
// if (isBullishEngulf)
// {
// //
// Print("Bullish Engulf ...");
// eaBarTracker.Waits();
// }
// //
// bool isBearishEngulf = cBar.IsBearishEngulf();
// if (isBearishEngulf)
// {
// //
// Print("Bearish Engulf ...");
// eaBarTracker.Waits();
// }
}
//