187 lines
4.3 KiB
Plaintext
187 lines
4.3 KiB
Plaintext
// //
|
|
// // Detect At lease Two PEAK and Two Vale ...
|
|
// XZigZagPoint tmpPoints[];
|
|
// Copy(
|
|
// points,
|
|
// tmpPoints //
|
|
// );
|
|
|
|
// //
|
|
// // Detect Highs ...
|
|
|
|
// //
|
|
// // Highest High ...
|
|
|
|
// //
|
|
// XZigZagPoint iZGPeak1;
|
|
// XZigZagPoint iZGPeak2;
|
|
|
|
// //
|
|
// // First ...
|
|
// int idx = GetHighest(
|
|
// tmpPoints,
|
|
// X_ZIGZAG_POINT_TYPE_PEAK //
|
|
// );
|
|
// result = IsValidIndex(idx);
|
|
// if (!result)
|
|
// {
|
|
// //
|
|
// Clean();
|
|
// iZGPeak1.Clean();
|
|
// iZGPeak2.Clean();
|
|
// SpecifiedClean(tmpPoints);
|
|
|
|
// //
|
|
// return result;
|
|
// }
|
|
// iZGPeak1 = tmpPoints[idx];
|
|
// ArrayRemove(
|
|
// tmpPoints,
|
|
// idx,
|
|
// 1 //
|
|
// );
|
|
|
|
// //
|
|
// // Second ...
|
|
// idx = GetHighest(
|
|
// tmpPoints,
|
|
// X_ZIGZAG_POINT_TYPE_PEAK //
|
|
// );
|
|
// result = IsValidIndex(idx);
|
|
// if (!result)
|
|
// {
|
|
// //
|
|
// Clean();
|
|
// iZGPeak1.Clean();
|
|
// iZGPeak2.Clean();
|
|
// SpecifiedClean(tmpPoints);
|
|
|
|
// //
|
|
// return result;
|
|
// }
|
|
// iZGPeak2 = tmpPoints[idx];
|
|
// ArrayRemove(
|
|
// tmpPoints,
|
|
// idx,
|
|
// 1 //
|
|
// );
|
|
|
|
// //
|
|
// // Detect Lows ...
|
|
|
|
// //
|
|
// XZigZagPoint iZGVale1;
|
|
// XZigZagPoint iZGVale2;
|
|
|
|
// //
|
|
// // First ...
|
|
// idx = GetLowest(
|
|
// tmpPoints,
|
|
// X_ZIGZAG_POINT_TYPE_VALE //
|
|
// );
|
|
// result = IsValidIndex(idx);
|
|
// if (!result)
|
|
// {
|
|
// //
|
|
// Clean();
|
|
// iZGPeak1.Clean();
|
|
// iZGPeak2.Clean();
|
|
// iZGVale1.Clean();
|
|
// iZGVale2.Clean();
|
|
// SpecifiedClean(tmpPoints);
|
|
|
|
// //
|
|
// return result;
|
|
// }
|
|
// iZGVale1 = tmpPoints[idx];
|
|
// ArrayRemove(
|
|
// tmpPoints,
|
|
// idx,
|
|
// 1 //
|
|
// );
|
|
|
|
// //
|
|
// // Second ...
|
|
// idx = GetLowest(
|
|
// tmpPoints,
|
|
// X_ZIGZAG_POINT_TYPE_VALE //
|
|
// );
|
|
// result = IsValidIndex(idx);
|
|
// if (!result)
|
|
// {
|
|
// //
|
|
// Clean();
|
|
// iZGPeak1.Clean();
|
|
// iZGPeak2.Clean();
|
|
// iZGVale1.Clean();
|
|
// iZGVale2.Clean();
|
|
// SpecifiedClean(tmpPoints);
|
|
|
|
// //
|
|
// return result;
|
|
// }
|
|
// iZGVale2 = tmpPoints[idx];
|
|
// ArrayRemove(
|
|
// tmpPoints,
|
|
// idx,
|
|
// 1 //
|
|
// );
|
|
|
|
// //
|
|
// // Check Directions ...
|
|
// bool isBullish =
|
|
// //
|
|
// (iZGPeak1.time > iZGPeak2.time &&
|
|
// iZGVale1.time < iZGVale2.time)
|
|
// //
|
|
// ;
|
|
// bool isBearish =
|
|
// //
|
|
// (iZGPeak1.time < iZGPeak2.time &&
|
|
// iZGVale1.time > iZGVale2.time)
|
|
// //
|
|
// ;
|
|
// result =
|
|
// (isBullish && !isBearish) ||
|
|
// (isBearish && !isBullish);
|
|
// if (!result)
|
|
// {
|
|
// //
|
|
// Clean();
|
|
// iZGPeak1.Clean();
|
|
// iZGPeak2.Clean();
|
|
// iZGVale1.Clean();
|
|
// iZGVale2.Clean();
|
|
// SpecifiedClean(tmpPoints);
|
|
|
|
// //
|
|
// return result;
|
|
// }
|
|
|
|
// //
|
|
// // Setting Direction ...
|
|
// dir =
|
|
// isBullish
|
|
// ? X_DIRECTION_BULLISH
|
|
// : isBearish
|
|
// ? X_DIRECTION_BEARISH
|
|
// : X_DIRECTION_NONE;
|
|
|
|
// //
|
|
// // Setting Points ...
|
|
// Copy(
|
|
// points,
|
|
// pivots //
|
|
// );
|
|
|
|
|
|
|
|
|
|
//
|
|
// Cleanup Resources ...
|
|
// iZGPeak1.Clean();
|
|
// iZGPeak2.Clean();
|
|
// iZGVale1.Clean();
|
|
// iZGVale2.Clean();
|
|
// SpecifiedClean(tmpPoints);
|