last works on xom1 ea ...
This commit is contained in:
@@ -31,26 +31,30 @@
|
||||
// Buffers ...
|
||||
enum ENUM_XOM1_BUFFERS
|
||||
{
|
||||
XOM1_MA_LINE = 0,
|
||||
XOM1_MA_COLOR_LINE = 1,
|
||||
XOM1_MA_STATE_LINE = 8,
|
||||
XOM1_SAR_LINE = 2,
|
||||
XOM1_SAR_COLOR_LINE = 3,
|
||||
XOM1_SAR_STATE_LINE = 9,
|
||||
XOM1_PEAK_LINE = 4,
|
||||
XOM1_VALE_LINE = 5,
|
||||
XOM1_FINO_UPPER_LINE = 6,
|
||||
XOM1_FINO_LOWER_LINE = 7,
|
||||
// 8 Ma State
|
||||
// 9 Sar State
|
||||
XOM1_SC_HH_LINE = 10,
|
||||
XOM1_SC_LL_LINE = 11,
|
||||
XOM1_MC_HH_LINE = 12,
|
||||
XOM1_MC_LL_LINE = 13,
|
||||
XOM1_LC_HH_LINE = 14,
|
||||
XOM1_LC_LL_LINE = 15,
|
||||
XOM1_HC_HH_LINE = 16,
|
||||
XOM1_HC_LL_LINE = 17,
|
||||
XOM1_MA_FAST_LINE = 0,
|
||||
XOM1_MA_FAST_COLOR_LINE = 1,
|
||||
XOM1_MA_FAST_STATE_LINE = 10,
|
||||
XOM1_MA_SLOW_LINE = 2,
|
||||
XOM1_MA_SLOW_COLOR_LINE = 3,
|
||||
XOM1_MA_SLOW_STATE_LINE = 11,
|
||||
XOM1_SAR_LINE = 4,
|
||||
XOM1_SAR_COLOR_LINE = 5,
|
||||
XOM1_SAR_STATE_LINE = 12,
|
||||
XOM1_PEAK_LINE = 6,
|
||||
XOM1_VALE_LINE = 7,
|
||||
XOM1_FINO_UPPER_LINE = 8,
|
||||
XOM1_FINO_LOWER_LINE = 9,
|
||||
// 10 Ma Fast State
|
||||
// 11 Ma Slow State
|
||||
// 12 Sar State
|
||||
XOM1_SC_HH_LINE = 13,
|
||||
XOM1_SC_LL_LINE = 14,
|
||||
XOM1_MC_HH_LINE = 15,
|
||||
XOM1_MC_LL_LINE = 16,
|
||||
XOM1_LC_HH_LINE = 17,
|
||||
XOM1_LC_LL_LINE = 18,
|
||||
XOM1_HC_HH_LINE = 19,
|
||||
XOM1_HC_LL_LINE = 20,
|
||||
};
|
||||
|
||||
//
|
||||
@@ -78,13 +82,15 @@ struct XOM1Inputs
|
||||
double sarMax; // SAR Maximum
|
||||
ENUM_MA_METHOD maMethod; // MA Method
|
||||
ENUM_APPLIED_PRICE maAppliedTo; // MA Applied To
|
||||
int maLength; // MA Length
|
||||
int maFastLength; // Fast MA Length
|
||||
int maSlowLength; // Slow MA Length
|
||||
|
||||
//
|
||||
// Presentation ...
|
||||
bool showPV; // Show PV
|
||||
bool showMA; // Show MA
|
||||
bool showSAR; // Show Sar
|
||||
bool showMAFast; // Show MA Fast
|
||||
bool showMASlow; // Show MA Slow
|
||||
bool showFiboZone; // Show Fibo Zone
|
||||
int startCalculationForLastBars; // Calculate Last n Bars
|
||||
int sarArrowCode; // Parabolic Sar Arrow Code
|
||||
@@ -130,13 +136,15 @@ struct XOM1Inputs
|
||||
sarMax = 0.2; // SAR Maximum
|
||||
maMethod = MODE_EMA; // MA Method
|
||||
maAppliedTo = PRICE_CLOSE; // MA Applied To
|
||||
maLength = 10; // MA Length
|
||||
maFastLength = 7; // Fast MA Length
|
||||
maSlowLength = 20; // Slow MA Length
|
||||
|
||||
//
|
||||
// Presentation ...
|
||||
showPV = true; // Show PV
|
||||
showMA = true; // Show MA
|
||||
showSAR = true; // Show Sar
|
||||
showMAFast = true; // Show MA Fast
|
||||
showMASlow = true; // Show MA Slow
|
||||
showFiboZone = true; // Show Fibo Zone
|
||||
startCalculationForLastBars = 1500; // Calculate Last n Bars
|
||||
sarArrowCode = 159; // Parabolic Sar Arrow Code
|
||||
@@ -150,8 +158,9 @@ struct XOM1Inputs
|
||||
{
|
||||
//
|
||||
showPV = false;
|
||||
showMA = false;
|
||||
showSAR = false;
|
||||
showMAFast = false;
|
||||
showMASlow = false;
|
||||
showFiboZone = false;
|
||||
}
|
||||
|
||||
@@ -166,7 +175,9 @@ struct XOM1Inputs
|
||||
result =
|
||||
//
|
||||
// MA ...
|
||||
maLength >= 2 &&
|
||||
maFastLength >= 2 &&
|
||||
maSlowLength >= 2 &&
|
||||
maSlowLength > maFastLength &&
|
||||
//
|
||||
// SAR ...
|
||||
sarMax > 0 &&
|
||||
@@ -203,9 +214,12 @@ struct XOM1Conditions
|
||||
|
||||
//
|
||||
// Buffers ...
|
||||
double maBuffer[];
|
||||
double maColorBuffer[];
|
||||
double maStateBuffer[];
|
||||
double maFastBuffer[];
|
||||
double maFastColorBuffer[];
|
||||
double maFastStateBuffer[];
|
||||
double maSlowBuffer[];
|
||||
double maSlowColorBuffer[];
|
||||
double maSlowStateBuffer[];
|
||||
double sarBuffer[];
|
||||
double sarColorBuffer[];
|
||||
double sarStateBuffer[];
|
||||
@@ -255,9 +269,12 @@ struct XOM1Conditions
|
||||
SpecifiedClean(bars);
|
||||
|
||||
//
|
||||
SpecifiedClean(maBuffer);
|
||||
SpecifiedClean(maColorBuffer);
|
||||
SpecifiedClean(maStateBuffer);
|
||||
SpecifiedClean(maFastBuffer);
|
||||
SpecifiedClean(maFastColorBuffer);
|
||||
SpecifiedClean(maFastStateBuffer);
|
||||
SpecifiedClean(maSlowBuffer);
|
||||
SpecifiedClean(maSlowColorBuffer);
|
||||
SpecifiedClean(maSlowStateBuffer);
|
||||
SpecifiedClean(sarBuffer);
|
||||
SpecifiedClean(sarColorBuffer);
|
||||
SpecifiedClean(sarStateBuffer);
|
||||
@@ -281,9 +298,12 @@ struct XOM1Conditions
|
||||
ArraySetAsSeries(bars, true);
|
||||
|
||||
//
|
||||
ArraySetAsSeries(maBuffer, true);
|
||||
ArraySetAsSeries(maColorBuffer, true);
|
||||
ArraySetAsSeries(maStateBuffer, true);
|
||||
ArraySetAsSeries(maFastBuffer, true);
|
||||
ArraySetAsSeries(maFastColorBuffer, true);
|
||||
ArraySetAsSeries(maFastStateBuffer, true);
|
||||
ArraySetAsSeries(maSlowBuffer, true);
|
||||
ArraySetAsSeries(maSlowColorBuffer, true);
|
||||
ArraySetAsSeries(maSlowStateBuffer, true);
|
||||
ArraySetAsSeries(sarBuffer, true);
|
||||
ArraySetAsSeries(sarColorBuffer, true);
|
||||
ArraySetAsSeries(sarStateBuffer, true);
|
||||
@@ -362,9 +382,12 @@ class XCXOM1Helper : public XCBaseHelper
|
||||
|
||||
//
|
||||
// Buffers ...
|
||||
double maBuffer[];
|
||||
double maColorBuffer[];
|
||||
double maStateBuffer[];
|
||||
double maFastBuffer[];
|
||||
double maFastColorBuffer[];
|
||||
double maFastStateBuffer[];
|
||||
double maSlowBuffer[];
|
||||
double maSlowColorBuffer[];
|
||||
double maSlowStateBuffer[];
|
||||
double sarBuffer[];
|
||||
double sarColorBuffer[];
|
||||
double sarStateBuffer[];
|
||||
@@ -420,9 +443,12 @@ class XCXOM1Helper : public XCBaseHelper
|
||||
}
|
||||
|
||||
//
|
||||
ArraySetAsSeries(maBuffer, true);
|
||||
ArraySetAsSeries(maColorBuffer, true);
|
||||
ArraySetAsSeries(maStateBuffer, true);
|
||||
ArraySetAsSeries(maFastBuffer, true);
|
||||
ArraySetAsSeries(maFastColorBuffer, true);
|
||||
ArraySetAsSeries(maFastStateBuffer, true);
|
||||
ArraySetAsSeries(maSlowBuffer, true);
|
||||
ArraySetAsSeries(maSlowColorBuffer, true);
|
||||
ArraySetAsSeries(maSlowStateBuffer, true);
|
||||
ArraySetAsSeries(sarBuffer, true);
|
||||
ArraySetAsSeries(sarColorBuffer, true);
|
||||
ArraySetAsSeries(sarStateBuffer, true);
|
||||
@@ -464,11 +490,13 @@ class XCXOM1Helper : public XCBaseHelper
|
||||
mInputs.sarMax,
|
||||
mInputs.maMethod,
|
||||
mInputs.maAppliedTo,
|
||||
mInputs.maLength,
|
||||
mInputs.maFastLength,
|
||||
mInputs.maSlowLength,
|
||||
"", // Presentation ...
|
||||
mInputs.showPV,
|
||||
mInputs.showMA,
|
||||
mInputs.showSAR,
|
||||
mInputs.showMAFast,
|
||||
mInputs.showMASlow,
|
||||
mInputs.showFiboZone,
|
||||
mInputs.startCalculationForLastBars,
|
||||
mInputs.sarArrowCode,
|
||||
@@ -588,17 +616,31 @@ class XCXOM1Helper : public XCBaseHelper
|
||||
// Buffers ...
|
||||
|
||||
//
|
||||
CopyMA(
|
||||
CopyMAFast(
|
||||
zIndex,
|
||||
loopback,
|
||||
conditions.maBuffer //
|
||||
conditions.maFastBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyMAState(
|
||||
CopyMAFastState(
|
||||
zIndex,
|
||||
loopback,
|
||||
conditions.maStateBuffer //
|
||||
conditions.maFastStateBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyMASlow(
|
||||
zIndex,
|
||||
loopback,
|
||||
conditions.maSlowBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyMASlowState(
|
||||
zIndex,
|
||||
loopback,
|
||||
conditions.maSlowStateBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -710,10 +752,10 @@ class XCXOM1Helper : public XCBaseHelper
|
||||
// Values Retrievers ...
|
||||
|
||||
//
|
||||
// MA ...
|
||||
// Fast MA ...
|
||||
|
||||
//
|
||||
double GetMA(
|
||||
double GetMAFast(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
@@ -727,18 +769,18 @@ class XCXOM1Helper : public XCBaseHelper
|
||||
Calculate(barIndex);
|
||||
|
||||
//
|
||||
int count = ArraySize(maBuffer);
|
||||
int count = ArraySize(maFastBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
//
|
||||
return maBuffer[barIndex];
|
||||
return maFastBuffer[barIndex];
|
||||
}
|
||||
|
||||
//
|
||||
int CopyMA(
|
||||
int CopyMAFast(
|
||||
int start, // Start
|
||||
int count, // Number of Items for read
|
||||
double &buffer[], // Dest Buffer
|
||||
@@ -754,7 +796,7 @@ class XCXOM1Helper : public XCBaseHelper
|
||||
return Copy(
|
||||
0,
|
||||
count,
|
||||
maBuffer,
|
||||
maFastBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
@@ -762,10 +804,10 @@ class XCXOM1Helper : public XCBaseHelper
|
||||
}
|
||||
|
||||
//
|
||||
// MA State ...
|
||||
// Fast MA State ...
|
||||
|
||||
//
|
||||
double GetMAState(
|
||||
double GetMAFastState(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
@@ -779,18 +821,18 @@ class XCXOM1Helper : public XCBaseHelper
|
||||
Calculate(barIndex);
|
||||
|
||||
//
|
||||
int count = ArraySize(maStateBuffer);
|
||||
int count = ArraySize(maFastStateBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
//
|
||||
return maStateBuffer[barIndex];
|
||||
return maFastStateBuffer[barIndex];
|
||||
}
|
||||
|
||||
//
|
||||
int CopyMAState(
|
||||
int CopyMAFastState(
|
||||
int start, // Start
|
||||
int count, // Number of Items for read
|
||||
double &buffer[], // Dest Buffer
|
||||
@@ -806,7 +848,111 @@ class XCXOM1Helper : public XCBaseHelper
|
||||
return Copy(
|
||||
0,
|
||||
count,
|
||||
maStateBuffer,
|
||||
maFastStateBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Slow MA ...
|
||||
|
||||
//
|
||||
double GetMASlow(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
Calculate(barIndex);
|
||||
|
||||
//
|
||||
int count = ArraySize(maSlowBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
//
|
||||
return maSlowBuffer[barIndex];
|
||||
}
|
||||
|
||||
//
|
||||
int CopyMASlow(
|
||||
int start, // Start
|
||||
int count, // Number of Items for read
|
||||
double &buffer[], // Dest Buffer
|
||||
bool forceClean = true // Force To Clean buffer
|
||||
)
|
||||
{
|
||||
//
|
||||
// Update Calculations ...
|
||||
Calculate(start);
|
||||
|
||||
//
|
||||
// Copy Items ...
|
||||
return Copy(
|
||||
0,
|
||||
count,
|
||||
maSlowBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Slow MA State ...
|
||||
|
||||
//
|
||||
double GetMASlowState(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
Calculate(barIndex);
|
||||
|
||||
//
|
||||
int count = ArraySize(maSlowStateBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
//
|
||||
return maSlowStateBuffer[barIndex];
|
||||
}
|
||||
|
||||
//
|
||||
int CopyMASlowState(
|
||||
int start, // Start
|
||||
int count, // Number of Items for read
|
||||
double &buffer[], // Dest Buffer
|
||||
bool forceClean = true // Force To Clean buffer
|
||||
)
|
||||
{
|
||||
//
|
||||
// Update Calculations ...
|
||||
Calculate(start);
|
||||
|
||||
//
|
||||
// Copy Items ...
|
||||
return Copy(
|
||||
0,
|
||||
count,
|
||||
maSlowStateBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
@@ -1589,28 +1735,55 @@ class XCXOM1Helper : public XCBaseHelper
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XOM1_MA_LINE,
|
||||
XOM1_MA_FAST_LINE,
|
||||
barIndex,
|
||||
maxRequiredBars,
|
||||
maBuffer //
|
||||
maFastBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XOM1_MA_COLOR_LINE,
|
||||
XOM1_MA_FAST_COLOR_LINE,
|
||||
barIndex,
|
||||
maxRequiredBars,
|
||||
maColorBuffer //
|
||||
maFastColorBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XOM1_MA_STATE_LINE,
|
||||
XOM1_MA_FAST_STATE_LINE,
|
||||
barIndex,
|
||||
maxRequiredBars,
|
||||
maStateBuffer //
|
||||
maFastStateBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XOM1_MA_SLOW_LINE,
|
||||
barIndex,
|
||||
maxRequiredBars,
|
||||
maSlowBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XOM1_MA_SLOW_COLOR_LINE,
|
||||
barIndex,
|
||||
maxRequiredBars,
|
||||
maSlowColorBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XOM1_MA_SLOW_STATE_LINE,
|
||||
barIndex,
|
||||
maxRequiredBars,
|
||||
maSlowStateBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -1756,19 +1929,37 @@ class XCXOM1Helper : public XCBaseHelper
|
||||
{
|
||||
//
|
||||
CleanupArray(
|
||||
maBuffer,
|
||||
maFastBuffer,
|
||||
maxAllowed //
|
||||
);
|
||||
|
||||
//
|
||||
CleanupArray(
|
||||
maColorBuffer,
|
||||
maFastColorBuffer,
|
||||
maxAllowed //
|
||||
);
|
||||
|
||||
//
|
||||
CleanupArray(
|
||||
maStateBuffer,
|
||||
maFastStateBuffer,
|
||||
maxAllowed //
|
||||
);
|
||||
|
||||
//
|
||||
CleanupArray(
|
||||
maSlowBuffer,
|
||||
maxAllowed //
|
||||
);
|
||||
|
||||
//
|
||||
CleanupArray(
|
||||
maSlowColorBuffer,
|
||||
maxAllowed //
|
||||
);
|
||||
|
||||
//
|
||||
CleanupArray(
|
||||
maSlowStateBuffer,
|
||||
maxAllowed //
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user