Add Support for atr in x121 indicator ...
This commit is contained in:
+490
-197
@@ -33,47 +33,50 @@ enum ENUM_X121_BUFFERS
|
|||||||
X121_PEAKS_LINE = 0,
|
X121_PEAKS_LINE = 0,
|
||||||
X121_VALES_LINE = 1,
|
X121_VALES_LINE = 1,
|
||||||
X121_SAR_LINE = 2,
|
X121_SAR_LINE = 2,
|
||||||
X121_VWAP_FAST_LINE = 3,
|
X121_ATR_UPPER_LINE = 3,
|
||||||
X121_VWAP_MID_LINE = 5,
|
X121_ATR_LOWER_LINE = 4,
|
||||||
X121_VWAP_SLOW_LINE = 7,
|
X121_VWAP_FAST_LINE = 5,
|
||||||
X121_DON_OPEN_UPPER_LINE = 9,
|
X121_VWAP_MID_LINE = 7,
|
||||||
X121_DON_OPEN_LOWER_LINE = 10,
|
X121_VWAP_SLOW_LINE = 9,
|
||||||
X121_DON_HIGH_UPPER_LINE = 11,
|
X121_DON_OPEN_UPPER_LINE = 11,
|
||||||
X121_DON_HIGH_LOWER_LINE = 12,
|
X121_DON_OPEN_LOWER_LINE = 12,
|
||||||
X121_DON_LOW_UPPER_LINE = 13,
|
X121_DON_HIGH_UPPER_LINE = 13,
|
||||||
X121_DON_LOW_LOWER_LINE = 14,
|
X121_DON_HIGH_LOWER_LINE = 14,
|
||||||
X121_DON_CLOSE_UPPER_LINE = 15,
|
X121_DON_LOW_UPPER_LINE = 15,
|
||||||
X121_DON_CLOSE_LOWER_LINE = 16,
|
X121_DON_LOW_LOWER_LINE = 16,
|
||||||
X121_FIB_LEVEL_1_LINE = 17,
|
X121_DON_CLOSE_UPPER_LINE = 17,
|
||||||
X121_FIB_LEVEL_2_LINE = 18,
|
X121_DON_CLOSE_LOWER_LINE = 18,
|
||||||
X121_FIB_LEVEL_3_LINE = 19,
|
X121_FIB_LEVEL_1_LINE = 19,
|
||||||
X121_FIB_LEVEL_4_LINE = 20,
|
X121_FIB_LEVEL_2_LINE = 20,
|
||||||
X121_FIB_LEVEL_5_LINE = 21,
|
X121_FIB_LEVEL_3_LINE = 21,
|
||||||
|
X121_FIB_LEVEL_4_LINE = 22,
|
||||||
|
X121_FIB_LEVEL_5_LINE = 23,
|
||||||
//
|
//
|
||||||
// Data Buffers ...
|
// Data Buffers ...
|
||||||
//
|
//
|
||||||
// XPV Data ...
|
// XPV Data ...
|
||||||
X121_CURRENT_HH_LINE = 22,
|
X121_CURRENT_HH_LINE = 24,
|
||||||
X121_CURRENT_LL_LINE = 23,
|
X121_CURRENT_LL_LINE = 25,
|
||||||
X121_SHORT_HH_LINE = 24,
|
X121_SHORT_HH_LINE = 26,
|
||||||
X121_SHORT_LL_LINE = 25,
|
X121_SHORT_LL_LINE = 27,
|
||||||
X121_MEDIUM_HH_LINE = 26,
|
X121_MEDIUM_HH_LINE = 28,
|
||||||
X121_MEDIUM_LL_LINE = 27,
|
X121_MEDIUM_LL_LINE = 29,
|
||||||
X121_LONG_HH_LINE = 28,
|
X121_LONG_HH_LINE = 30,
|
||||||
X121_LONG_LL_LINE = 29,
|
X121_LONG_LL_LINE = 31,
|
||||||
X121_HIND_HH_LINE = 30,
|
X121_HIND_HH_LINE = 32,
|
||||||
X121_HIND_LL_LINE = 31,
|
X121_HIND_LL_LINE = 33,
|
||||||
//
|
//
|
||||||
// VWAP Data ...
|
// VWAP Data ...
|
||||||
X121_VWAP_VOLUME_LINE = 32,
|
X121_VWAP_VOLUME_LINE = 34,
|
||||||
X121_VWAP_PRICE_LINE = 33,
|
X121_VWAP_PRICE_LINE = 35,
|
||||||
X121_VWAP_FAST_STATE_LINE = 34,
|
X121_VWAP_FAST_STATE_LINE = 36,
|
||||||
X121_VWAP_MID_STATE_LINE = 35,
|
X121_VWAP_MID_STATE_LINE = 37,
|
||||||
X121_VWAP_SLOW_STATE_LINE = 36,
|
X121_VWAP_SLOW_STATE_LINE = 38,
|
||||||
//
|
//
|
||||||
// VALID PEAKS and VALES ...
|
// ATR ...
|
||||||
X121_VALID_PEAKS_LINE = 37,
|
X121_ATR_LINE = 39,
|
||||||
X121_VALID_VALES_LINE = 38,
|
X121_ATR_UPPER_RAW_LINE = 40,
|
||||||
|
X121_ATR_LOWER_RAW_LINE = 41,
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -121,10 +124,18 @@ struct X121Inputs
|
|||||||
ENUM_SERIESMODE llMode; // Lowest Low Calculation Method
|
ENUM_SERIESMODE llMode; // Lowest Low Calculation Method
|
||||||
|
|
||||||
//
|
//
|
||||||
// Paraboli Sar Detection ...
|
// Parabolic Sar Detection ...
|
||||||
double sarStep; // Step
|
double sarStep; // Step
|
||||||
double sarMax; // Maximum
|
double sarMax; // Maximum
|
||||||
|
|
||||||
|
//
|
||||||
|
// Atr Detection ...
|
||||||
|
int atrLength; // Length
|
||||||
|
double atrMultiplier; // Multiplier
|
||||||
|
ENUM_APPLIED_PRICE atrUpperAppliedTo; // Upper Zone Applied To
|
||||||
|
ENUM_APPLIED_PRICE atrLowerAppliedTo; // Lower Zone Applied To
|
||||||
|
ENUM_X_MA_METHOD atrSmoothingMode; // Smoothing Method
|
||||||
|
|
||||||
//
|
//
|
||||||
// VWap Detection ...
|
// VWap Detection ...
|
||||||
int vwapFastLength; // Fast Length
|
int vwapFastLength; // Fast Length
|
||||||
@@ -158,6 +169,7 @@ struct X121Inputs
|
|||||||
//
|
//
|
||||||
// Global ...
|
// Global ...
|
||||||
bool showSar; // Show Parabolic Sar
|
bool showSar; // Show Parabolic Sar
|
||||||
|
bool showAtr; // Show Atr
|
||||||
bool showPeaks; // Show Peaks
|
bool showPeaks; // Show Peaks
|
||||||
bool showVales; // Show Vales
|
bool showVales; // Show Vales
|
||||||
bool showVWap; // Show VWap
|
bool showVWap; // Show VWap
|
||||||
@@ -171,6 +183,11 @@ struct X121Inputs
|
|||||||
bool showFibo4Levels; // Show Fibo 4th Level
|
bool showFibo4Levels; // Show Fibo 4th Level
|
||||||
bool showFibo5Levels; // Show Fibo 5th Level
|
bool showFibo5Levels; // Show Fibo 5th Level
|
||||||
|
|
||||||
|
//
|
||||||
|
// Atr Presentation ...
|
||||||
|
bool showAtrUpper; // Show Upper Zone
|
||||||
|
bool showAtrLower; // Show Lower Zone
|
||||||
|
|
||||||
//
|
//
|
||||||
// VWap Presentation ...
|
// VWap Presentation ...
|
||||||
bool showVWapFast; // Show VWap Fast
|
bool showVWapFast; // Show VWap Fast
|
||||||
@@ -238,6 +255,14 @@ struct X121Inputs
|
|||||||
sarStep = 0;
|
sarStep = 0;
|
||||||
sarMax = 0;
|
sarMax = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Atr Detection ...
|
||||||
|
atrLength = 0; // Length
|
||||||
|
atrMultiplier = 0; // Multiplier
|
||||||
|
atrUpperAppliedTo = PRICE_HIGH; // Upper Zone Applied To
|
||||||
|
atrLowerAppliedTo = PRICE_LOW; // Lower Zone Applied To
|
||||||
|
atrSmoothingMode = X_MA_MODE_NONE; // Smoothing Method
|
||||||
|
|
||||||
//
|
//
|
||||||
// VWap Detection ...
|
// VWap Detection ...
|
||||||
vwapFastLength = 0;
|
vwapFastLength = 0;
|
||||||
@@ -271,6 +296,7 @@ struct X121Inputs
|
|||||||
//
|
//
|
||||||
// Globals ...
|
// Globals ...
|
||||||
showSar = false;
|
showSar = false;
|
||||||
|
showAtr = false;
|
||||||
showPeaks = false;
|
showPeaks = false;
|
||||||
showVales = false;
|
showVales = false;
|
||||||
showVWap = false;
|
showVWap = false;
|
||||||
@@ -284,6 +310,11 @@ struct X121Inputs
|
|||||||
showFibo4Levels = false;
|
showFibo4Levels = false;
|
||||||
showFibo5Levels = false;
|
showFibo5Levels = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Atr Presentation ...
|
||||||
|
showAtrUpper = false; // Show Upper Zone
|
||||||
|
showAtrLower = false; // Show Lower Zone
|
||||||
|
|
||||||
//
|
//
|
||||||
// VWap Presentation ...
|
// VWap Presentation ...
|
||||||
showVWapFast = false;
|
showVWapFast = false;
|
||||||
@@ -342,6 +373,14 @@ struct X121Inputs
|
|||||||
sarStep = 0.02;
|
sarStep = 0.02;
|
||||||
sarMax = 0.2;
|
sarMax = 0.2;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Atr Detection ...
|
||||||
|
atrLength = 14; // Length
|
||||||
|
atrMultiplier = 1; // Multiplier
|
||||||
|
atrUpperAppliedTo = PRICE_HIGH; // Upper Zone Applied To
|
||||||
|
atrLowerAppliedTo = PRICE_LOW; // Lower Zone Applied To
|
||||||
|
atrSmoothingMode = X_MA_MODE_EMA; // Smoothing Method
|
||||||
|
|
||||||
//
|
//
|
||||||
// VWap Detection ...
|
// VWap Detection ...
|
||||||
vwapFastLength = 20;
|
vwapFastLength = 20;
|
||||||
@@ -375,6 +414,7 @@ struct X121Inputs
|
|||||||
//
|
//
|
||||||
// Globals ...
|
// Globals ...
|
||||||
showSar = true;
|
showSar = true;
|
||||||
|
showAtr = true;
|
||||||
showPeaks = true;
|
showPeaks = true;
|
||||||
showVales = true;
|
showVales = true;
|
||||||
showVWap = true;
|
showVWap = true;
|
||||||
@@ -388,6 +428,11 @@ struct X121Inputs
|
|||||||
showFibo4Levels = false;
|
showFibo4Levels = false;
|
||||||
showFibo5Levels = false;
|
showFibo5Levels = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Atr Presentation ...
|
||||||
|
showAtrUpper = true; // Show Upper Zone
|
||||||
|
showAtrLower = true; // Show Lower Zone
|
||||||
|
|
||||||
//
|
//
|
||||||
// VWap Presentation ...
|
// VWap Presentation ...
|
||||||
showVWapFast = true;
|
showVWapFast = true;
|
||||||
@@ -426,6 +471,10 @@ struct X121Inputs
|
|||||||
sarStep > 0 &&
|
sarStep > 0 &&
|
||||||
sarMax > sarStep &&
|
sarMax > sarStep &&
|
||||||
//
|
//
|
||||||
|
// ATR ...
|
||||||
|
atrLength > 0 &&
|
||||||
|
atrMultiplier > 0 &&
|
||||||
|
//
|
||||||
// XDON ...
|
// XDON ...
|
||||||
donchainLength > 0 &&
|
donchainLength > 0 &&
|
||||||
//
|
//
|
||||||
@@ -457,10 +506,14 @@ struct X121Inputs
|
|||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XVWAP ...
|
// VWAP ...
|
||||||
|
result = MathMax(result, vwapFastLength);
|
||||||
result = MathMax(result, vwapFastLength);
|
result = MathMax(result, vwapFastLength);
|
||||||
result = MathMax(result, vwapMidLength);
|
result = MathMax(result, vwapMidLength);
|
||||||
result = MathMax(result, vwapSlowLength);
|
|
||||||
|
//
|
||||||
|
// ATR ...
|
||||||
|
result = MathMax(result, atrLength);
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -482,6 +535,8 @@ struct X121Conditions
|
|||||||
double peaksBuffer[];
|
double peaksBuffer[];
|
||||||
double valesBuffer[];
|
double valesBuffer[];
|
||||||
double sarBuffer[];
|
double sarBuffer[];
|
||||||
|
double atrUpperBuffer[];
|
||||||
|
double atrLowerBuffer[];
|
||||||
double vwapFastBuffer[];
|
double vwapFastBuffer[];
|
||||||
double vwapMidBuffer[];
|
double vwapMidBuffer[];
|
||||||
double vwapSlowBuffer[];
|
double vwapSlowBuffer[];
|
||||||
@@ -508,6 +563,9 @@ struct X121Conditions
|
|||||||
double lLLBuffer[];
|
double lLLBuffer[];
|
||||||
double hHHBuffer[];
|
double hHHBuffer[];
|
||||||
double hLLBuffer[];
|
double hLLBuffer[];
|
||||||
|
double atrBuffer[];
|
||||||
|
double atrUpperRawBuffer[];
|
||||||
|
double atrLowerRawBuffer[];
|
||||||
double vwapVolumeBuffer[];
|
double vwapVolumeBuffer[];
|
||||||
double vwapPriceBuffer[];
|
double vwapPriceBuffer[];
|
||||||
double vwapFastStateBuffer[];
|
double vwapFastStateBuffer[];
|
||||||
@@ -652,6 +710,8 @@ struct X121Conditions
|
|||||||
Clean(peaksBuffer);
|
Clean(peaksBuffer);
|
||||||
Clean(valesBuffer);
|
Clean(valesBuffer);
|
||||||
Clean(sarBuffer);
|
Clean(sarBuffer);
|
||||||
|
Clean(atrUpperBuffer);
|
||||||
|
Clean(atrLowerBuffer);
|
||||||
Clean(vwapFastBuffer);
|
Clean(vwapFastBuffer);
|
||||||
Clean(vwapMidBuffer);
|
Clean(vwapMidBuffer);
|
||||||
Clean(vwapSlowBuffer);
|
Clean(vwapSlowBuffer);
|
||||||
@@ -678,6 +738,9 @@ struct X121Conditions
|
|||||||
Clean(lLLBuffer);
|
Clean(lLLBuffer);
|
||||||
Clean(hHHBuffer);
|
Clean(hHHBuffer);
|
||||||
Clean(hLLBuffer);
|
Clean(hLLBuffer);
|
||||||
|
Clean(atrBuffer);
|
||||||
|
Clean(atrUpperRawBuffer);
|
||||||
|
Clean(atrLowerRawBuffer);
|
||||||
Clean(vwapVolumeBuffer);
|
Clean(vwapVolumeBuffer);
|
||||||
Clean(vwapPriceBuffer);
|
Clean(vwapPriceBuffer);
|
||||||
Clean(vwapFastStateBuffer);
|
Clean(vwapFastStateBuffer);
|
||||||
@@ -690,6 +753,8 @@ struct X121Conditions
|
|||||||
ArraySetAsSeries(peaksBuffer, true);
|
ArraySetAsSeries(peaksBuffer, true);
|
||||||
ArraySetAsSeries(valesBuffer, true);
|
ArraySetAsSeries(valesBuffer, true);
|
||||||
ArraySetAsSeries(sarBuffer, true);
|
ArraySetAsSeries(sarBuffer, true);
|
||||||
|
ArraySetAsSeries(atrUpperBuffer, true);
|
||||||
|
ArraySetAsSeries(atrLowerBuffer, true);
|
||||||
ArraySetAsSeries(vwapFastBuffer, true);
|
ArraySetAsSeries(vwapFastBuffer, true);
|
||||||
ArraySetAsSeries(vwapMidBuffer, true);
|
ArraySetAsSeries(vwapMidBuffer, true);
|
||||||
ArraySetAsSeries(vwapSlowBuffer, true);
|
ArraySetAsSeries(vwapSlowBuffer, true);
|
||||||
@@ -716,6 +781,9 @@ struct X121Conditions
|
|||||||
ArraySetAsSeries(lLLBuffer, true);
|
ArraySetAsSeries(lLLBuffer, true);
|
||||||
ArraySetAsSeries(hHHBuffer, true);
|
ArraySetAsSeries(hHHBuffer, true);
|
||||||
ArraySetAsSeries(hLLBuffer, true);
|
ArraySetAsSeries(hLLBuffer, true);
|
||||||
|
ArraySetAsSeries(atrBuffer, true);
|
||||||
|
ArraySetAsSeries(atrUpperRawBuffer, true);
|
||||||
|
ArraySetAsSeries(atrLowerRawBuffer, true);
|
||||||
ArraySetAsSeries(vwapVolumeBuffer, true);
|
ArraySetAsSeries(vwapVolumeBuffer, true);
|
||||||
ArraySetAsSeries(vwapPriceBuffer, true);
|
ArraySetAsSeries(vwapPriceBuffer, true);
|
||||||
ArraySetAsSeries(vwapFastStateBuffer, true);
|
ArraySetAsSeries(vwapFastStateBuffer, true);
|
||||||
@@ -1064,6 +1132,8 @@ class XCX121Helper : public XCBaseHelper
|
|||||||
ArraySetAsSeries(peaksBuffer, true);
|
ArraySetAsSeries(peaksBuffer, true);
|
||||||
ArraySetAsSeries(valesBuffer, true);
|
ArraySetAsSeries(valesBuffer, true);
|
||||||
ArraySetAsSeries(sarBuffer, true);
|
ArraySetAsSeries(sarBuffer, true);
|
||||||
|
ArraySetAsSeries(atrUpperBuffer, true);
|
||||||
|
ArraySetAsSeries(atrLowerBuffer, true);
|
||||||
ArraySetAsSeries(vwapFastBuffer, true);
|
ArraySetAsSeries(vwapFastBuffer, true);
|
||||||
ArraySetAsSeries(vwapMidBuffer, true);
|
ArraySetAsSeries(vwapMidBuffer, true);
|
||||||
ArraySetAsSeries(vwapSlowBuffer, true);
|
ArraySetAsSeries(vwapSlowBuffer, true);
|
||||||
@@ -1090,13 +1160,14 @@ class XCX121Helper : public XCBaseHelper
|
|||||||
ArraySetAsSeries(lLLBuffer, true);
|
ArraySetAsSeries(lLLBuffer, true);
|
||||||
ArraySetAsSeries(hHHBuffer, true);
|
ArraySetAsSeries(hHHBuffer, true);
|
||||||
ArraySetAsSeries(hLLBuffer, true);
|
ArraySetAsSeries(hLLBuffer, true);
|
||||||
|
ArraySetAsSeries(atrBuffer, true);
|
||||||
|
ArraySetAsSeries(atrUpperRawBuffer, true);
|
||||||
|
ArraySetAsSeries(atrLowerRawBuffer, true);
|
||||||
ArraySetAsSeries(vwapVolumeBuffer, true);
|
ArraySetAsSeries(vwapVolumeBuffer, true);
|
||||||
ArraySetAsSeries(vwapPriceBuffer, true);
|
ArraySetAsSeries(vwapPriceBuffer, true);
|
||||||
ArraySetAsSeries(vwapFastStateBuffer, true);
|
ArraySetAsSeries(vwapFastStateBuffer, true);
|
||||||
ArraySetAsSeries(vwapMidStateBuffer, true);
|
ArraySetAsSeries(vwapMidStateBuffer, true);
|
||||||
ArraySetAsSeries(vwapSlowStateBuffer, true);
|
ArraySetAsSeries(vwapSlowStateBuffer, true);
|
||||||
ArraySetAsSeries(validPeaksBuffer, true);
|
|
||||||
ArraySetAsSeries(validValesBuffer, true);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
mHandler = iCustom(
|
mHandler = iCustom(
|
||||||
@@ -1134,11 +1205,19 @@ class XCX121Helper : public XCBaseHelper
|
|||||||
mInputs.hhMode,
|
mInputs.hhMode,
|
||||||
mInputs.llMode,
|
mInputs.llMode,
|
||||||
//
|
//
|
||||||
// Paraboli Sar Detection ...
|
// Parabolic Sar Detection ...
|
||||||
"",
|
"",
|
||||||
mInputs.sarStep,
|
mInputs.sarStep,
|
||||||
mInputs.sarMax,
|
mInputs.sarMax,
|
||||||
//
|
//
|
||||||
|
// Atr Detection ...
|
||||||
|
"",
|
||||||
|
mInputs.atrLength,
|
||||||
|
mInputs.atrMultiplier,
|
||||||
|
mInputs.atrUpperAppliedTo,
|
||||||
|
mInputs.atrLowerAppliedTo,
|
||||||
|
mInputs.atrSmoothingMode,
|
||||||
|
//
|
||||||
// VWap Detection ...
|
// VWap Detection ...
|
||||||
"",
|
"",
|
||||||
mInputs.vwapFastLength,
|
mInputs.vwapFastLength,
|
||||||
@@ -1150,23 +1229,13 @@ class XCX121Helper : public XCBaseHelper
|
|||||||
"",
|
"",
|
||||||
mInputs.donchainLength,
|
mInputs.donchainLength,
|
||||||
//
|
//
|
||||||
// Fibonacci ...
|
|
||||||
"",
|
|
||||||
mInputs.fiboLevel1,
|
|
||||||
mInputs.fiboLevel2,
|
|
||||||
mInputs.fiboLevel3,
|
|
||||||
mInputs.fiboLevel4,
|
|
||||||
mInputs.fiboLevel5,
|
|
||||||
//
|
|
||||||
// Presentation ...
|
// Presentation ...
|
||||||
"",
|
"",
|
||||||
mInputs.startCalculationForLastBars,
|
mInputs.startCalculationForLastBars,
|
||||||
mInputs.sarArrowCode,
|
|
||||||
mInputs.peaksArrowCode,
|
|
||||||
mInputs.valesArrowCode,
|
|
||||||
//
|
//
|
||||||
// Commons ...
|
// Commons ...
|
||||||
mInputs.showSar,
|
mInputs.showSar,
|
||||||
|
mInputs.showAtr,
|
||||||
mInputs.showPeaks,
|
mInputs.showPeaks,
|
||||||
mInputs.showVales,
|
mInputs.showVales,
|
||||||
mInputs.showVWap,
|
mInputs.showVWap,
|
||||||
@@ -1180,6 +1249,11 @@ class XCX121Helper : public XCBaseHelper
|
|||||||
mInputs.showFibo4Levels,
|
mInputs.showFibo4Levels,
|
||||||
mInputs.showFibo5Levels,
|
mInputs.showFibo5Levels,
|
||||||
//
|
//
|
||||||
|
// Atr Presentation ...
|
||||||
|
"",
|
||||||
|
mInputs.showAtrUpper,
|
||||||
|
mInputs.showAtrLower,
|
||||||
|
//
|
||||||
// VWap Presentation ...
|
// VWap Presentation ...
|
||||||
"",
|
"",
|
||||||
mInputs.showVWapFast,
|
mInputs.showVWapFast,
|
||||||
@@ -1195,6 +1269,20 @@ class XCX121Helper : public XCBaseHelper
|
|||||||
mInputs.showClose,
|
mInputs.showClose,
|
||||||
mInputs.showLow
|
mInputs.showLow
|
||||||
//
|
//
|
||||||
|
// Non Important Inpust ...
|
||||||
|
//
|
||||||
|
// Fibonacci ...
|
||||||
|
// "",
|
||||||
|
// mInputs.fiboLevel1,
|
||||||
|
// mInputs.fiboLevel2,
|
||||||
|
// mInputs.fiboLevel3,
|
||||||
|
// mInputs.fiboLevel4,
|
||||||
|
// mInputs.fiboLevel5,
|
||||||
|
// //
|
||||||
|
// mInputs.sarArrowCode,
|
||||||
|
// mInputs.peaksArrowCode,
|
||||||
|
// mInputs.valesArrowCode
|
||||||
|
//
|
||||||
);
|
);
|
||||||
result = mHandler != INVALID_HANDLE;
|
result = mHandler != INVALID_HANDLE;
|
||||||
if (!result)
|
if (!result)
|
||||||
@@ -1235,13 +1323,14 @@ class XCX121Helper : public XCBaseHelper
|
|||||||
//
|
//
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve DON Chain Length ...
|
* Retrieve DON Chain Length ...
|
||||||
*
|
*
|
||||||
* @return ( int )
|
* @return ( int )
|
||||||
*/
|
*/
|
||||||
int GetDonChainLength() {
|
int GetDonChainLength()
|
||||||
|
{
|
||||||
return mInputs.donchainLength;
|
return mInputs.donchainLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1249,7 +1338,7 @@ class XCX121Helper : public XCBaseHelper
|
|||||||
// Implement Value Getters ...
|
// Implement Value Getters ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// XSAR ...
|
// SAR ...
|
||||||
|
|
||||||
//
|
//
|
||||||
double GetSar(
|
double GetSar(
|
||||||
@@ -1301,7 +1390,258 @@ class XCX121Helper : public XCBaseHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// XPV ...
|
// ATR ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Common ...
|
||||||
|
|
||||||
|
//
|
||||||
|
double GetAtr(
|
||||||
|
int barIndex // Bar Index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (barIndex < 0)
|
||||||
|
{
|
||||||
|
barIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Calculate();
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(atrBuffer);
|
||||||
|
if (barIndex >= count)
|
||||||
|
{
|
||||||
|
barIndex = count - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return atrBuffer[barIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int CopyAtr(
|
||||||
|
int start, // Start
|
||||||
|
int count, // Number of Items for read
|
||||||
|
double &buffer[], // Dest Buffer
|
||||||
|
bool forceClean = true // Force To Clean buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Update Calculations ...
|
||||||
|
Calculate();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Copy Items ...
|
||||||
|
return Copy(
|
||||||
|
start,
|
||||||
|
count,
|
||||||
|
atrBuffer,
|
||||||
|
buffer,
|
||||||
|
forceClean
|
||||||
|
//
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double GetAtrUpper(
|
||||||
|
int barIndex // Bar Index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (barIndex < 0)
|
||||||
|
{
|
||||||
|
barIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Calculate();
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(atrUpperBuffer);
|
||||||
|
if (barIndex >= count)
|
||||||
|
{
|
||||||
|
barIndex = count - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return atrUpperBuffer[barIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int CopyAtrUpper(
|
||||||
|
int start, // Start
|
||||||
|
int count, // Number of Items for read
|
||||||
|
double &buffer[], // Dest Buffer
|
||||||
|
bool forceClean = true // Force To Clean buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Update Calculations ...
|
||||||
|
Calculate();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Copy Items ...
|
||||||
|
return Copy(
|
||||||
|
start,
|
||||||
|
count,
|
||||||
|
atrUpperBuffer,
|
||||||
|
buffer,
|
||||||
|
forceClean
|
||||||
|
//
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double GetAtrUpperRaw(
|
||||||
|
int barIndex // Bar Index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (barIndex < 0)
|
||||||
|
{
|
||||||
|
barIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Calculate();
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(atrUpperRawBuffer);
|
||||||
|
if (barIndex >= count)
|
||||||
|
{
|
||||||
|
barIndex = count - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return atrUpperRawBuffer[barIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int CopyAtrUpperRaw(
|
||||||
|
int start, // Start
|
||||||
|
int count, // Number of Items for read
|
||||||
|
double &buffer[], // Dest Buffer
|
||||||
|
bool forceClean = true // Force To Clean buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Update Calculations ...
|
||||||
|
Calculate();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Copy Items ...
|
||||||
|
return Copy(
|
||||||
|
start,
|
||||||
|
count,
|
||||||
|
atrUpperRawBuffer,
|
||||||
|
buffer,
|
||||||
|
forceClean
|
||||||
|
//
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double GetAtrLower(
|
||||||
|
int barIndex // Bar Index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (barIndex < 0)
|
||||||
|
{
|
||||||
|
barIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Calculate();
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(atrLowerBuffer);
|
||||||
|
if (barIndex >= count)
|
||||||
|
{
|
||||||
|
barIndex = count - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return atrLowerBuffer[barIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int CopyAtrLower(
|
||||||
|
int start, // Start
|
||||||
|
int count, // Number of Items for read
|
||||||
|
double &buffer[], // Dest Buffer
|
||||||
|
bool forceClean = true // Force To Clean buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Update Calculations ...
|
||||||
|
Calculate();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Copy Items ...
|
||||||
|
return Copy(
|
||||||
|
start,
|
||||||
|
count,
|
||||||
|
atrLowerBuffer,
|
||||||
|
buffer,
|
||||||
|
forceClean
|
||||||
|
//
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double GetAtrLowerRaw(
|
||||||
|
int barIndex // Bar Index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (barIndex < 0)
|
||||||
|
{
|
||||||
|
barIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Calculate();
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(atrLowerRawBuffer);
|
||||||
|
if (barIndex >= count)
|
||||||
|
{
|
||||||
|
barIndex = count - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return atrLowerRawBuffer[barIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int CopyAtrLowerRaw(
|
||||||
|
int start, // Start
|
||||||
|
int count, // Number of Items for read
|
||||||
|
double &buffer[], // Dest Buffer
|
||||||
|
bool forceClean = true // Force To Clean buffer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Update Calculations ...
|
||||||
|
Calculate();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Copy Items ...
|
||||||
|
return Copy(
|
||||||
|
start,
|
||||||
|
count,
|
||||||
|
atrLowerRawBuffer,
|
||||||
|
buffer,
|
||||||
|
forceClean
|
||||||
|
//
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// PV ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// PEAKS ...
|
// PEAKS ...
|
||||||
@@ -1943,111 +2283,7 @@ class XCX121Helper : public XCBaseHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// VALID PEAKS ...
|
// VWAP ...
|
||||||
|
|
||||||
//
|
|
||||||
double GetValidPeak(
|
|
||||||
int barIndex // Bar Index
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (barIndex < 0)
|
|
||||||
{
|
|
||||||
barIndex = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
Calculate();
|
|
||||||
|
|
||||||
//
|
|
||||||
int count = ArraySize(validPeaksBuffer);
|
|
||||||
if (barIndex >= count)
|
|
||||||
{
|
|
||||||
barIndex = count - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return validPeaksBuffer[barIndex];
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int CopyValidPeak(
|
|
||||||
int start, // Start
|
|
||||||
int count, // Number of Items for read
|
|
||||||
double &buffer[], // Dest Buffer
|
|
||||||
bool forceClean = true // Force To Clean buffer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Update Calculations ...
|
|
||||||
Calculate();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Copy Items ...
|
|
||||||
return Copy(
|
|
||||||
start,
|
|
||||||
count,
|
|
||||||
validPeaksBuffer,
|
|
||||||
buffer,
|
|
||||||
forceClean
|
|
||||||
//
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// VALID VALES ...
|
|
||||||
|
|
||||||
//
|
|
||||||
double GetValidVale(
|
|
||||||
int barIndex // Bar Index
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (barIndex < 0)
|
|
||||||
{
|
|
||||||
barIndex = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
Calculate();
|
|
||||||
|
|
||||||
//
|
|
||||||
int count = ArraySize(validValesBuffer);
|
|
||||||
if (barIndex >= count)
|
|
||||||
{
|
|
||||||
barIndex = count - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return validValesBuffer[barIndex];
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int CopyValidVale(
|
|
||||||
int start, // Start
|
|
||||||
int count, // Number of Items for read
|
|
||||||
double &buffer[], // Dest Buffer
|
|
||||||
bool forceClean = true // Force To Clean buffer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Update Calculations ...
|
|
||||||
Calculate();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Copy Items ...
|
|
||||||
return Copy(
|
|
||||||
start,
|
|
||||||
count,
|
|
||||||
validValesBuffer,
|
|
||||||
buffer,
|
|
||||||
forceClean
|
|
||||||
//
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// XVWAP ...
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// FAST ...
|
// FAST ...
|
||||||
@@ -3292,6 +3528,41 @@ class XCX121Helper : public XCBaseHelper
|
|||||||
conditions.sarBuffer //
|
conditions.sarBuffer //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CopyAtr(
|
||||||
|
zIndex,
|
||||||
|
loopback,
|
||||||
|
conditions.atrBuffer //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CopyAtrUpper(
|
||||||
|
zIndex,
|
||||||
|
loopback,
|
||||||
|
conditions.atrUpperBuffer //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CopyAtrUpperRaw(
|
||||||
|
zIndex,
|
||||||
|
loopback,
|
||||||
|
conditions.atrUpperRawBuffer //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CopyAtrLower(
|
||||||
|
zIndex,
|
||||||
|
loopback,
|
||||||
|
conditions.atrLowerBuffer //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CopyAtrLowerRaw(
|
||||||
|
zIndex,
|
||||||
|
loopback,
|
||||||
|
conditions.atrLowerRawBuffer //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
CopyPeak(
|
CopyPeak(
|
||||||
zIndex,
|
zIndex,
|
||||||
@@ -3376,20 +3647,6 @@ class XCX121Helper : public XCBaseHelper
|
|||||||
conditions.hLLBuffer //
|
conditions.hLLBuffer //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
CopyValidPeak(
|
|
||||||
zIndex,
|
|
||||||
loopback,
|
|
||||||
conditions.validPeaksBuffer //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CopyValidVale(
|
|
||||||
zIndex,
|
|
||||||
loopback,
|
|
||||||
conditions.validValesBuffer //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
CopyVWapFast(
|
CopyVWapFast(
|
||||||
zIndex,
|
zIndex,
|
||||||
@@ -3797,6 +4054,8 @@ class XCX121Helper : public XCBaseHelper
|
|||||||
double peaksBuffer[];
|
double peaksBuffer[];
|
||||||
double valesBuffer[];
|
double valesBuffer[];
|
||||||
double sarBuffer[];
|
double sarBuffer[];
|
||||||
|
double atrUpperBuffer[];
|
||||||
|
double atrLowerBuffer[];
|
||||||
double vwapFastBuffer[];
|
double vwapFastBuffer[];
|
||||||
double vwapMidBuffer[];
|
double vwapMidBuffer[];
|
||||||
double vwapSlowBuffer[];
|
double vwapSlowBuffer[];
|
||||||
@@ -3823,6 +4082,9 @@ class XCX121Helper : public XCBaseHelper
|
|||||||
double lLLBuffer[];
|
double lLLBuffer[];
|
||||||
double hHHBuffer[];
|
double hHHBuffer[];
|
||||||
double hLLBuffer[];
|
double hLLBuffer[];
|
||||||
|
double atrBuffer[];
|
||||||
|
double atrUpperRawBuffer[];
|
||||||
|
double atrLowerRawBuffer[];
|
||||||
double vwapVolumeBuffer[];
|
double vwapVolumeBuffer[];
|
||||||
double vwapPriceBuffer[];
|
double vwapPriceBuffer[];
|
||||||
double vwapFastStateBuffer[];
|
double vwapFastStateBuffer[];
|
||||||
@@ -3860,6 +4122,59 @@ class XCX121Helper : public XCBaseHelper
|
|||||||
//
|
//
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// ATR ...
|
||||||
|
|
||||||
|
//
|
||||||
|
CopyBuffer(
|
||||||
|
mHandler,
|
||||||
|
X121_ATR_UPPER_LINE,
|
||||||
|
0,
|
||||||
|
totalBars,
|
||||||
|
atrUpperBuffer
|
||||||
|
//
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CopyBuffer(
|
||||||
|
mHandler,
|
||||||
|
X121_ATR_LOWER_LINE,
|
||||||
|
0,
|
||||||
|
totalBars,
|
||||||
|
atrLowerBuffer
|
||||||
|
//
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CopyBuffer(
|
||||||
|
mHandler,
|
||||||
|
X121_ATR_LINE,
|
||||||
|
0,
|
||||||
|
totalBars,
|
||||||
|
atrBuffer
|
||||||
|
//
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CopyBuffer(
|
||||||
|
mHandler,
|
||||||
|
X121_ATR_UPPER_RAW_LINE,
|
||||||
|
0,
|
||||||
|
totalBars,
|
||||||
|
atrUpperRawBuffer
|
||||||
|
//
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CopyBuffer(
|
||||||
|
mHandler,
|
||||||
|
X121_ATR_LOWER_RAW_LINE,
|
||||||
|
0,
|
||||||
|
totalBars,
|
||||||
|
atrLowerRawBuffer
|
||||||
|
//
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// XPV ...
|
// XPV ...
|
||||||
|
|
||||||
@@ -3885,28 +4200,6 @@ class XCX121Helper : public XCBaseHelper
|
|||||||
//
|
//
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// VALID PEAKS ...
|
|
||||||
CopyBuffer(
|
|
||||||
mHandler,
|
|
||||||
X121_VALID_PEAKS_LINE,
|
|
||||||
0,
|
|
||||||
totalBars,
|
|
||||||
validPeaksBuffer
|
|
||||||
//
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// VALID VALES ...
|
|
||||||
CopyBuffer(
|
|
||||||
mHandler,
|
|
||||||
X121_VALID_VALES_LINE,
|
|
||||||
0,
|
|
||||||
totalBars,
|
|
||||||
validValesBuffer
|
|
||||||
//
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// CURRENT ...
|
// CURRENT ...
|
||||||
|
|
||||||
|
|||||||
+359
-279
@@ -63,10 +63,18 @@ input ENUM_SERIESMODE hhMode = MODE_HIGH; // Highest High Calculation Method
|
|||||||
input ENUM_SERIESMODE llMode = MODE_LOW; // Lowest Low Calculation Method
|
input ENUM_SERIESMODE llMode = MODE_LOW; // Lowest Low Calculation Method
|
||||||
|
|
||||||
//
|
//
|
||||||
input group "Paraboli Sar Detection";
|
input group "Parabolic Sar Detection";
|
||||||
input double sarStep = 0.02; // Step
|
input double sarStep = 0.02; // Step
|
||||||
input double sarMax = 0.2; // Maximum
|
input double sarMax = 0.2; // Maximum
|
||||||
|
|
||||||
|
//
|
||||||
|
input group "Atr Detection";
|
||||||
|
input int atrLength = 14; // Length
|
||||||
|
input double atrMultiplier = 1; // Multiplier
|
||||||
|
input ENUM_APPLIED_PRICE atrUpperAppliedTo = PRICE_HIGH; // Upper Zone Applied To
|
||||||
|
input ENUM_APPLIED_PRICE atrLowerAppliedTo = PRICE_LOW; // Lower Zone Applied To
|
||||||
|
input ENUM_X_MA_METHOD atrSmoothingMode = X_MA_MODE_EMA; // Smoothing Method
|
||||||
|
|
||||||
//
|
//
|
||||||
input group "VWap Detection";
|
input group "VWap Detection";
|
||||||
input int vwapFastLength = 20; // Fast Length
|
input int vwapFastLength = 20; // Fast Length
|
||||||
@@ -78,27 +86,15 @@ input ENUM_APPLIED_PRICE vwapAppliedTo = PRICE_CLOSE; // Applied To
|
|||||||
input group "Donchain Detection";
|
input group "Donchain Detection";
|
||||||
input int donchainLength = 40; // Donchain Length
|
input int donchainLength = 40; // Donchain Length
|
||||||
|
|
||||||
//
|
|
||||||
input group "Fibonacci";
|
|
||||||
input double fiboLevel1 = 0.236; // Fibio 1st Level
|
|
||||||
input double fiboLevel2 = 0.382; // Fibio 2st Level
|
|
||||||
input double fiboLevel3 = 0.5; // Fibio 3rd Level
|
|
||||||
input double fiboLevel4 = 0.618; // Fibio 4th Level
|
|
||||||
input double fiboLevel5 = 0.764; // Fibio 5th Level
|
|
||||||
|
|
||||||
//
|
//
|
||||||
input group "Presentation";
|
input group "Presentation";
|
||||||
|
|
||||||
//
|
//
|
||||||
input int startCalculationForLastBars = 1000; // Calculate Last n Bars
|
input int startCalculationForLastBars = 1000; // Calculate Last n Bars
|
||||||
|
|
||||||
//
|
|
||||||
input int sarArrowCode = 159; // Parabolic Sar Arrow Code
|
|
||||||
input int peaksArrowCode = 159; // Peaks Arrow Code
|
|
||||||
input int valesArrowCode = 159; // Vales Arrow Code
|
|
||||||
|
|
||||||
//
|
//
|
||||||
input bool showSar = true; // Show Parabolic Sar
|
input bool showSar = true; // Show Parabolic Sar
|
||||||
|
input bool showAtr = true; // Show Atr
|
||||||
input bool showPeaks = true; // Show Peaks
|
input bool showPeaks = true; // Show Peaks
|
||||||
input bool showVales = true; // Show Vales
|
input bool showVales = true; // Show Vales
|
||||||
input bool showVWap = true; // Show VWap
|
input bool showVWap = true; // Show VWap
|
||||||
@@ -112,6 +108,11 @@ input bool showFibo3Levels = false; // Show Fibo 3rd Level
|
|||||||
input bool showFibo4Levels = false; // Show Fibo 4th Level
|
input bool showFibo4Levels = false; // Show Fibo 4th Level
|
||||||
input bool showFibo5Levels = false; // Show Fibo 5th Level
|
input bool showFibo5Levels = false; // Show Fibo 5th Level
|
||||||
|
|
||||||
|
//
|
||||||
|
input group "Atr Presentation";
|
||||||
|
input bool showAtrUpper = true; // Show Upper Zone
|
||||||
|
input bool showAtrLower = true; // Show Lower Zone
|
||||||
|
|
||||||
//
|
//
|
||||||
input group "VWap Presentation";
|
input group "VWap Presentation";
|
||||||
input bool showVWapFast = true; // Show VWap Fast
|
input bool showVWapFast = true; // Show VWap Fast
|
||||||
@@ -127,6 +128,22 @@ input bool showHigh = false; // Show High
|
|||||||
input bool showClose = true; // Show Close
|
input bool showClose = true; // Show Close
|
||||||
input bool showLow = false; // Show Low
|
input bool showLow = false; // Show Low
|
||||||
|
|
||||||
|
//
|
||||||
|
// Non Important Inputs ...
|
||||||
|
|
||||||
|
//
|
||||||
|
input group "Fibonacci";
|
||||||
|
input double fiboLevel1 = 0.236; // Fibio 1st Level
|
||||||
|
input double fiboLevel2 = 0.382; // Fibio 2st Level
|
||||||
|
input double fiboLevel3 = 0.5; // Fibio 3rd Level
|
||||||
|
input double fiboLevel4 = 0.618; // Fibio 4th Level
|
||||||
|
input double fiboLevel5 = 0.764; // Fibio 5th Level
|
||||||
|
|
||||||
|
//
|
||||||
|
input int sarArrowCode = 159; // Parabolic Sar Arrow Code
|
||||||
|
input int peaksArrowCode = 159; // Peaks Arrow Code
|
||||||
|
input int valesArrowCode = 159; // Vales Arrow Code
|
||||||
|
|
||||||
//
|
//
|
||||||
// Buffers ...
|
// Buffers ...
|
||||||
|
|
||||||
@@ -140,8 +157,8 @@ input bool showLow = false; // Show Low
|
|||||||
#property indicator_chart_window
|
#property indicator_chart_window
|
||||||
|
|
||||||
//
|
//
|
||||||
#property indicator_buffers 39
|
#property indicator_buffers 42
|
||||||
#property indicator_plots 19
|
#property indicator_plots 21
|
||||||
|
|
||||||
//
|
//
|
||||||
// PEAKS ...
|
// PEAKS ...
|
||||||
@@ -169,6 +186,9 @@ double valesBuffer[];
|
|||||||
#property indicator_color2 clrMagenta
|
#property indicator_color2 clrMagenta
|
||||||
#property indicator_width2 1
|
#property indicator_width2 1
|
||||||
|
|
||||||
|
//
|
||||||
|
// SAR ...
|
||||||
|
|
||||||
//
|
//
|
||||||
#define sarBufferIndex 2
|
#define sarBufferIndex 2
|
||||||
double sarBuffer[];
|
double sarBuffer[];
|
||||||
@@ -180,52 +200,84 @@ double sarBuffer[];
|
|||||||
#property indicator_width3 1
|
#property indicator_width3 1
|
||||||
|
|
||||||
//
|
//
|
||||||
// FAST ...
|
// ATR ...
|
||||||
#define vwapFastBufferIndex 3
|
|
||||||
double vwapFastBuffer[];
|
|
||||||
|
|
||||||
#define vwapFastColorBufferIndex 4
|
|
||||||
double vwapFastColorBuffer[];
|
|
||||||
|
|
||||||
//
|
//
|
||||||
#define vwapFastPlotBufferIndex 3
|
// Upper ...
|
||||||
#property indicator_label4 "X121 VWF"
|
|
||||||
#property indicator_type4 DRAW_COLOR_LINE
|
//
|
||||||
#property indicator_color4 CLR_NONE, clrAqua, clrMagenta, clrGray
|
#define atrUpperBufferIndex 3
|
||||||
#property indicator_style4 STYLE_SOLID
|
double atrUpperBuffer[];
|
||||||
|
|
||||||
|
#property indicator_label4 "X121 ATRU"
|
||||||
|
#property indicator_type4 DRAW_LINE
|
||||||
|
#property indicator_color4 clrYellow
|
||||||
|
#property indicator_style4 STYLE_DOT
|
||||||
#property indicator_width4 2
|
#property indicator_width4 2
|
||||||
|
|
||||||
//
|
//
|
||||||
// MID ...
|
// Lower ...
|
||||||
#define vwapMidBufferIndex 5
|
|
||||||
double vwapMidBuffer[];
|
|
||||||
|
|
||||||
#define vwapMidColorBufferIndex 6
|
|
||||||
double vwapMidColorBuffer[];
|
|
||||||
|
|
||||||
//
|
//
|
||||||
#define vwapMidPlotBufferIndex 4
|
#define atrLowerBufferIndex 4
|
||||||
#property indicator_label5 "X121 VWM"
|
double atrLowerBuffer[];
|
||||||
#property indicator_type5 DRAW_COLOR_LINE
|
|
||||||
#property indicator_color5 CLR_NONE, clrGreen, clrRed, clrGray
|
#property indicator_label5 "X121 ATRL"
|
||||||
#property indicator_style5 STYLE_SOLID
|
#property indicator_type5 DRAW_LINE
|
||||||
|
#property indicator_color5 clrYellow
|
||||||
|
#property indicator_style5 STYLE_DOT
|
||||||
#property indicator_width5 2
|
#property indicator_width5 2
|
||||||
|
|
||||||
|
//
|
||||||
|
// VWAP ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// FAST ...
|
||||||
|
#define vwapFastBufferIndex 5
|
||||||
|
double vwapFastBuffer[];
|
||||||
|
|
||||||
|
#define vwapFastColorBufferIndex 6
|
||||||
|
double vwapFastColorBuffer[];
|
||||||
|
|
||||||
|
//
|
||||||
|
#define vwapFastPlotBufferIndex 5
|
||||||
|
#property indicator_label6 "X121 VWF"
|
||||||
|
#property indicator_type6 DRAW_COLOR_LINE
|
||||||
|
#property indicator_color6 CLR_NONE, clrAqua, clrMagenta, clrGray
|
||||||
|
#property indicator_style6 STYLE_SOLID
|
||||||
|
#property indicator_width6 2
|
||||||
|
|
||||||
|
//
|
||||||
|
// MID ...
|
||||||
|
#define vwapMidBufferIndex 7
|
||||||
|
double vwapMidBuffer[];
|
||||||
|
|
||||||
|
#define vwapMidColorBufferIndex 8
|
||||||
|
double vwapMidColorBuffer[];
|
||||||
|
|
||||||
|
//
|
||||||
|
#define vwapMidPlotBufferIndex 6
|
||||||
|
#property indicator_label7 "X121 VWM"
|
||||||
|
#property indicator_type7 DRAW_COLOR_LINE
|
||||||
|
#property indicator_color7 CLR_NONE, clrGreen, clrRed, clrGray
|
||||||
|
#property indicator_style7 STYLE_SOLID
|
||||||
|
#property indicator_width7 2
|
||||||
|
|
||||||
//
|
//
|
||||||
// SLOW ...
|
// SLOW ...
|
||||||
#define vwapSlowBufferIndex 7
|
#define vwapSlowBufferIndex 9
|
||||||
double vwapSlowBuffer[];
|
double vwapSlowBuffer[];
|
||||||
|
|
||||||
#define vwapSlowColorBufferIndex 8
|
#define vwapSlowColorBufferIndex 10
|
||||||
double vwapSlowColorBuffer[];
|
double vwapSlowColorBuffer[];
|
||||||
|
|
||||||
//
|
//
|
||||||
#define vwapSlowPlotBufferIndex 5
|
#define vwapSlowPlotBufferIndex 7
|
||||||
#property indicator_label6 "X121 VWS"
|
#property indicator_label8 "X121 VWS"
|
||||||
#property indicator_type6 DRAW_COLOR_LINE
|
#property indicator_type8 DRAW_COLOR_LINE
|
||||||
#property indicator_color6 CLR_NONE, clrSteelBlue, clrDarkRed, clrGray
|
#property indicator_color8 CLR_NONE, clrSteelBlue, clrDarkRed, clrGray
|
||||||
#property indicator_style6 STYLE_SOLID
|
#property indicator_style8 STYLE_SOLID
|
||||||
#property indicator_width6 2
|
#property indicator_width8 2
|
||||||
|
|
||||||
//
|
//
|
||||||
// XDON ...
|
// XDON ...
|
||||||
@@ -234,101 +286,101 @@ double vwapSlowColorBuffer[];
|
|||||||
// Open ...
|
// Open ...
|
||||||
|
|
||||||
//
|
//
|
||||||
#define donOpenUpperBufferIndex 9
|
#define donOpenUpperBufferIndex 11
|
||||||
double donOpenUpperBuffer[];
|
double donOpenUpperBuffer[];
|
||||||
|
|
||||||
//
|
//
|
||||||
#define donOpenUpperPlotBufferIndex 6
|
#define donOpenUpperPlotBufferIndex 8
|
||||||
#property indicator_label7 "X121 O U"
|
#property indicator_label9 "X121 O U"
|
||||||
#property indicator_type7 DRAW_LINE
|
#property indicator_type9 DRAW_LINE
|
||||||
#property indicator_color7 clrCornflowerBlue
|
#property indicator_color9 clrCornflowerBlue
|
||||||
#property indicator_width7 1
|
#property indicator_width9 1
|
||||||
|
|
||||||
//
|
//
|
||||||
#define donOpenLowerBufferIndex 10
|
#define donOpenLowerBufferIndex 12
|
||||||
double donOpenLowerBuffer[];
|
double donOpenLowerBuffer[];
|
||||||
|
|
||||||
//
|
//
|
||||||
#define donOpenLowerPlotBufferIndex 7
|
#define donOpenLowerPlotBufferIndex 9
|
||||||
#property indicator_label8 "X121 O L"
|
#property indicator_label10 "X121 O L"
|
||||||
#property indicator_type8 DRAW_LINE
|
#property indicator_type10 DRAW_LINE
|
||||||
#property indicator_color8 clrCornflowerBlue
|
#property indicator_color10 clrCornflowerBlue
|
||||||
#property indicator_width8 1
|
#property indicator_width10 1
|
||||||
|
|
||||||
//
|
//
|
||||||
// High ...
|
// High ...
|
||||||
|
|
||||||
//
|
//
|
||||||
#define donHighUpperBufferIndex 11
|
#define donHighUpperBufferIndex 13
|
||||||
double donHighUpperBuffer[];
|
double donHighUpperBuffer[];
|
||||||
|
|
||||||
//
|
//
|
||||||
#define donHighUpperPlotBufferIndex 8
|
#define donHighUpperPlotBufferIndex 10
|
||||||
#property indicator_label9 "X121 H U"
|
#property indicator_label11 "X121 H U"
|
||||||
#property indicator_type9 DRAW_LINE
|
#property indicator_type11 DRAW_LINE
|
||||||
#property indicator_color9 clrAquamarine
|
#property indicator_color11 clrAquamarine
|
||||||
#property indicator_width9 1
|
#property indicator_width11 1
|
||||||
|
|
||||||
//
|
//
|
||||||
#define donHighLowerBufferIndex 12
|
#define donHighLowerBufferIndex 14
|
||||||
double donHighLowerBuffer[];
|
double donHighLowerBuffer[];
|
||||||
|
|
||||||
//
|
//
|
||||||
#define donHighLowerPlotBufferIndex 9
|
#define donHighLowerPlotBufferIndex 11
|
||||||
#property indicator_label10 "X121 H L"
|
#property indicator_label12 "X121 H L"
|
||||||
#property indicator_type10 DRAW_LINE
|
#property indicator_type12 DRAW_LINE
|
||||||
#property indicator_color10 clrAquamarine
|
#property indicator_color12 clrAquamarine
|
||||||
#property indicator_width10 1
|
#property indicator_width12 1
|
||||||
|
|
||||||
//
|
//
|
||||||
// Low ...
|
// Low ...
|
||||||
|
|
||||||
//
|
//
|
||||||
#define donLowUpperBufferIndex 13
|
#define donLowUpperBufferIndex 15
|
||||||
double donLowUpperBuffer[];
|
double donLowUpperBuffer[];
|
||||||
|
|
||||||
//
|
//
|
||||||
#define donLowUpperPlotBufferIndex 10
|
#define donLowUpperPlotBufferIndex 12
|
||||||
#property indicator_label11 "X121 L U"
|
#property indicator_label13 "X121 L U"
|
||||||
#property indicator_type11 DRAW_LINE
|
#property indicator_type13 DRAW_LINE
|
||||||
#property indicator_color11 clrDarkOrchid
|
#property indicator_color13 clrDarkOrchid
|
||||||
#property indicator_width11 1
|
#property indicator_width13 1
|
||||||
|
|
||||||
//
|
//
|
||||||
#define donLowLowerBufferIndex 14
|
#define donLowLowerBufferIndex 16
|
||||||
double donLowLowerBuffer[];
|
double donLowLowerBuffer[];
|
||||||
|
|
||||||
//
|
//
|
||||||
#define donLowLowerPlotBufferIndex 11
|
#define donLowLowerPlotBufferIndex 13
|
||||||
#property indicator_label12 "X121 L L"
|
#property indicator_label14 "X121 L L"
|
||||||
#property indicator_type12 DRAW_LINE
|
#property indicator_type14 DRAW_LINE
|
||||||
#property indicator_color12 clrDarkOrchid
|
#property indicator_color14 clrDarkOrchid
|
||||||
#property indicator_width12 1
|
#property indicator_width14 1
|
||||||
|
|
||||||
//
|
//
|
||||||
// Close ...
|
// Close ...
|
||||||
|
|
||||||
//
|
//
|
||||||
#define donCloseUpperBufferIndex 15
|
#define donCloseUpperBufferIndex 17
|
||||||
double donCloseUpperBuffer[];
|
double donCloseUpperBuffer[];
|
||||||
|
|
||||||
//
|
//
|
||||||
#define donCloseUpperPlotBufferIndex 12
|
#define donCloseUpperPlotBufferIndex 14
|
||||||
#property indicator_label13 "X121 C U"
|
#property indicator_label15 "X121 C U"
|
||||||
#property indicator_type13 DRAW_LINE
|
#property indicator_type15 DRAW_LINE
|
||||||
#property indicator_color13 clrCoral
|
#property indicator_color15 clrCoral
|
||||||
#property indicator_width13 1
|
#property indicator_width15 1
|
||||||
|
|
||||||
//
|
//
|
||||||
#define donCloseLowerBufferIndex 16
|
#define donCloseLowerBufferIndex 18
|
||||||
double donCloseLowerBuffer[];
|
double donCloseLowerBuffer[];
|
||||||
|
|
||||||
//
|
//
|
||||||
#define donCloseLowerPlotBufferIndex 13
|
#define donCloseLowerPlotBufferIndex 15
|
||||||
#property indicator_label14 "X121 C L"
|
#property indicator_label16 "X121 C L"
|
||||||
#property indicator_type14 DRAW_LINE
|
#property indicator_type16 DRAW_LINE
|
||||||
#property indicator_color14 clrCoral
|
#property indicator_color16 clrCoral
|
||||||
#property indicator_width14 1
|
#property indicator_width16 1
|
||||||
|
|
||||||
//
|
//
|
||||||
// FIBONACCI ...
|
// FIBONACCI ...
|
||||||
@@ -337,82 +389,82 @@ double donCloseLowerBuffer[];
|
|||||||
// FIBBO Level 1 ...
|
// FIBBO Level 1 ...
|
||||||
|
|
||||||
//
|
//
|
||||||
#define fl1BufferIndex 17
|
#define fl1BufferIndex 19
|
||||||
double fl1Buffer[];
|
double fl1Buffer[];
|
||||||
|
|
||||||
//
|
//
|
||||||
#define fl1PlotBufferIndex 14
|
#define fl1PlotBufferIndex 16
|
||||||
#property indicator_label15 "X121 FL1"
|
#property indicator_label17 "X121 FL1"
|
||||||
#property indicator_type15 DRAW_LINE
|
|
||||||
#property indicator_color15 clrGold
|
|
||||||
#property indicator_style15 STYLE_DASHDOTDOT
|
|
||||||
#property indicator_width15 1
|
|
||||||
|
|
||||||
//
|
|
||||||
// FIBBO Level 2 ...
|
|
||||||
|
|
||||||
//
|
|
||||||
#define fl2BufferIndex 18
|
|
||||||
double fl2Buffer[];
|
|
||||||
|
|
||||||
//
|
|
||||||
#define fl2PlotBufferIndex 15
|
|
||||||
#property indicator_label16 "X121 FL2"
|
|
||||||
#property indicator_type16 DRAW_LINE
|
|
||||||
#property indicator_color16 clrGold
|
|
||||||
#property indicator_style16 STYLE_DASHDOTDOT
|
|
||||||
#property indicator_width16 1
|
|
||||||
|
|
||||||
//
|
|
||||||
// FIBBO Level 3 ...
|
|
||||||
|
|
||||||
//
|
|
||||||
#define fl3BufferIndex 19
|
|
||||||
double fl3Buffer[];
|
|
||||||
|
|
||||||
//
|
|
||||||
#define fl3PlotBufferIndex 16
|
|
||||||
#property indicator_label17 "X121 FL3"
|
|
||||||
#property indicator_type17 DRAW_LINE
|
#property indicator_type17 DRAW_LINE
|
||||||
#property indicator_color17 clrGold
|
#property indicator_color17 clrGold
|
||||||
#property indicator_style17 STYLE_DASHDOTDOT
|
#property indicator_style17 STYLE_DASHDOTDOT
|
||||||
#property indicator_width17 1
|
#property indicator_width17 1
|
||||||
|
|
||||||
//
|
//
|
||||||
// FIBBO Level 4 ...
|
// FIBBO Level 2 ...
|
||||||
|
|
||||||
//
|
//
|
||||||
#define fl4BufferIndex 20
|
#define fl2BufferIndex 20
|
||||||
double fl4Buffer[];
|
double fl2Buffer[];
|
||||||
|
|
||||||
//
|
//
|
||||||
#define fl4PlotBufferIndex 17
|
#define fl2PlotBufferIndex 17
|
||||||
#property indicator_label18 "X121 FL4"
|
#property indicator_label18 "X121 FL2"
|
||||||
#property indicator_type18 DRAW_LINE
|
#property indicator_type18 DRAW_LINE
|
||||||
#property indicator_color18 clrGold
|
#property indicator_color18 clrGold
|
||||||
#property indicator_style18 STYLE_DASHDOTDOT
|
#property indicator_style18 STYLE_DASHDOTDOT
|
||||||
#property indicator_width18 1
|
#property indicator_width18 1
|
||||||
|
|
||||||
//
|
//
|
||||||
// FIBBO Level 5 ...
|
// FIBBO Level 3 ...
|
||||||
|
|
||||||
//
|
//
|
||||||
#define fl5BufferIndex 21
|
#define fl3BufferIndex 21
|
||||||
double fl5Buffer[];
|
double fl3Buffer[];
|
||||||
|
|
||||||
//
|
//
|
||||||
#define fl5PlotBufferIndex 18
|
#define fl3PlotBufferIndex 18
|
||||||
#property indicator_label19 "X121 FL5"
|
#property indicator_label19 "X121 FL3"
|
||||||
#property indicator_type19 DRAW_LINE
|
#property indicator_type19 DRAW_LINE
|
||||||
#property indicator_color19 clrGold
|
#property indicator_color19 clrGold
|
||||||
#property indicator_style19 STYLE_DASHDOTDOT
|
#property indicator_style19 STYLE_DASHDOTDOT
|
||||||
#property indicator_width19 1
|
#property indicator_width19 1
|
||||||
|
|
||||||
|
//
|
||||||
|
// FIBBO Level 4 ...
|
||||||
|
|
||||||
|
//
|
||||||
|
#define fl4BufferIndex 22
|
||||||
|
double fl4Buffer[];
|
||||||
|
|
||||||
|
//
|
||||||
|
#define fl4PlotBufferIndex 19
|
||||||
|
#property indicator_label20 "X121 FL4"
|
||||||
|
#property indicator_type20 DRAW_LINE
|
||||||
|
#property indicator_color20 clrGold
|
||||||
|
#property indicator_style20 STYLE_DASHDOTDOT
|
||||||
|
#property indicator_width20 1
|
||||||
|
|
||||||
|
//
|
||||||
|
// FIBBO Level 5 ...
|
||||||
|
|
||||||
|
//
|
||||||
|
#define fl5BufferIndex 23
|
||||||
|
double fl5Buffer[];
|
||||||
|
|
||||||
|
//
|
||||||
|
#define fl5PlotBufferIndex 20
|
||||||
|
#property indicator_label21 "X121 FL5"
|
||||||
|
#property indicator_type21 DRAW_LINE
|
||||||
|
#property indicator_color21 clrGold
|
||||||
|
#property indicator_style21 STYLE_DASHDOTDOT
|
||||||
|
#property indicator_width21 1
|
||||||
|
|
||||||
//
|
//
|
||||||
// Data Buffers ...
|
// Data Buffers ...
|
||||||
|
|
||||||
//
|
//
|
||||||
int mLastBufferIndex = 21;
|
int mLastBufferIndex = 23;
|
||||||
|
|
||||||
//
|
//
|
||||||
// CURRENT ...
|
// CURRENT ...
|
||||||
@@ -495,13 +547,16 @@ double vwapMidStateBuffer[];
|
|||||||
double vwapSlowStateBuffer[];
|
double vwapSlowStateBuffer[];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Valid Peaks and Vales ...
|
// ATR ...
|
||||||
|
|
||||||
#define validPeaksBufferIndex mLastBufferIndex + 16
|
#define atrBufferIndex mLastBufferIndex + 16
|
||||||
double validPeaksBuffer[];
|
double atrBuffer[];
|
||||||
|
|
||||||
#define validValesBufferIndex mLastBufferIndex + 17
|
#define atrUpperRawBufferIndex mLastBufferIndex + 17
|
||||||
double validValesBuffer[];
|
double atrUpperRawBuffer[];
|
||||||
|
|
||||||
|
#define atrLowerRawBufferIndex mLastBufferIndex + 18
|
||||||
|
double atrLowerRawBuffer[];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Variables, Properties and etc ...
|
// Variables, Properties and etc ...
|
||||||
@@ -517,6 +572,10 @@ int maxLength;
|
|||||||
// SAR Handler ...
|
// SAR Handler ...
|
||||||
int sarHandler = INVALID_HANDLE;
|
int sarHandler = INVALID_HANDLE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// ATR Handler ...
|
||||||
|
int atrHandler = INVALID_HANDLE;
|
||||||
|
|
||||||
//
|
//
|
||||||
double mHideColorIDX = 0;
|
double mHideColorIDX = 0;
|
||||||
|
|
||||||
@@ -574,6 +633,19 @@ int OnInit()
|
|||||||
return INIT_FAILED;
|
return INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// ATR ...
|
||||||
|
atrHandler = iATR(
|
||||||
|
_Symbol,
|
||||||
|
_Period,
|
||||||
|
atrLength //
|
||||||
|
);
|
||||||
|
isInited = atrHandler != INVALID_HANDLE;
|
||||||
|
if (!isInited)
|
||||||
|
{
|
||||||
|
return INIT_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if (!InitMarketCycles())
|
if (!InitMarketCycles())
|
||||||
{
|
{
|
||||||
@@ -621,6 +693,7 @@ void OnDeinit(const int reason)
|
|||||||
|
|
||||||
//
|
//
|
||||||
IndicatorRelease(sarHandler);
|
IndicatorRelease(sarHandler);
|
||||||
|
IndicatorRelease(atrHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -680,10 +753,17 @@ int OnCalculate(
|
|||||||
// SAR ...
|
// SAR ...
|
||||||
int sarCalculatedBars = BarsCalculated(sarHandler);
|
int sarCalculatedBars = BarsCalculated(sarHandler);
|
||||||
|
|
||||||
|
//
|
||||||
|
// ATR ...
|
||||||
|
int atrCalculatedBars = BarsCalculated(atrHandler);
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isPassedRequiredCalculatedBars =
|
bool isPassedRequiredCalculatedBars =
|
||||||
//
|
//
|
||||||
// SAR ...
|
// SAR ...
|
||||||
|
sarCalculatedBars >= maxLength &&
|
||||||
|
//
|
||||||
|
// ATR...
|
||||||
sarCalculatedBars >= maxLength
|
sarCalculatedBars >= maxLength
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
@@ -702,13 +782,18 @@ int OnCalculate(
|
|||||||
// SAR ...
|
// SAR ...
|
||||||
int copiedSars = CopyBuffer(sarHandler, 0, 0, limit, sarBuffer);
|
int copiedSars = CopyBuffer(sarHandler, 0, 0, limit, sarBuffer);
|
||||||
|
|
||||||
|
//
|
||||||
|
// ATR ...
|
||||||
|
int copiedAtrs = CopyBuffer(atrHandler, 0, 0, limit, atrBuffer);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Validate Copied Items ...
|
// Validate Copied Items ...
|
||||||
bool isPassedRequiredCopiedItems =
|
bool isPassedRequiredCopiedItems =
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// SAR ...
|
// SAR ...
|
||||||
copiedSars > 0
|
copiedSars > 0 &&
|
||||||
|
copiedAtrs > 0
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
if (!isPassedRequiredCopiedItems)
|
if (!isPassedRequiredCopiedItems)
|
||||||
@@ -756,6 +841,10 @@ bool ValidateInputs()
|
|||||||
sarStep > 0 &&
|
sarStep > 0 &&
|
||||||
sarMax > sarStep &&
|
sarMax > sarStep &&
|
||||||
//
|
//
|
||||||
|
// ATR ...
|
||||||
|
atrLength > 0 &&
|
||||||
|
atrMultiplier > 0 &&
|
||||||
|
//
|
||||||
// XDON ...
|
// XDON ...
|
||||||
donchainLength > 0 &&
|
donchainLength > 0 &&
|
||||||
//
|
//
|
||||||
@@ -798,6 +887,10 @@ int ExtractMaxLengthOfInputs()
|
|||||||
result = MathMax(result, vwapMidLength);
|
result = MathMax(result, vwapMidLength);
|
||||||
result = MathMax(result, vwapSlowLength);
|
result = MathMax(result, vwapSlowLength);
|
||||||
|
|
||||||
|
//
|
||||||
|
// ATR ...
|
||||||
|
result = MathMax(result, atrLength);
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -827,6 +920,7 @@ void DefineBuffers()
|
|||||||
|
|
||||||
//
|
//
|
||||||
// VALES ...
|
// VALES ...
|
||||||
|
|
||||||
//
|
//
|
||||||
ENUM_DRAW_TYPE valesDrawType = showVales ? DRAW_ARROW : DRAW_NONE;
|
ENUM_DRAW_TYPE valesDrawType = showVales ? DRAW_ARROW : DRAW_NONE;
|
||||||
|
|
||||||
@@ -844,6 +938,7 @@ void DefineBuffers()
|
|||||||
|
|
||||||
//
|
//
|
||||||
// SAR ...
|
// SAR ...
|
||||||
|
|
||||||
//
|
//
|
||||||
ENUM_DRAW_TYPE sarDrawType = showSar ? DRAW_ARROW : DRAW_NONE;
|
ENUM_DRAW_TYPE sarDrawType = showSar ? DRAW_ARROW : DRAW_NONE;
|
||||||
|
|
||||||
@@ -859,6 +954,29 @@ void DefineBuffers()
|
|||||||
PlotIndexSetDouble(sarBufferIndex, PLOT_EMPTY_VALUE, 0);
|
PlotIndexSetDouble(sarBufferIndex, PLOT_EMPTY_VALUE, 0);
|
||||||
PlotIndexSetInteger(sarBufferIndex, PLOT_ARROW, sarArrowCode);
|
PlotIndexSetInteger(sarBufferIndex, PLOT_ARROW, sarArrowCode);
|
||||||
|
|
||||||
|
//
|
||||||
|
// ATR ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// UPPER ...
|
||||||
|
bool canShowAtrUpper = showAtr && showAtrUpper;
|
||||||
|
ENUM_DRAW_TYPE atrUpperDrawType = canShowAtrUpper ? DRAW_LINE : DRAW_NONE;
|
||||||
|
ArraySetAsSeries(atrUpperBuffer, true);
|
||||||
|
SetIndexBuffer(atrUpperBufferIndex, atrUpperBuffer, INDICATOR_DATA);
|
||||||
|
PlotIndexSetDouble(atrUpperBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
||||||
|
PlotIndexSetInteger(atrUpperBufferIndex, PLOT_SHOW_DATA, canShowAtrUpper);
|
||||||
|
PlotIndexSetInteger(atrUpperBufferIndex, PLOT_DRAW_TYPE, atrUpperDrawType);
|
||||||
|
|
||||||
|
//
|
||||||
|
// LOWER ...
|
||||||
|
bool canShowAtrLower = showAtr && showAtrLower;
|
||||||
|
ENUM_DRAW_TYPE atrLowerDrawType = canShowAtrLower ? DRAW_LINE : DRAW_NONE;
|
||||||
|
ArraySetAsSeries(atrLowerBuffer, true);
|
||||||
|
SetIndexBuffer(atrLowerBufferIndex, atrLowerBuffer, INDICATOR_DATA);
|
||||||
|
PlotIndexSetDouble(atrLowerBufferIndex, PLOT_EMPTY_VALUE, EMPTY_VALUE);
|
||||||
|
PlotIndexSetInteger(atrLowerBufferIndex, PLOT_SHOW_DATA, canShowAtrLower);
|
||||||
|
PlotIndexSetInteger(atrLowerBufferIndex, PLOT_DRAW_TYPE, atrLowerDrawType);
|
||||||
|
|
||||||
//
|
//
|
||||||
// XVWAP ...
|
// XVWAP ...
|
||||||
|
|
||||||
@@ -1118,15 +1236,19 @@ void DefineBuffers()
|
|||||||
SetIndexBuffer(vwapSlowStateBufferIndex, vwapSlowStateBuffer, INDICATOR_CALCULATIONS);
|
SetIndexBuffer(vwapSlowStateBufferIndex, vwapSlowStateBuffer, INDICATOR_CALCULATIONS);
|
||||||
|
|
||||||
//
|
//
|
||||||
// VALID Peaks and Vales ...
|
// ATR ...
|
||||||
|
|
||||||
//
|
//
|
||||||
ArraySetAsSeries(validPeaksBuffer, true);
|
ArraySetAsSeries(atrBuffer, true);
|
||||||
SetIndexBuffer(validPeaksBufferIndex, validPeaksBuffer, INDICATOR_CALCULATIONS);
|
SetIndexBuffer(atrBufferIndex, atrBuffer, INDICATOR_CALCULATIONS);
|
||||||
|
|
||||||
//
|
//
|
||||||
ArraySetAsSeries(validValesBuffer, true);
|
ArraySetAsSeries(atrUpperRawBuffer, true);
|
||||||
SetIndexBuffer(validValesBufferIndex, validValesBuffer, INDICATOR_CALCULATIONS);
|
SetIndexBuffer(atrUpperRawBufferIndex, atrUpperRawBuffer, INDICATOR_CALCULATIONS);
|
||||||
|
|
||||||
|
//
|
||||||
|
ArraySetAsSeries(atrLowerRawBuffer, true);
|
||||||
|
SetIndexBuffer(atrLowerRawBufferIndex, atrLowerRawBuffer, INDICATOR_CALCULATIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1192,14 +1314,15 @@ void CalculateBuffers(
|
|||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// if (bar_index <= barsLimit + 576)
|
CalculateAtrZones(
|
||||||
// {
|
bar_index,
|
||||||
// //
|
prevCalculated,
|
||||||
// CalculateValidPeaksAndVales(
|
ratesTotal,
|
||||||
// bar_index,
|
open,
|
||||||
// prevCalculated //
|
high,
|
||||||
// );
|
close,
|
||||||
// }
|
low //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
CalculateFibonacci(
|
CalculateFibonacci(
|
||||||
@@ -1416,6 +1539,14 @@ void FillBuffersZero(int barIndex)
|
|||||||
// SARS ...
|
// SARS ...
|
||||||
sarBuffer[barIndex] = 0;
|
sarBuffer[barIndex] = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// ATRS ...
|
||||||
|
atrBuffer[barIndex] = 0;
|
||||||
|
atrUpperBuffer[barIndex] = 0;
|
||||||
|
atrUpperRawBuffer[barIndex] = 0;
|
||||||
|
atrUpperBuffer[barIndex] = 0;
|
||||||
|
atrLowerRawBuffer[barIndex] = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// VWAP ...
|
// VWAP ...
|
||||||
|
|
||||||
@@ -1434,10 +1565,6 @@ void FillBuffersZero(int barIndex)
|
|||||||
vwapMidStateBuffer[barIndex] = hideColorIDX;
|
vwapMidStateBuffer[barIndex] = hideColorIDX;
|
||||||
vwapSlowStateBuffer[barIndex] = hideColorIDX;
|
vwapSlowStateBuffer[barIndex] = hideColorIDX;
|
||||||
|
|
||||||
//
|
|
||||||
validPeaksBuffer[barIndex] = 0;
|
|
||||||
validValesBuffer[barIndex] = 0;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
donOpenUpperBuffer[barIndex] = 0;
|
donOpenUpperBuffer[barIndex] = 0;
|
||||||
donOpenLowerBuffer[barIndex] = 0;
|
donOpenLowerBuffer[barIndex] = 0;
|
||||||
@@ -1989,147 +2116,100 @@ void CalculateDonchains(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate Valid Vales and Peaks ...
|
* Calculate Different VWaps ...
|
||||||
*
|
*
|
||||||
* @param bar_index: Integer, current Bar Index ...
|
* @param bar_index: Integer, Represent Current Bar ...
|
||||||
|
* @param prevCalculated: Integer, Represent Previous Calculated Bars ...
|
||||||
|
* @param ratesTotal: Integer, Represents All Available Bars ...
|
||||||
|
* @param open: Double Array, History of Open Prices ...
|
||||||
|
* @param high: Double Array, History of High Prices ...
|
||||||
|
* @param close: Double Array, History of Close Prices ...
|
||||||
|
* @param low: Double Array, History of Low Prices ...
|
||||||
*/
|
*/
|
||||||
void CalculateValidPeaksAndVales(
|
void CalculateAtrZones(
|
||||||
int bar_index,
|
int bar_index, // Selected Bar Index
|
||||||
int prevCalculated //
|
const int prevCalculated,
|
||||||
|
const int ratesTotal,
|
||||||
|
const double &open[],
|
||||||
|
const double &high[],
|
||||||
|
const double &close[],
|
||||||
|
const double &low[] //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
int minRepetition = donchainLength;
|
// Select ATr Value ...
|
||||||
int maxAllowedLoopbackBars = 576;
|
double atrValue = atrBuffer[bar_index];
|
||||||
|
double appliedAtrMultiplierValue = atrValue * atrMultiplier;
|
||||||
|
|
||||||
//
|
//
|
||||||
int barIndex = bar_index;
|
// Select Upper Price ...
|
||||||
int start = barIndex;
|
double upperPrice = GetAppliedPrice(
|
||||||
int end = start + maxAllowedLoopbackBars;
|
atrUpperAppliedTo,
|
||||||
|
open,
|
||||||
|
high,
|
||||||
|
low,
|
||||||
|
close,
|
||||||
|
bar_index //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
double peak = 0;
|
// Select Lower Price ...
|
||||||
int peakRepeate = 0;
|
double lowerPrice = GetAppliedPrice(
|
||||||
int peakToBarIndex = 0;
|
atrLowerAppliedTo,
|
||||||
int peakFromBarIndex = 0;
|
open,
|
||||||
|
high,
|
||||||
|
low,
|
||||||
|
close,
|
||||||
|
bar_index //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
double vale = 0;
|
// Calculate Raw Atrs ...
|
||||||
int valeRepeate = 0;
|
|
||||||
int valeToBarIndex = 0;
|
|
||||||
int valeFromBarIndex = 0;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
bool canLookupPeak = true;
|
// Upper ...
|
||||||
bool canLookupVale = true;
|
double atrUpperRawValue = upperPrice + appliedAtrMultiplierValue;
|
||||||
bool canLookup = true;
|
atrUpperRawBuffer[bar_index] = atrUpperRawValue;
|
||||||
|
|
||||||
//
|
//
|
||||||
while (canLookup)
|
// Lower ...
|
||||||
|
double atrLowerRawValue = lowerPrice - appliedAtrMultiplierValue;
|
||||||
|
atrLowerRawBuffer[bar_index] = atrLowerRawValue;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool canSmooth = atrSmoothingMode != X_MA_MODE_NONE;
|
||||||
|
if (canSmooth)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Check Peak ...
|
// Upper ...
|
||||||
if (canLookupPeak)
|
iMAOnBuffer(
|
||||||
{
|
ratesTotal,
|
||||||
//
|
prevCalculated,
|
||||||
double iPeak = peaksBuffer[barIndex];
|
bar_index,
|
||||||
if (iPeak != peak)
|
atrLength,
|
||||||
{
|
atrUpperRawBuffer,
|
||||||
//
|
atrUpperBuffer,
|
||||||
if (peak != 0 &&
|
atrSmoothingMode //
|
||||||
peakRepeate >= minRepetition)
|
);
|
||||||
{
|
|
||||||
//
|
|
||||||
canLookupPeak = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
peak = iPeak;
|
|
||||||
peakRepeate = 0;
|
|
||||||
peakFromBarIndex = 0;
|
|
||||||
peakToBarIndex = barIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (iPeak == peak)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
peakRepeate++;
|
|
||||||
peakFromBarIndex = barIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Vale ...
|
// Lower ...
|
||||||
if (canLookupVale)
|
iMAOnBuffer(
|
||||||
{
|
ratesTotal,
|
||||||
//
|
prevCalculated,
|
||||||
double iVale = valesBuffer[barIndex];
|
bar_index,
|
||||||
if (iVale != vale)
|
atrLength,
|
||||||
{
|
atrLowerRawBuffer,
|
||||||
//
|
atrLowerBuffer,
|
||||||
if (vale != 0 &&
|
atrSmoothingMode //
|
||||||
valeRepeate >= minRepetition)
|
);
|
||||||
{
|
|
||||||
canLookupVale = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
vale = iVale;
|
|
||||||
valeRepeate = 0;
|
|
||||||
valeFromBarIndex = 0;
|
|
||||||
valeToBarIndex = barIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (iVale == vale)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
valeRepeate++;
|
|
||||||
valeFromBarIndex = barIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
canLookup = barIndex < end &&
|
|
||||||
(canLookupPeak ||
|
|
||||||
canLookupVale);
|
|
||||||
if (canLookup)
|
|
||||||
{
|
|
||||||
barIndex++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (!canLookupPeak)
|
|
||||||
{
|
|
||||||
validPeaksBuffer[bar_index] = peak;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
double lastValidPeak = prevCalculated == 0
|
// Use Raw Values ...
|
||||||
? 0
|
atrUpperBuffer[bar_index] = atrUpperRawValue;
|
||||||
: validPeaksBuffer[bar_index + 1];
|
atrLowerBuffer[bar_index] = atrLowerRawValue;
|
||||||
|
|
||||||
//
|
|
||||||
validPeaksBuffer[bar_index] = lastValidPeak;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (!canLookupVale)
|
|
||||||
{
|
|
||||||
validValesBuffer[bar_index] = vale;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
double lastValidVale = prevCalculated == 0
|
|
||||||
? 0
|
|
||||||
: validValesBuffer[bar_index + 1];
|
|
||||||
|
|
||||||
//
|
|
||||||
validValesBuffer[bar_index] = lastValidVale;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13390,6 +13390,15 @@ ENUM_X_DIRECTION Opposit(ENUM_X_DIRECTION value)
|
|||||||
//
|
//
|
||||||
// Moving Average ...
|
// Moving Average ...
|
||||||
|
|
||||||
|
enum ENUM_X_MA_METHOD
|
||||||
|
{
|
||||||
|
X_MA_MODE_NONE, // None
|
||||||
|
X_MA_MODE_SMA, // SMA
|
||||||
|
X_MA_MODE_EMA, // EMA
|
||||||
|
X_MA_MODE_LWMA, // LWMA
|
||||||
|
X_MA_MODE_SMMA, // SMMA
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate Sspecified Buffer's Moving Averages ...
|
* Calculate Sspecified Buffer's Moving Averages ...
|
||||||
*
|
*
|
||||||
@@ -13397,7 +13406,7 @@ ENUM_X_DIRECTION Opposit(ENUM_X_DIRECTION value)
|
|||||||
* @param prev_calculated: Integer, Previous Calculate Items ...
|
* @param prev_calculated: Integer, Previous Calculate Items ...
|
||||||
* @param begin: Integer, Bar Index ...
|
* @param begin: Integer, Bar Index ...
|
||||||
* @param period: Integer, Moving Average Length ...
|
* @param period: Integer, Moving Average Length ...
|
||||||
* @param price: Double Array, Specified Array for Calculating Moving Averages ...
|
* @param source: Double Array, Specified Array for Calculating Moving Averages ...
|
||||||
* @param buffer: Double Array, Specified Array to Apply Calculated Moving Average on it ...
|
* @param buffer: Double Array, Specified Array to Apply Calculated Moving Average on it ...
|
||||||
* @param method: ENUM_MA_METHOD member Specified Moving Average Calculation Method ...
|
* @param method: ENUM_MA_METHOD member Specified Moving Average Calculation Method ...
|
||||||
*
|
*
|
||||||
@@ -13408,9 +13417,9 @@ int iMAOnBuffer(
|
|||||||
const int _prev_calculated,
|
const int _prev_calculated,
|
||||||
const int _begin,
|
const int _begin,
|
||||||
const int _period,
|
const int _period,
|
||||||
const double &_price[],
|
const double &_source[],
|
||||||
double &_buffer[],
|
double &_buffer[],
|
||||||
ENUM_MA_METHOD _method = MODE_SMA //
|
ENUM_X_MA_METHOD _method = X_MA_MODE_SMA //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -13421,6 +13430,7 @@ int iMAOnBuffer(
|
|||||||
_period < 0 ||
|
_period < 0 ||
|
||||||
_rates_total <= 0 ||
|
_rates_total <= 0 ||
|
||||||
_prev_calculated < 0 ||
|
_prev_calculated < 0 ||
|
||||||
|
_method == X_MA_MODE_NONE ||
|
||||||
_prev_calculated > _rates_total)
|
_prev_calculated > _rates_total)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
@@ -13430,49 +13440,49 @@ int iMAOnBuffer(
|
|||||||
switch (_method)
|
switch (_method)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
case MODE_SMA:
|
case X_MA_MODE_SMA:
|
||||||
result = SimpleMAOnBuffer(
|
result = SimpleMAOnBuffer(
|
||||||
_rates_total,
|
_rates_total,
|
||||||
_prev_calculated,
|
_prev_calculated,
|
||||||
_begin,
|
_begin,
|
||||||
_period,
|
_period,
|
||||||
_price,
|
_source,
|
||||||
_buffer //
|
_buffer //
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//
|
//
|
||||||
case MODE_EMA:
|
case X_MA_MODE_EMA:
|
||||||
result = ExponentialMAOnBuffer(
|
result = ExponentialMAOnBuffer(
|
||||||
_rates_total,
|
_rates_total,
|
||||||
_prev_calculated,
|
_prev_calculated,
|
||||||
_begin,
|
_begin,
|
||||||
_period,
|
_period,
|
||||||
_price,
|
_source,
|
||||||
_buffer //
|
_buffer //
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//
|
//
|
||||||
case MODE_LWMA:
|
case X_MA_MODE_LWMA:
|
||||||
result = LinearWeightedMAOnBuffer(
|
result = LinearWeightedMAOnBuffer(
|
||||||
_rates_total,
|
_rates_total,
|
||||||
_prev_calculated,
|
_prev_calculated,
|
||||||
_begin,
|
_begin,
|
||||||
_period,
|
_period,
|
||||||
_price,
|
_source,
|
||||||
_buffer //
|
_buffer //
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//
|
//
|
||||||
case MODE_SMMA:
|
case X_MA_MODE_SMMA:
|
||||||
result = SmoothedMAOnBuffer(
|
result = SmoothedMAOnBuffer(
|
||||||
_rates_total,
|
_rates_total,
|
||||||
_prev_calculated,
|
_prev_calculated,
|
||||||
_begin,
|
_begin,
|
||||||
_period,
|
_period,
|
||||||
_price,
|
_source,
|
||||||
_buffer //
|
_buffer //
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user