Files
xMQL5/BKPS/14030923/Documents/BKP/tmp.base.x121.mq5
T
2024-12-19 01:33:40 +03:30

154 lines
3.0 KiB
Plaintext

/**
* Check Ticks is Bullish or not ...
*
* @return ( bool )
*/
bool IsTicksBullish()
{
//
bool result = false;
//
int start = -1;
int end = -1;
int requiredBullishTicks = 5;
CalculateTicksParams(
start,
end,
requiredBullishTicks //
);
result = IsValidIndex(start) &&
IsValidIndex(end);
if (!result)
{
return result;
}
//
result = true;
for (int i = start + 1; i < end; i++)
{
//
XTick iTick = mTicks[i];
XTick prevTick = mTicks[i - 1];
//
bool isBullish = iTick.bid >= prevTick.bid;
result = result && isBullish;
if (!result)
{
break;
}
}
//
return result;
}
/**
* Check Ticks is Bearish or not ...
*
* @return ( bool )
*/
bool IsTicksBearish()
{
//
bool result = false;
//
int start = -1;
int end = -1;
int requiredBearishTicks = 5;
CalculateTicksParams(
start,
end,
requiredBearishTicks //
);
result = IsValidIndex(start) &&
IsValidIndex(end);
if (!result)
{
return result;
}
//
result = true;
for (int i = start + 1; i < end; i++)
{
//
XTick iTick = mTicks[i];
XTick prevTick = mTicks[i - 1];
//
bool isBearish = iTick.bid <= prevTick.bid;
result = result && isBearish;
if (!result)
{
break;
}
}
//
return result;
}
/**
* Check Ticks Has Momentum or not ...
*
* @return ( bool )
*/
bool IsTicksHasMomentum()
{
//
bool result = false;
//
int start = -1;
int end = -1;
int requiredTicksForMomentum = 5;
CalculateTicksParams(
start,
end,
requiredTicksForMomentum //
);
result = IsValidIndex(start) &&
IsValidIndex(end);
if (!result)
{
return result;
}
//
result = true;
int lastDiff = 0;
for (int i = start + 1; i < end; i++)
{
//
XTick iTick = mTicks[i];
XTick prevTick = mTicks[i - 1];
//
int timeDiff = MathAbs((int)iTick.time - (int)prevTick.bid);
if (lastDiff <= 0)
{
lastDiff = timeDiff;
}
result = result && timeDiff >= lastDiff;
if (!result)
{
break;
}
//
lastDiff = timeDiff;
}
//
return result;
}
///////////////////////////////////////////////////////////////////////