last bkp ...
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,585 @@
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 X12 Conditions Parser Library
|
||||
// -----------------------------------------------------
|
||||
// Name: X121ConditionsParser
|
||||
// Description: provides Market Conditions
|
||||
// Parsing Requirements ...
|
||||
//
|
||||
//
|
||||
// Maintainer:
|
||||
// ------------
|
||||
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Properties ...
|
||||
#property library
|
||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||
#property link "https://www.saherelm.ir"
|
||||
#property version "1.00"
|
||||
#property strict
|
||||
|
||||
//
|
||||
#include "../Libraries/x-saherelm.common.lib.mq5"
|
||||
#include "../Libraries/x-saherelm.models.lib.mq5"
|
||||
#include "../Classes/x-saherelm.x121.provider.class.mq5"
|
||||
|
||||
//
|
||||
// START Functions ...
|
||||
//
|
||||
|
||||
//
|
||||
// MARKET Direction ...
|
||||
//
|
||||
|
||||
//
|
||||
bool IsMarketStronglyBullish(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
(
|
||||
//
|
||||
conditions.xmanInfo.isSCSwitchedToBullish ||
|
||||
conditions.xmanInfo.isMCSwitchedToBullish ||
|
||||
conditions.xmanInfo.isLCSwitchedToBullish ||
|
||||
conditions.xmanInfo.isHCSwitchedToBullish ||
|
||||
conditions.xmanInfo.isSSLCSwitchedToBullish ||
|
||||
conditions.xmanInfo.isHullSwitchedToBullish ||
|
||||
conditions.xmanInfo.isTrendSwitchedToBullish ||
|
||||
conditions.xmanInfo.isRibbonSwitchedToBullish
|
||||
//
|
||||
)
|
||||
//
|
||||
&&
|
||||
//
|
||||
(
|
||||
//
|
||||
conditions.xmanInfo.isSSLCBullish &&
|
||||
conditions.xmanInfo.isHullBullish &&
|
||||
conditions.xmanInfo.isTrendBullish &&
|
||||
conditions.xmanInfo.isRibbonBullish
|
||||
//
|
||||
)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool IsMarketStronglyBearish(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
(
|
||||
//
|
||||
conditions.xmanInfo.isSCSwitchedToBearish ||
|
||||
conditions.xmanInfo.isMCSwitchedToBearish ||
|
||||
conditions.xmanInfo.isLCSwitchedToBearish ||
|
||||
conditions.xmanInfo.isHCSwitchedToBearish ||
|
||||
conditions.xmanInfo.isSSLCSwitchedToBearish ||
|
||||
conditions.xmanInfo.isHullSwitchedToBearish ||
|
||||
conditions.xmanInfo.isTrendSwitchedToBearish ||
|
||||
conditions.xmanInfo.isRibbonSwitchedToBearish
|
||||
//
|
||||
)
|
||||
//
|
||||
&&
|
||||
//
|
||||
(
|
||||
//
|
||||
conditions.xmanInfo.isSSLCBearish &&
|
||||
conditions.xmanInfo.isHullBearish &&
|
||||
conditions.xmanInfo.isTrendBearish &&
|
||||
conditions.xmanInfo.isRibbonBearish
|
||||
//
|
||||
)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// PEASK and VALES ...
|
||||
//
|
||||
|
||||
//
|
||||
// Check New Peaks Happens ...
|
||||
bool IsNewPeak(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
conditions.xmanInfo.peaks[0] != EMPTY_VALUE &&
|
||||
conditions.xmanInfo.peaks[0] != conditions.xmanInfo.peaks[1];
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check New Vales Happens ...
|
||||
bool IsNewVale(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
conditions.xmanInfo.vales[0] != EMPTY_VALUE &&
|
||||
conditions.xmanInfo.vales[0] != conditions.xmanInfo.vales[1];
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check New Peak Happens Under Last Peak ...
|
||||
bool IsNewPeakUnderLast(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
IsNewPeak(conditions) &&
|
||||
conditions.xmanInfo.peaks[0] < conditions.xmanInfo.peaks[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check New Peak Happens Over Last Peak ...
|
||||
bool IsNewPeakOverLast(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
IsNewPeak(conditions) &&
|
||||
conditions.xmanInfo.peaks[0] > conditions.xmanInfo.peaks[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check New Vale Happens Under Last Vale ...
|
||||
bool IsNewValeUnderLast(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
IsNewVale(conditions) &&
|
||||
conditions.xmanInfo.vales[0] < conditions.xmanInfo.vales[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check New Vale Happens Over Last Vale ...
|
||||
bool IsNewValeOverLast(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
IsNewVale(conditions) &&
|
||||
conditions.xmanInfo.vales[0] > conditions.xmanInfo.vales[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// FIBONACCI ...
|
||||
//
|
||||
|
||||
//
|
||||
// Check Finbonacci Increased ...
|
||||
bool IsFiboIncreased(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
conditions.xmanInfo.fibLevel1s[0] > conditions.xmanInfo.fibLevel1s[1] &&
|
||||
conditions.xmanInfo.fibLevel2s[0] > conditions.xmanInfo.fibLevel2s[1] &&
|
||||
conditions.xmanInfo.fibLevel3s[0] > conditions.xmanInfo.fibLevel3s[1] &&
|
||||
conditions.xmanInfo.fibLevel4s[0] > conditions.xmanInfo.fibLevel4s[1] &&
|
||||
conditions.xmanInfo.fibLevel5s[0] > conditions.xmanInfo.fibLevel5s[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Fibonacci Decreased ...
|
||||
bool IsFiboDecreased(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
conditions.xmanInfo.fibLevel1s[0] < conditions.xmanInfo.fibLevel1s[1] &&
|
||||
conditions.xmanInfo.fibLevel2s[0] < conditions.xmanInfo.fibLevel2s[1] &&
|
||||
conditions.xmanInfo.fibLevel3s[0] < conditions.xmanInfo.fibLevel3s[1] &&
|
||||
conditions.xmanInfo.fibLevel4s[0] < conditions.xmanInfo.fibLevel4s[1] &&
|
||||
conditions.xmanInfo.fibLevel5s[0] < conditions.xmanInfo.fibLevel5s[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Fibonacci Crossed ...
|
||||
bool IsFiboCrossed(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
conditions.xmanInfo.fibLevel1s[0] == conditions.xmanInfo.fibLevel2s[0] ||
|
||||
conditions.xmanInfo.fibLevel1s[0] == conditions.xmanInfo.fibLevel3s[0] ||
|
||||
conditions.xmanInfo.fibLevel1s[0] == conditions.xmanInfo.fibLevel4s[0] ||
|
||||
conditions.xmanInfo.fibLevel1s[0] == conditions.xmanInfo.fibLevel5s[0] ||
|
||||
conditions.xmanInfo.fibLevel2s[0] == conditions.xmanInfo.fibLevel3s[0] ||
|
||||
conditions.xmanInfo.fibLevel2s[0] == conditions.xmanInfo.fibLevel4s[0] ||
|
||||
conditions.xmanInfo.fibLevel2s[0] == conditions.xmanInfo.fibLevel5s[0] ||
|
||||
conditions.xmanInfo.fibLevel3s[0] == conditions.xmanInfo.fibLevel4s[0] ||
|
||||
conditions.xmanInfo.fibLevel3s[0] == conditions.xmanInfo.fibLevel5s[0] ||
|
||||
conditions.xmanInfo.fibLevel4s[0] == conditions.xmanInfo.fibLevel5s[0]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Fibonacci Section Changes ...
|
||||
bool IsFiboSectionChanged(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
(IsNewPeakUnderLast(conditions) &&
|
||||
IsFiboDecreased(conditions))
|
||||
//
|
||||
||
|
||||
//
|
||||
(IsNewValeOverLast(conditions) &&
|
||||
IsFiboIncreased(conditions))
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// HULL Trend ...
|
||||
//
|
||||
|
||||
//
|
||||
// Check Hull Trend Crosses with Fibo Levels ...
|
||||
|
||||
//
|
||||
// Fib 1 ...
|
||||
|
||||
//
|
||||
// Cross Over ...
|
||||
bool IsHullCrossedOverFibo1(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
conditions.xmanInfo.hullDowns[0] > conditions.xmanInfo.fibLevel1s[0] &&
|
||||
conditions.xmanInfo.hullDowns[1] <= conditions.xmanInfo.fibLevel1s[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Cross Under ...
|
||||
bool IsHullCrossedUnderFibo1(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
conditions.xmanInfo.hullUps[0] < conditions.xmanInfo.fibLevel1s[0] &&
|
||||
conditions.xmanInfo.hullUps[1] >= conditions.xmanInfo.fibLevel1s[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Fib 2 ...
|
||||
|
||||
//
|
||||
// Cross Over ...
|
||||
bool IsHullCrossedOverFibo2(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
conditions.xmanInfo.hullDowns[0] > conditions.xmanInfo.fibLevel2s[0] &&
|
||||
conditions.xmanInfo.hullDowns[1] <= conditions.xmanInfo.fibLevel2s[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Cross Under ...
|
||||
bool IsHullCrossedUnderFibo2(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
conditions.xmanInfo.hullUps[0] < conditions.xmanInfo.fibLevel2s[0] &&
|
||||
conditions.xmanInfo.hullUps[1] >= conditions.xmanInfo.fibLevel2s[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Fib 3 ...
|
||||
|
||||
//
|
||||
// Cross Over ...
|
||||
bool IsHullCrossedOverFibo3(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
conditions.xmanInfo.hullDowns[0] > conditions.xmanInfo.fibLevel3s[0] &&
|
||||
conditions.xmanInfo.hullDowns[1] <= conditions.xmanInfo.fibLevel3s[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Cross Under ...
|
||||
bool IsHullCrossedUnderFibo3(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
conditions.xmanInfo.hullUps[0] < conditions.xmanInfo.fibLevel3s[0] &&
|
||||
conditions.xmanInfo.hullUps[1] >= conditions.xmanInfo.fibLevel3s[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Fib 4 ...
|
||||
|
||||
//
|
||||
// Cross Over ...
|
||||
bool IsHullCrossedOverFibo4(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
conditions.xmanInfo.hullDowns[0] > conditions.xmanInfo.fibLevel4s[0] &&
|
||||
conditions.xmanInfo.hullDowns[1] <= conditions.xmanInfo.fibLevel4s[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Cross Under ...
|
||||
bool IsHullCrossedUnderFibo4(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
conditions.xmanInfo.hullUps[0] < conditions.xmanInfo.fibLevel4s[0] &&
|
||||
conditions.xmanInfo.hullUps[1] >= conditions.xmanInfo.fibLevel4s[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Fib 5 ...
|
||||
|
||||
//
|
||||
// Cross Over ...
|
||||
bool IsHullCrossedOverFibo5(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
conditions.xmanInfo.hullDowns[0] > conditions.xmanInfo.fibLevel5s[0] &&
|
||||
conditions.xmanInfo.hullDowns[1] <= conditions.xmanInfo.fibLevel5s[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Cross Under ...
|
||||
bool IsHullCrossedUnderFibo5(
|
||||
X121MarketConditions &conditions // Specified Conditions
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
conditions.xmanInfo.hullUps[0] < conditions.xmanInfo.fibLevel5s[0] &&
|
||||
conditions.xmanInfo.hullUps[1] >= conditions.xmanInfo.fibLevel5s[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// END Functions ...
|
||||
//
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user