This commit is contained in:
2025-09-16 10:55:50 +03:30
parent 5dd58eec74
commit 83ef415ca2
5 changed files with 1530 additions and 4 deletions
+112 -2
View File
@@ -862,9 +862,9 @@ double GetXSpread(
/**
* Get SPecified Symbols Volume Step ...
*
*
* @param mSymbol: string ...
*
*
* @return ( double )
*/
double GetVolumeStep(
@@ -1110,6 +1110,116 @@ bool GetTick(
return SymbolInfoTick(mSymbol, tick);
}
//
// Peak and Vales ...
int FindXSwing(
ENUM_X_SWING_TYPE mType,
string mSymbol = NULL,
ENUM_TIMEFRAMES mPeriod = NULL,
int mFromIndex = 0,
int mShoulders = 5 //
)
{
//
int result = -1;
//
// Validate ...
if (!IsXValid(mType))
{
return result;
}
//
result = mFromIndex;
int foundedIDX = FindXNextSwing(
mType,
mSymbol,
mPeriod,
result - mShoulders,
mShoulders * 2 + 1 //
);
while (foundedIDX != result)
{
//
result = FindXNextSwing(
mType,
mSymbol,
mPeriod,
result + 1,
mShoulders //
);
//
foundedIDX = FindXNextSwing(
mType,
mSymbol,
mPeriod,
result - mShoulders,
mShoulders * 2 + 1 //
);
}
//
return result;
}
int FindXNextSwing(
ENUM_X_SWING_TYPE mType,
string mSymbol = NULL,
ENUM_TIMEFRAMES mPeriod = NULL,
int mFromIndex = 0,
int mShoulders = 5 //
)
{
//
int result = -1;
//
if (mFromIndex < 0)
{
mShoulders += mFromIndex;
}
//
// Normalize ...
mSymbol = NormalizeSymbol(mSymbol);
mPeriod = NormalizePeriod(mPeriod);
mFromIndex = NormalizeInt(mFromIndex, 0);
mShoulders = NormalizeInt(mShoulders, 3);
//
// Validate ....
if (!IsXValid(mType))
{
return result;
}
//
// Converts Swing Type to Series Mode ...
ENUM_SERIESMODE mode = ToSeriesMode(mType);
result =
mode == MODE_HIGH
? iHighest(
mSymbol,
mPeriod,
mode,
mShoulders,
mFromIndex //
)
: iLowest(
mSymbol,
mPeriod,
mode,
mShoulders,
mFromIndex //
);
//
return result;
}
//
// END Position ...
//