bkp dosuments ...
This commit is contained in:
@@ -0,0 +1,153 @@
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user