last ...
This commit is contained in:
@@ -1136,6 +1136,51 @@ class XCBarAnalyser : public XCBase
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Specified Bar is Swing or not ...
|
||||
*
|
||||
* @param bar: XOHCL instnce ...
|
||||
* @param dir: ENUM_X_DIRECTION member ...
|
||||
* @param range: Integer, Specified Range ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsSwing(
|
||||
XOHCL &bar,
|
||||
ENUM_X_DIRECTION &dir,
|
||||
int range = 2 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
dir = X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
bool isSwingLow = IsSwingLow(bar, range);
|
||||
bool isSwingHigh = IsSwingHigh(bar, range);
|
||||
|
||||
//
|
||||
result = isSwingLow ||
|
||||
isSwingHigh;
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
if (isSwingLow)
|
||||
{
|
||||
dir = X_DIRECTION_BULLISH;
|
||||
}
|
||||
else
|
||||
{
|
||||
dir = X_DIRECTION_BEARISH;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a Bar is Momentum Bar or not ...
|
||||
*
|
||||
@@ -1935,6 +1980,90 @@ class XCBarAnalyser : public XCBase
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a Bar Has Resistance or not ...
|
||||
*
|
||||
* @param bar: XOHCL instance ...
|
||||
* @param resistanceBar: XOHCL instance Specified Resistance Bar ...
|
||||
* @param rage: int,
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasResistance(
|
||||
XOHCL &bar,
|
||||
XOHCL &resistanceBar,
|
||||
int range = 21 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = bar.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int barIndex = bar.Index() + range;
|
||||
result = IsValidIndex(barIndex);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
resistanceBar.Clean();
|
||||
return result;
|
||||
}
|
||||
result = resistanceBar.Init(
|
||||
bar.symbol,
|
||||
bar.period,
|
||||
barIndex //
|
||||
);
|
||||
|
||||
//
|
||||
result = resistanceBar.low < resistanceBar.GetDown();
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
resistanceBar.Clean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double selectedValue = resistanceBar.GetUp();
|
||||
|
||||
//
|
||||
int hhIDX = bar.FindHighestIndex(range - 1, MODE_HIGH);
|
||||
result = IsValidIndex(hhIDX);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
resistanceBar.Clean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double hhValue = iHigh(
|
||||
bar.symbol,
|
||||
bar.period,
|
||||
hhIDX //
|
||||
);
|
||||
|
||||
//
|
||||
result = hhValue >= selectedValue;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
resistanceBar.Clean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = resistanceBar.IsValid();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Order Blocks ...
|
||||
|
||||
|
||||
@@ -2364,3 +2364,307 @@ bool IsReject(
|
||||
//
|
||||
Clean(tmps);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// //
|
||||
// // Calculate Rejection Values ...
|
||||
|
||||
// //
|
||||
// double fiboUpDown = GetFibonacciLevel(
|
||||
// iBar.high,
|
||||
// iBar.low,
|
||||
// X_FIBO_LEVEL_382,
|
||||
// X_DIRECTION_BEARISH //
|
||||
// );
|
||||
// double fiboDownUp = GetFibonacciLevel(
|
||||
// iBar.high,
|
||||
// iBar.low,
|
||||
// X_FIBO_LEVEL_382,
|
||||
// X_DIRECTION_BULLISH //
|
||||
// );
|
||||
|
||||
// //
|
||||
// bool hasFiboToUpPressure =
|
||||
// fiboDownUp > 0 &&
|
||||
// fiboDownUp <= iBar.GetDown();
|
||||
// bool hasFiboToDownPressure =
|
||||
// fiboUpDown > 0 &&
|
||||
// fiboUpDown >= iBar.GetUp();
|
||||
|
||||
// //
|
||||
// bool isLongReject =
|
||||
// //
|
||||
// iBar.low < iMa &&
|
||||
// iBar.high >= iMa &&
|
||||
// iBar.GetDown() >= iMa
|
||||
// //
|
||||
// ;
|
||||
// bool isStrongLongReject =
|
||||
// iBar.IsBullish() &&
|
||||
// isLongReject;
|
||||
// bool isPressuredLongReject =
|
||||
// isLongReject &&
|
||||
// hasFiboToUpPressure;
|
||||
// bool isPressuredStrongLongReject =
|
||||
// isStrongLongReject &&
|
||||
// isPressuredLongReject;
|
||||
|
||||
// //
|
||||
// bool isShortReject =
|
||||
// //
|
||||
// iBar.high > iMa &&
|
||||
// iBar.low <= iMa &&
|
||||
// iBar.GetUp() <= iMa
|
||||
// //
|
||||
// ;
|
||||
// bool isStrongShortReject =
|
||||
// iBar.IsBearish() &&
|
||||
// isShortReject;
|
||||
// bool isPressuredShortReject =
|
||||
// isShortReject &&
|
||||
// hasFiboToDownPressure;
|
||||
// bool isPressuredStrongShortReject =
|
||||
// isStrongShortReject &&
|
||||
// isPressuredShortReject;
|
||||
|
||||
// //
|
||||
// double iLongRejectValue = 0;
|
||||
// double iShortRejectValue = 0;
|
||||
|
||||
// //
|
||||
// bool isAppliedLongReject = false;
|
||||
// bool isAppliedShortReject = false;
|
||||
// switch (rejectionType)
|
||||
// {
|
||||
// //
|
||||
// case XWZ_REJECTION_BAR:
|
||||
// isAppliedLongReject = isLongReject;
|
||||
// isAppliedShortReject = isShortReject;
|
||||
// break;
|
||||
|
||||
// //
|
||||
// case XWZ_REJECTION_STRONG_BAR:
|
||||
// isAppliedLongReject = isStrongLongReject;
|
||||
// isAppliedShortReject = isStrongShortReject;
|
||||
// break;
|
||||
|
||||
// //
|
||||
// case XWZ_REJECTION_PRESSURED_BAR:
|
||||
// isAppliedLongReject = isPressuredLongReject;
|
||||
// isAppliedShortReject = isPressuredShortReject;
|
||||
// break;
|
||||
|
||||
// //
|
||||
// case XWZ_REJECTION_STRONG_PRESSURED_BAR:
|
||||
// isAppliedLongReject = isPressuredStrongLongReject;
|
||||
// isAppliedShortReject = isPressuredStrongShortReject;
|
||||
// break;
|
||||
// }
|
||||
|
||||
// //
|
||||
// // Calculate Rejection Verification Values ...
|
||||
|
||||
// //
|
||||
// int iLLIDX = pBar
|
||||
// .FindLowestIndex(
|
||||
// rejectionVerificationLength,
|
||||
// MODE_LOW //
|
||||
// );
|
||||
// datetime iLLTime = iTime(
|
||||
// _Symbol,
|
||||
// _Period,
|
||||
// iLLIDX //
|
||||
// );
|
||||
// double iLL = iLow(
|
||||
// _Symbol,
|
||||
// _Period,
|
||||
// iLLIDX //
|
||||
// );
|
||||
|
||||
// //
|
||||
// int iHHIDX = pBar
|
||||
// .FindHighestIndex(
|
||||
// rejectionVerificationLength,
|
||||
// MODE_HIGH //
|
||||
// );
|
||||
// datetime iHHTime = iTime(
|
||||
// _Symbol,
|
||||
// _Period,
|
||||
// iHHIDX //
|
||||
// );
|
||||
// double iHH = iHigh(
|
||||
// _Symbol,
|
||||
// _Period,
|
||||
// iHHIDX //
|
||||
// );
|
||||
|
||||
// //
|
||||
// bool isLLBreaked = false;
|
||||
// bool isHHBreaked = false;
|
||||
// if (rejectionVerificationLength > 0)
|
||||
// {
|
||||
// //
|
||||
// for (int i = bar_index + 1; i < bar_index + rejectionVerificationLength; i++)
|
||||
// {
|
||||
// //
|
||||
// double iMaValue = maBuffer[i];
|
||||
|
||||
// //
|
||||
// XOHCL iBar;
|
||||
// bool isInited = iBar.Init(
|
||||
// _Symbol,
|
||||
// _Period,
|
||||
// i //
|
||||
// );
|
||||
// if (!isInited)
|
||||
// {
|
||||
// //
|
||||
// iBar.Clean();
|
||||
// isLLBreaked = true;
|
||||
// isHHBreaked = true;
|
||||
// break;
|
||||
// }
|
||||
|
||||
// //
|
||||
// if (!isLLBreaked)
|
||||
// {
|
||||
// isLLBreaked = iBar.low < iMaValue;
|
||||
// }
|
||||
|
||||
// //
|
||||
// if (!isHHBreaked)
|
||||
// {
|
||||
// isHHBreaked = iBar.high > iMaValue;
|
||||
// }
|
||||
|
||||
// //
|
||||
// if (isLLBreaked &&
|
||||
// isHHBreaked)
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// //
|
||||
// // Validate Rejections ...
|
||||
|
||||
// //
|
||||
// // -[] Before Reject Long, price
|
||||
// // must not touch Ma from Up for at least 3 Bar ...
|
||||
// bool isValidAppliedLongReject =
|
||||
// !isLLBreaked &&
|
||||
// isAppliedLongReject;
|
||||
|
||||
// //
|
||||
// // -[] Before Reject Short Price
|
||||
// // must no touch Ma from down at least 3 Bar ...
|
||||
// bool isValidAppliedShortReject =
|
||||
// !isHHBreaked &&
|
||||
// isAppliedShortReject;
|
||||
|
||||
// //
|
||||
// if (isValidAppliedLongReject)
|
||||
// {
|
||||
// iLongRejectValue = iBar.low - points10;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// iLongRejectValue = 0;
|
||||
// }
|
||||
|
||||
// //
|
||||
// if (isValidAppliedShortReject)
|
||||
// {
|
||||
// iShortRejectValue = iBar.high + points10;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// iShortRejectValue = 0;
|
||||
// }
|
||||
|
||||
// //
|
||||
// // Draw Verification Box ...
|
||||
// if (isValidAppliedLongReject ||
|
||||
// isValidAppliedShortReject)
|
||||
// {
|
||||
// //
|
||||
// datetime time1 = iTime(
|
||||
// _Symbol,
|
||||
// _Period,
|
||||
// iBar.Index() + rejectionVerificationLength //
|
||||
// );
|
||||
// datetime time2 = iTime(
|
||||
// _Symbol,
|
||||
// _Period,
|
||||
// iBar.Index() + 0 //
|
||||
// );
|
||||
// string llName = ToString(iLLIDX) + "_" +
|
||||
// ToString(iLL) + "_" +
|
||||
// ToMD5(iLLTime);
|
||||
// CChartObjectTrend *llTrend;
|
||||
// llTrend = new CChartObjectTrend();
|
||||
// bool isCreated = llTrend.Create(
|
||||
// 0,
|
||||
// llName,
|
||||
// 0,
|
||||
// time1,
|
||||
// iLL,
|
||||
// time2,
|
||||
// iLL //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// mXWZDrawnObjects.Add(llTrend);
|
||||
// }
|
||||
|
||||
// //
|
||||
// string hhName = ToString(iHHIDX) + "_" +
|
||||
// ToString(iHH) + "_" +
|
||||
// ToMD5(iHHTime);
|
||||
// CChartObjectTrend *hhTrend;
|
||||
// hhTrend = new CChartObjectTrend();
|
||||
// isCreated = hhTrend.Create(
|
||||
// 0,
|
||||
// hhName,
|
||||
// 0,
|
||||
// time1,
|
||||
// iHH,
|
||||
// time2,
|
||||
// iHH //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// mXWZDrawnObjects.Add(hhTrend);
|
||||
// }
|
||||
// }
|
||||
|
||||
// //
|
||||
// int idx = -1;
|
||||
// int count = 0;
|
||||
// bool has = false;
|
||||
|
||||
// //
|
||||
// ENUM_X_DIRECTION trend =
|
||||
// IsValid(lastBullishTrend) &&
|
||||
// lastBullishTrend > lastBearishTrend
|
||||
// ? X_DIRECTION_BULLISH
|
||||
// : IsValid(lastBearishTrend) &&
|
||||
// lastBearishTrend > lastBullishTrend
|
||||
// ? X_DIRECTION_BEARISH
|
||||
// : X_DIRECTION_NONE;
|
||||
// bool hasTrend = HasDirection(trend);
|
||||
// bool hasBullishTrend = hasTrend &&
|
||||
// IsBullish(trend);
|
||||
// bool hasBearishTrend = hasTrend &&
|
||||
// IsBearish(trend);
|
||||
|
||||
// //
|
||||
// // Filling Buffers ...
|
||||
|
||||
// //
|
||||
// longSLBuffer[bar_index] = iLongSL;
|
||||
// shortSLBuffer[bar_index] = iShortSL;
|
||||
|
||||
+1385
-435
File diff suppressed because it is too large
Load Diff
@@ -3726,7 +3726,8 @@ class XCResistanceZone : public XCBarZone
|
||||
*/
|
||||
bool Init(
|
||||
XOHCL &bar,
|
||||
int range = 0 //
|
||||
int range = 0,
|
||||
bool useRangeAsStart = false //
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -3761,7 +3762,10 @@ class XCResistanceZone : public XCBarZone
|
||||
int periodSeconds = PeriodSeconds(bar.period);
|
||||
|
||||
//
|
||||
datetime from = (datetime)((int)time - (range * periodSeconds));
|
||||
datetime from =
|
||||
!useRangeAsStart
|
||||
? (datetime)((int)time - (range * periodSeconds))
|
||||
: time;
|
||||
datetime to = (datetime)((int)time + (range * periodSeconds));
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user