prepare all indicators for working by new structures of libraries and models and compile them successfully ...

This commit is contained in:
2024-05-18 02:26:29 +03:30
parent 8f08fa00cc
commit b83bc47f8f
15 changed files with 2833 additions and 3418 deletions
+6 -12
View File
@@ -48,10 +48,6 @@ input ENUM_APPLIED_PRICE appliedTo = PRICE_CLOSE; // Applied To
// END Inputs ...
//
//
// Includes Logging Library ...
#include "../Libraries/x-saherelm.log.lib.mq5"
//
// Includes Common Library ...
#include "../Libraries/x-saherelm.common.lib.mq5"
@@ -106,9 +102,6 @@ int OnInit()
return INIT_PARAMETERS_INCORRECT;
}
//
logTag = ShortName;
//
// Initializing MA Handler ...
maHandler = iAMA(
@@ -121,10 +114,6 @@ int OnInit()
appliedTo);
if (maHandler == INVALID_HANDLE)
{
//
string message = "Error Initializing Ma Handler ...";
LogMessage(message);
//
return INIT_FAILED;
}
@@ -320,7 +309,12 @@ void CalculateBuffers(int bar_index)
{
//
// Requirements ...
XOHCL candle = GetCandle(bar_index);
XOHCL candle;
candle.Init(
_Symbol,
_Period,
bar_index
);
//
double maValue = maBuffer[bar_index];
+85 -27
View File
@@ -33,9 +33,6 @@ enum ENUM_X_XCHLH_HOT_STATES
X_XCHLH_HOT_LL = -1,
};
//
// Including Models Library ...
#include "../Libraries/x-saherelm.models.lib.mq5"
//
// END Constants ...
//
@@ -190,7 +187,6 @@ int OnInit()
}
//
logTag = ShortName;
drawPrefix = ShortName;
//
@@ -229,10 +225,6 @@ void OnDeinit(const int reason)
// ReDraw Chart ...
ChartRedraw();
//
// De Init Draw Library ...
OnDeinitDrawLibrary();
//
Comment("");
}
@@ -529,15 +521,35 @@ void LCCalculateBuffers(
ENUM_SERIESMODE hhMode = lcHHMode;
ENUM_SERIESMODE llMode = lcLLMode;
double threshold = PipsToPrice(lcThresholdInPips);
double hh = GetHighestHigh(
//
int hhIdx = iHighest(
_Symbol,
_Period,
hhMode,
length,
bar_index,
hhMode);
bar_index
//
);
double hh = iHigh(
_Symbol,
_Period,
hhIdx);
double hhValue = hh + threshold;
double ll = GetLowestLow(
//
int llIdx = iLowest(
_Symbol,
_Period,
llMode,
length,
bar_index,
llMode);
bar_index
//
);
double ll = iLow(
_Symbol,
_Period,
llIdx);
double llValue = ll - threshold;
//
@@ -557,15 +569,35 @@ void MCCalculateBuffers(
ENUM_SERIESMODE hhMode = mcHHMode;
ENUM_SERIESMODE llMode = mcLLMode;
double threshold = PipsToPrice(mcThresholdInPips);
double hh = GetHighestHigh(
//
int hhIdx = iHighest(
_Symbol,
_Period,
hhMode,
length,
bar_index,
hhMode);
bar_index
//
);
double hh = iHigh(
_Symbol,
_Period,
hhIdx);
double hhValue = hh + threshold;
double ll = GetLowestLow(
//
int llIdx = iLowest(
_Symbol,
_Period,
llMode,
length,
bar_index,
llMode);
bar_index
//
);
double ll = iLow(
_Symbol,
_Period,
llIdx);
double llValue = ll - threshold;
//
@@ -585,15 +617,35 @@ void SCCalculateBuffers(
ENUM_SERIESMODE hhMode = scHHMode;
ENUM_SERIESMODE llMode = scLLMode;
double threshold = PipsToPrice(scThresholdInPips);
double hh = GetHighestHigh(
//
int hhIdx = iHighest(
_Symbol,
_Period,
hhMode,
length,
bar_index,
hhMode);
bar_index
//
);
double hh = iHigh(
_Symbol,
_Period,
hhIdx);
double hhValue = hh + threshold;
double ll = GetLowestLow(
//
int llIdx = iLowest(
_Symbol,
_Period,
llMode,
length,
bar_index,
llMode);
bar_index
//
);
double ll = iLow(
_Symbol,
_Period,
llIdx);
double llValue = ll - threshold;
//
@@ -710,7 +762,13 @@ void DrawBuffers(
//
// Retrieve Candle Model ...
XOHCL candle = GetCandle(bar_index);
XOHCL candle;
candle.Init(
_Symbol,
_Period,
bar_index
//
);
datetime time = iTime(_Symbol, _Period, bar_index);
//
+13 -40
View File
@@ -110,10 +110,6 @@ input bool scDrawCrosses = false; // Draw Cross Lines
// END Inputs ...
//
//
// Includes Logging Library ...
#include "../Libraries/x-saherelm.log.lib.mq5"
//
// Includes Common Library ...
#include "../Libraries/x-saherelm.common.lib.mq5"
@@ -205,7 +201,6 @@ int OnInit()
}
//
logTag = ShortName;
drawPrefix = ShortName;
//
@@ -251,10 +246,6 @@ void OnDeinit(const int reason)
// ReDraw Chart ...
ChartRedraw();
//
// De Init Draw Library ...
OnDeinitDrawLibrary();
//
Comment("");
}
@@ -640,10 +631,6 @@ bool LCInitHandlers()
lcAppliedTo);
if (lcFastHandler == INVALID_HANDLE)
{
//
LogMessage("LC Fast Indicator initialization failed: " + (string)GetLastError());
//
return false;
}
@@ -658,10 +645,6 @@ bool LCInitHandlers()
lcAppliedTo);
if (lcSlowHandler == INVALID_HANDLE)
{
//
LogMessage("LC Slow Indicator initialization failed: " + (string)GetLastError());
//
return false;
}
@@ -687,10 +670,6 @@ bool MCInitHandlers()
mcAppliedTo);
if (mcFastHandler == INVALID_HANDLE)
{
//
LogMessage("MC Fast Indicator initialization failed: " + (string)GetLastError());
//
return false;
}
@@ -705,10 +684,6 @@ bool MCInitHandlers()
mcAppliedTo);
if (mcSlowHandler == INVALID_HANDLE)
{
//
LogMessage("MC Slow Indicator initialization failed: " + (string)GetLastError());
//
return false;
}
@@ -734,10 +709,6 @@ bool SCInitHandlers()
scAppliedTo);
if (scFastHandler == INVALID_HANDLE)
{
//
LogMessage("SC Fast Indicator initialization failed: " + (string)GetLastError());
//
return false;
}
@@ -752,10 +723,6 @@ bool SCInitHandlers()
scAppliedTo);
if (scSlowHandler == INVALID_HANDLE)
{
//
LogMessage("SC Slow Indicator initialization failed: " + (string)GetLastError());
//
return false;
}
@@ -771,7 +738,7 @@ double GetLCState(
{
//
// Fast Cross Over Slow Detection ...
bool isFastCrossedOverSlow = IsCrossOver(
bool isFastCrossedOverSlow = IsCrossedOver(
lcFastBuffer,
lcSlowBuffer,
bar_index);
@@ -785,7 +752,7 @@ double GetLCState(
//
// Fast Cross Under Slow Detection ...
bool isFastCrossedUnderSlow = IsCrossUnder(
bool isFastCrossedUnderSlow = IsCrossedUnder(
lcFastBuffer,
lcSlowBuffer,
bar_index);
@@ -833,7 +800,7 @@ double GetMCState(
{
//
// Fast Cross Over Slow Detection ...
bool isFastCrossedOverSlow = IsCrossOver(
bool isFastCrossedOverSlow = IsCrossedOver(
mcFastBuffer,
mcSlowBuffer,
bar_index);
@@ -847,7 +814,7 @@ double GetMCState(
//
// Fast Cross Under Slow Detection ...
bool isFastCrossedUnderSlow = IsCrossUnder(
bool isFastCrossedUnderSlow = IsCrossedUnder(
mcFastBuffer,
mcSlowBuffer,
bar_index);
@@ -895,7 +862,7 @@ double GetSCState(
{
//
// Fast Cross Over Slow Detection ...
bool isFastCrossedOverSlow = IsCrossOver(
bool isFastCrossedOverSlow = IsCrossedOver(
scFastBuffer,
scSlowBuffer,
bar_index);
@@ -909,7 +876,7 @@ double GetSCState(
//
// Fast Cross Under Slow Detection ...
bool isFastCrossedUnderSlow = IsCrossUnder(
bool isFastCrossedUnderSlow = IsCrossedUnder(
scFastBuffer,
scSlowBuffer,
bar_index);
@@ -1031,7 +998,13 @@ void DrawBuffers(
//
// Retrieve Candle Model ...
XOHCL candle = GetCandle(bar_index);
XOHCL candle;
candle.Init(
_Symbol,
_Period,
bar_index
//
);
datetime time = iTime(_Symbol, _Period, bar_index);
//
@@ -39,6 +39,14 @@ input ENUM_BASE_CORNER corner = CORNER_RIGHT_LOWER;
//
// START Buffers ...
//
//
#property indicator_chart_window
//
#property indicator_buffers 0
#property indicator_plots 0
//
// END Buffers ...
//
-12
View File
@@ -38,10 +38,6 @@ input ENUM_APPLIED_VOLUME appliedTo = VOLUME_TICK; // Applied To
// END Inputs ...
//
//
// Includes Logging Library ...
#include "../Libraries/x-saherelm.log.lib.mq5"
//
// Includes Common Library ...
#include "../Libraries/x-saherelm.common.lib.mq5"
@@ -96,9 +92,6 @@ int OnInit()
return INIT_PARAMETERS_INCORRECT;
}
//
logTag = ShortName;
//
fiHandler = iForce(
_Symbol,
@@ -108,11 +101,6 @@ int OnInit()
appliedTo);
if (fiHandler == INVALID_HANDLE)
{
//
string message = "Error Initializing Handler ...";
LogMessage(message);
//
return INIT_FAILED;
}
+22 -16
View File
@@ -38,10 +38,6 @@ input ENUM_SERIESMODE llMode = MODE_LOW; // Lowest Low Calculation Method
// END Inputs ...
//
//
// Includes Logging Library ...
#include "../Libraries/x-saherelm.log.lib.mq5"
//
// Includes Common Library ...
#include "../Libraries/x-saherelm.common.lib.mq5"
@@ -121,9 +117,6 @@ int OnInit()
return INIT_PARAMETERS_INCORRECT;
}
//
logTag = ShortName;
//
// Define Index Buffers ...
DefineBuffers();
@@ -310,10 +303,17 @@ void CalculateBuffers(
_Period,
hhMode,
length,
bar_index);
double hhValue = GetAppliedPrice(
hhIndex,
hhMode);
bar_index
//
);
XOHCL hhBar;
hhBar.Init(
_Symbol,
_Period,
hhIndex
//
);
double hhValue = hhBar.GetPrice(hhMode);
//
hhBuffer[bar_index] = hhValue;
@@ -325,16 +325,22 @@ void CalculateBuffers(
_Period,
llMode,
length,
bar_index);
double llValue = GetAppliedPrice(
llIndex,
llMode);
bar_index
//
);
XOHCL llBar;
llBar.Init(
_Symbol,
_Period,
llIndex
//
);
double llValue = llBar.GetPrice(llMode);
//
llBuffer[bar_index] = llValue;
//
XOHCL c = GetCandle(bar_index);
double lhDiff = hhValue - llValue;
double signalValue = (lhDiff / 2);
+29 -35
View File
@@ -44,10 +44,6 @@ input color swingLowArrowColor = clrAqua; // Swing Low Arrow Color
// END Inputs ...
//
//
// Includes Logging Library ...
#include "../Libraries/x-saherelm.log.lib.mq5"
//
// Include Common and Models Library ...
#include "../Libraries/x-saherelm.common.lib.mq5"
@@ -94,7 +90,6 @@ int OnInit()
}
//
logTag = ShortName;
drawPrefix = ShortName;
//
@@ -125,10 +120,6 @@ void OnDeinit(const int reason)
// REASON_TEMPLATE 7 Another chart template applied
// REASON_INITFAILED 8 The OnInit() handler returned a non-zero value
// REASON_CLOSE 9 Terminal closed
//
// Here we can handle De Initialization Reasons ...
OnDeinitDrawLibrary();
}
//
@@ -264,32 +255,30 @@ void CalculateBuffers(int bar_index)
//
// Reading Candles Data ...
XOHCL candles[];
for (int i = bar_index; i < bar_index + ((length * 2) + 2); i++)
{
int start = bar_index;
int count = (length * 2) + 2;
int end = start + count;
XOHCL bars[];
GetBars(
bars,
_Symbol,
_Period,
start,
count
//
XOHCL iCandle = GetCandle(
_Symbol,
_Period,
i);
//
Add(
iCandle,
candles);
}
);
//
// Swing Low ...
isSwingLow =
//
candles[1].close > candles[2].close &&
candles[2].close > candles[3].close &&
bars[1].close > bars[2].close &&
bars[2].close > bars[3].close &&
//
candles[3].close < candles[4].close &&
bars[3].close < bars[4].close &&
//
candles[5].close > candles[4].close &&
candles[6].close > candles[5].close
bars[5].close > bars[4].close &&
bars[6].close > bars[5].close
//
;
@@ -306,13 +295,13 @@ void CalculateBuffers(int bar_index)
// Swing High ...
isSwingHigh =
//
candles[1].close < candles[2].close &&
candles[2].close < candles[3].close &&
bars[1].close < bars[2].close &&
bars[2].close < bars[3].close &&
//
candles[3].close > candles[4].close &&
bars[3].close > bars[4].close &&
//
candles[5].close < candles[4].close &&
candles[6].close < candles[5].close
bars[5].close < bars[4].close &&
bars[6].close < bars[5].close
//
;
@@ -355,12 +344,17 @@ void CalculateBuffers(int bar_index)
//
// Draw a Swing Arrow Shape ...
void DrawSwingArrow(
int type, // Swing Type: 0 - Low / 1 - High ...
int bar_index)
int type, // Swing Type: 0 - Low / 1 - High ...
int bar_index //
)
{
//
bool isSwingHigh = type == 1;
XOHCL candle = GetCandle(bar_index + 3);
XOHCL candle;
candle.Init(
_Symbol,
_Period,
bar_index + 3);
double arrowDistanceInPoint = 0;
//
@@ -66,10 +66,6 @@ input ENUM_LINE_STYLE longExitLineStyle = STYLE_DOT; // Long Exit Style
// START Inputs ...
//
//
// Includes Logging Library ...
#include "../Libraries/x-saherelm.log.lib.mq5"
//
// Include Common and Models Library ...
#include "../Libraries/x-saherelm.common.lib.mq5"
@@ -127,9 +123,6 @@ int OnInit()
return INIT_PARAMETERS_INCORRECT;
}
//
logTag = ShortName;
//
rsiHandler = iRSI(
_Symbol,
+2 -15
View File
@@ -38,10 +38,6 @@ enum ENUM_X_XTD_STATES
// END Constants ...
//
//
// Include Models Library ...
#include "../Libraries/x-saherelm.models.lib.mq5"
//
// START Inputs ...
//
@@ -61,10 +57,6 @@ input color bearishArrowColor = clrMagenta; // Cross Under Arrow Color
// END Inputs ...
//
//
// Includes Logging Library ...
#include "../Libraries/x-saherelm.log.lib.mq5";
//
// Includes Common Library ...
#include "../Libraries/x-saherelm.common.lib.mq5";
@@ -141,7 +133,6 @@ int OnInit()
}
//
logTag = ShortName;
drawPrefix = ShortName;
//
@@ -175,10 +166,6 @@ void OnDeinit(const int reason)
//
// Here we can handle De Initialization Reasons ...
//
// De Init Draw Library ...
OnDeinitDrawLibrary();
}
//
@@ -383,11 +370,11 @@ double GetState(
// bullishCrossedUnderBearish = -2;
// bullishUnderBearish = -1;
// OtherWise = 0;
bool isBullishCrossedOverBearish = IsCrossOver(
bool isBullishCrossedOverBearish = IsCrossedOver(
bullishBuffer,
bearishBuffer,
bar_index);
bool isBullishCrossedUnderBearish = IsCrossUnder(
bool isBullishCrossedUnderBearish = IsCrossedUnder(
bullishBuffer,
bearishBuffer,
bar_index);
+7 -13
View File
@@ -47,10 +47,6 @@ input ENUM_APPLIED_PRICE maAppliedTo = PRICE_CLOSE; // Applied To
// END Inputs ...
//
//
// Includes Logging Library ...
#include "../Libraries/x-saherelm.log.lib.mq5"
//
// Includes Common Library ...
#include "../Libraries/x-saherelm.common.lib.mq5"
@@ -105,9 +101,6 @@ int OnInit()
return INIT_PARAMETERS_INCORRECT;
}
//
logTag = ShortName;
//
// Initializing MA Handler ...
maHandler = iMA(
@@ -119,11 +112,6 @@ int OnInit()
maAppliedTo);
if (maHandler == INVALID_HANDLE)
{
//
string message = "Error Initializing Ma Handler ...";
LogMessage(message);
//
return INIT_FAILED;
}
@@ -316,7 +304,13 @@ void CalculateBuffers(int bar_index)
{
//
// Requirements ...
XOHCL candle = GetCandle(bar_index);
XOHCL candle;
candle.Init(
_Symbol,
_Period,
bar_index
//
);
//
double maValue = maBuffer[bar_index];
+34 -50
View File
@@ -23,20 +23,16 @@
// START Constants ...
//
//
#define ShortName "XTS"
enum ENUM_X_PERIOD_METHOD
{
//
X_PERIOD_NOTHING,
//
X_PERIOD_AUTO,
//
X_PERIOD_MANUALLY
};
//
// Includes Draw Library ...
#include "../Libraries/x-saherelm.draw.lib.mq5"
//
// XTS Oscillator States ...
// Includes Common Library ...
#include "../Libraries/x-saherelm.common.lib.mq5"
//
// END Constants ...
@@ -63,18 +59,6 @@ input ENUM_X_PERIOD_METHOD farestMethod = X_PERIOD_AUTO; // How to Find Farest P
input ENUM_TIMEFRAMES farestPeriod = NULL; // Farest Time Frame
input ENUM_APPLIED_PRICE farestAppliedTo = PRICE_CLOSE; // Farest Applied To
//
// Includes Logging Library ...
#include "../Libraries/x-saherelm.log.lib.mq5"
//
// Includes Draw Library ...
#include "../Libraries/x-saherelm.draw.lib.mq5"
//
// Includes Common Library ...
#include "../Libraries/x-saherelm.common.lib.mq5"
//
// START Buffers ...
//
@@ -165,7 +149,6 @@ int OnInit()
}
//
logTag = ShortName;
drawPrefix = ShortName;
//
@@ -185,10 +168,6 @@ int OnInit()
// DeInitialization ...
void OnDeinit(const int reason)
{
//
OnDeinitDrawLibrary();
//
Comment("");
}
@@ -368,15 +347,16 @@ void CalculateCurrent(int bar_index)
startTime);
//
XOHCL c = GetCandle(
XOHCL c;
c.Init(
_Symbol,
_Period,
startBarIndex);
startBarIndex
//
);
//
double value = GetAppliedPrice(
c,
currentAppliedTo);
double value = c.GetPrice(currentAppliedTo);
//
currentBuffer[bar_index] = value;
@@ -394,7 +374,7 @@ void CalculateNearest(int bar_index)
{
//
case X_PERIOD_AUTO:
mNearestPeriod = GetNearestTimeFrame(_Period);
mNearestPeriod = GetNearestPeriod(_Period);
break;
//
@@ -420,15 +400,16 @@ void CalculateNearest(int bar_index)
startTime);
//
XOHCL c = GetCandle(
XOHCL c;
c.Init(
_Symbol,
_Period,
startBarIndex);
startBarIndex
//
);
//
double value = GetAppliedPrice(
c,
nearestAppliedTo);
double value = c.GetPrice(nearestAppliedTo);
//
nearestBuffer[bar_index] = value;
@@ -446,7 +427,7 @@ void CalculateMediest(int bar_index)
{
//
case X_PERIOD_AUTO:
mMediestPeriod = GetMediestTimeFrame(_Period);
mMediestPeriod = GetMediestPeriod(_Period);
break;
//
@@ -472,15 +453,16 @@ void CalculateMediest(int bar_index)
startTime);
//
XOHCL c = GetCandle(
XOHCL c;
c.Init(
_Symbol,
_Period,
startBarIndex);
startBarIndex
//
);
//
double value = GetAppliedPrice(
c,
mediestAppliedTo);
double value = c.GetPrice(mediestAppliedTo);
//
mediestBuffer[bar_index] = value;
@@ -498,7 +480,7 @@ void CalculateFarest(int bar_index)
{
//
case X_PERIOD_AUTO:
mFarestPeriod = GetFarestTimeFrame(_Period);
mFarestPeriod = GetLongestPeriod(_Period);
break;
//
@@ -524,15 +506,16 @@ void CalculateFarest(int bar_index)
startTime);
//
XOHCL c = GetCandle(
XOHCL c;
c.Init(
_Symbol,
_Period,
startBarIndex);
startBarIndex
//
);
//
double value = GetAppliedPrice(
c,
farestAppliedTo);
double value = c.GetPrice(farestAppliedTo);
//
farestBuffer[bar_index] = value;
@@ -553,6 +536,7 @@ string GenerateDescriptionComment()
//
return result;
}
//
// END Functions ...
//