1564 lines
39 KiB
Plaintext
1564 lines
39 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Helper Class Library
|
|
// ----------------------------------------------
|
|
// Name: XSCXICHHelper
|
|
// Description: provides all Indicator
|
|
// Helper requirements ...
|
|
//
|
|
//
|
|
// Maintainer:
|
|
// ------------
|
|
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
|
//
|
|
//////////////////////////////////////////////////////
|
|
//
|
|
// Global Properties ...
|
|
#property library
|
|
#property copyright "Copyright 2023, SaherElm IT Center"
|
|
#property link "https://www.saherelm.ir"
|
|
#property version "1.00"
|
|
#property strict
|
|
|
|
//
|
|
#include "../Classes/x-saherelm.xhelper.class.mq5"
|
|
|
|
//
|
|
// Definitions ...
|
|
//
|
|
// Ichimoku Lines Calculator Mode ...
|
|
enum ENUM_XICH_CALCULATION_MODE
|
|
{
|
|
//
|
|
X_XICH_HH_LL_MODE = 1, // Highest High and Lowest Low
|
|
X_XICH_HO_LC_MODE = 2, // Highest Open and Lowest Close
|
|
};
|
|
|
|
//
|
|
enum ENUM_XICH_BUFFERS
|
|
{
|
|
X_ICH_TEANKANSEN_LINE = 0,
|
|
X_ICH_KIJUNSEN_LINE = 1,
|
|
X_ICH_CHIKOUSPAN_LINE = 4,
|
|
X_ICH_SENKOUSPANA_LINE = 5,
|
|
X_ICH_SENKOUSPANB_LINE = 6,
|
|
};
|
|
|
|
//
|
|
// Input Models ...
|
|
struct XICHInputs
|
|
{
|
|
//
|
|
// Props ...
|
|
|
|
//
|
|
// Market ...
|
|
//
|
|
// Tenkan Sen ...
|
|
int tenkanSenLength; // Length
|
|
ENUM_XICH_CALCULATION_MODE tenkanSenMode; // Calculation Mode
|
|
|
|
//
|
|
// Kijun Sen ...
|
|
int kijunSenLength; // Length
|
|
ENUM_XICH_CALCULATION_MODE kijunSenMode; // Calculation Mode
|
|
|
|
//
|
|
// Senkou Span B ...
|
|
int senkouSpanBLength; // Length
|
|
ENUM_XICH_CALCULATION_MODE senkouSpanBMode; // Calculation Mode
|
|
|
|
//
|
|
// Chikou Span ...
|
|
ENUM_APPLIED_PRICE chikuoSpanAppliedTo; // Price Type
|
|
|
|
//
|
|
// Presentation ...
|
|
bool showTenkanSen; // Show Tenkan Sen
|
|
bool showKijunSen; // Show Kijun Sen
|
|
bool showKijunSenPlus; // Show Kijun Sen +
|
|
bool showKijunSenNegative; // Show Kijun Sen -
|
|
bool showChikouSpan; // Show Chikou Span
|
|
bool showSenkouSpanA; // Show Senkou Span A
|
|
bool showSenkouSpanB; // Show Senkou Span B
|
|
bool showKumo; // Show Kumo
|
|
bool shiftKumo; // Shift Kumo to Future
|
|
|
|
//
|
|
// Constructor(s) ...
|
|
XICHInputs()
|
|
{
|
|
//
|
|
Clean();
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
//
|
|
// Clean ...
|
|
void Clean()
|
|
{
|
|
//
|
|
kijunSenLength = 0;
|
|
tenkanSenLength = 0;
|
|
senkouSpanBLength = 0;
|
|
|
|
//
|
|
kijunSenMode = X_XICH_HH_LL_MODE;
|
|
tenkanSenMode = X_XICH_HH_LL_MODE;
|
|
senkouSpanBMode = X_XICH_HH_LL_MODE;
|
|
|
|
//
|
|
chikuoSpanAppliedTo = PRICE_CLOSE;
|
|
|
|
//
|
|
showTenkanSen = false;
|
|
showKijunSen = false;
|
|
showKijunSenPlus = false;
|
|
showKijunSenNegative = false;
|
|
showChikouSpan = false;
|
|
showSenkouSpanA = false;
|
|
showSenkouSpanB = false;
|
|
showKumo = false;
|
|
shiftKumo = true;
|
|
}
|
|
|
|
//
|
|
// Default ...
|
|
void Default()
|
|
{
|
|
//
|
|
kijunSenLength = 26;
|
|
tenkanSenLength = 9;
|
|
senkouSpanBLength = 52;
|
|
|
|
//
|
|
kijunSenMode = X_XICH_HH_LL_MODE;
|
|
tenkanSenMode = X_XICH_HH_LL_MODE;
|
|
senkouSpanBMode = X_XICH_HH_LL_MODE;
|
|
|
|
//
|
|
chikuoSpanAppliedTo = PRICE_CLOSE;
|
|
|
|
//
|
|
showTenkanSen = true;
|
|
showKijunSen = true;
|
|
showKijunSenPlus = false;
|
|
showKijunSenNegative = false;
|
|
showChikouSpan = true;
|
|
showSenkouSpanA = true;
|
|
showSenkouSpanB = true;
|
|
showKumo = true;
|
|
shiftKumo = true;
|
|
}
|
|
|
|
//
|
|
// Validate ...
|
|
bool IsValid()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
tenkanSenLength > 2 &&
|
|
kijunSenLength > tenkanSenLength &&
|
|
senkouSpanBLength > kijunSenLength
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Retrieve MAx Length ...
|
|
int Max()
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
result = MathMax(result, tenkanSenLength);
|
|
result = MathMax(result, kijunSenLength);
|
|
result = MathMax(result, senkouSpanBLength);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
};
|
|
|
|
//
|
|
// Define Conditions ...
|
|
struct XICHConditions
|
|
{
|
|
//
|
|
// Common ...
|
|
string symbol;
|
|
ENUM_TIMEFRAMES period;
|
|
datetime time;
|
|
|
|
//
|
|
// Buffers ...
|
|
double tenkanSen[];
|
|
double kijunSen[];
|
|
double chikouSpan[];
|
|
double senkouSpanA[];
|
|
double senkouSpanB[];
|
|
double futureSenkouSpanA[];
|
|
double futureSenkouSpanB[];
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
bool isClosedOverKijunSen;
|
|
bool isClosedUnderKijunSen;
|
|
bool isTenkanSenOverKijunSen;
|
|
bool isTenkanSenUnderKijunSen;
|
|
bool isTenkanSenCrossedOverKijunSen;
|
|
bool isTenkanSenCrossedUnderKijunSen;
|
|
|
|
//
|
|
bool isSenkouSpanAOverB;
|
|
bool isSenkouSpanAUnderB;
|
|
bool isSenkouSpanAOverLast;
|
|
bool isSenkouSpanAUnderLast;
|
|
bool isFutureSenkouSpanAOverB;
|
|
bool isFutureSenkouSpanAUnderB;
|
|
bool isFutureSenkouSpanAOverLast;
|
|
bool isFutureSenkouSpanAUnderLast;
|
|
|
|
//
|
|
bool isSenkouSpanACrossedOverB;
|
|
bool isSenkouSpanACrossedUnderB;
|
|
bool isSenkouSpanACrossedOverLast;
|
|
bool isSenkouSpanACrossedUnderLast;
|
|
bool isFutureSenkouSpanACrossedOverB;
|
|
bool isFutureSenkouSpanACrossedUnderB;
|
|
bool isFutureSenkouSpanACrossedOverLast;
|
|
bool isFutureSenkouSpanACrossedUnderLast;
|
|
|
|
//
|
|
void Clean()
|
|
{
|
|
//
|
|
Clean(tenkanSen);
|
|
Clean(kijunSen);
|
|
Clean(chikouSpan);
|
|
Clean(senkouSpanA);
|
|
Clean(senkouSpanB);
|
|
Clean(futureSenkouSpanA);
|
|
Clean(futureSenkouSpanB);
|
|
|
|
//
|
|
ArraySetAsSeries(tenkanSen, true);
|
|
ArraySetAsSeries(kijunSen, true);
|
|
ArraySetAsSeries(chikouSpan, true);
|
|
ArraySetAsSeries(senkouSpanA, true);
|
|
ArraySetAsSeries(senkouSpanB, true);
|
|
ArraySetAsSeries(futureSenkouSpanA, true);
|
|
ArraySetAsSeries(futureSenkouSpanB, true);
|
|
|
|
//
|
|
isClosedOverKijunSen = false;
|
|
isClosedUnderKijunSen = false;
|
|
isTenkanSenOverKijunSen = false;
|
|
isTenkanSenUnderKijunSen = false;
|
|
isTenkanSenCrossedOverKijunSen = false;
|
|
isTenkanSenCrossedUnderKijunSen = false;
|
|
|
|
//
|
|
isSenkouSpanAOverB = false;
|
|
isSenkouSpanAUnderB = false;
|
|
isSenkouSpanAOverLast = false;
|
|
isSenkouSpanAUnderLast = false;
|
|
isFutureSenkouSpanAOverB = false;
|
|
isFutureSenkouSpanAUnderB = false;
|
|
isFutureSenkouSpanAOverLast = false;
|
|
isFutureSenkouSpanAUnderLast = false;
|
|
|
|
//
|
|
isSenkouSpanACrossedOverB = false;
|
|
isSenkouSpanACrossedUnderB = false;
|
|
isSenkouSpanACrossedOverLast = false;
|
|
isSenkouSpanACrossedUnderLast = false;
|
|
isFutureSenkouSpanACrossedOverB = false;
|
|
isFutureSenkouSpanACrossedUnderB = false;
|
|
isFutureSenkouSpanACrossedOverLast = false;
|
|
isFutureSenkouSpanACrossedUnderLast = false;
|
|
}
|
|
|
|
//
|
|
void GenerateScore(
|
|
double &bullishScore,
|
|
double &bearishScore //
|
|
)
|
|
{
|
|
//
|
|
bullishScore = 0;
|
|
bearishScore = 0;
|
|
|
|
//
|
|
if (isClosedOverKijunSen)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isTenkanSenOverKijunSen)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isTenkanSenCrossedOverKijunSen)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isSenkouSpanAOverB)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isSenkouSpanAOverLast)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isFutureSenkouSpanAOverB)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isFutureSenkouSpanAOverLast)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isSenkouSpanACrossedOverB)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isSenkouSpanACrossedOverLast)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isFutureSenkouSpanACrossedOverB)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
if (isFutureSenkouSpanACrossedOverLast)
|
|
{
|
|
bullishScore++;
|
|
}
|
|
|
|
//
|
|
if (isClosedUnderKijunSen)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isTenkanSenUnderKijunSen)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isTenkanSenCrossedUnderKijunSen)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isSenkouSpanAUnderB)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isSenkouSpanAUnderLast)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isFutureSenkouSpanAUnderB)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isFutureSenkouSpanAUnderLast)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isSenkouSpanACrossedUnderB)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isSenkouSpanACrossedUnderLast)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isFutureSenkouSpanACrossedUnderB)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
if (isFutureSenkouSpanACrossedUnderLast)
|
|
{
|
|
bearishScore++;
|
|
}
|
|
}
|
|
|
|
//
|
|
string GenerateSummary(
|
|
bool onlyCommons = false,
|
|
bool onlyConditions = false,
|
|
bool includeScores = true,
|
|
bool ignoreFalseConditions = true,
|
|
string separator = "\n" //
|
|
)
|
|
{
|
|
//
|
|
string result = NULL;
|
|
|
|
//
|
|
double bullishScore = 0;
|
|
double bearishScore = 0;
|
|
GenerateScore(
|
|
bullishScore,
|
|
bearishScore //
|
|
);
|
|
|
|
//
|
|
string scoresStr =
|
|
//
|
|
"Scores: " + separator +
|
|
"---------------" + separator +
|
|
"Bullish: " + ToString(bullishScore) + separator +
|
|
"Bearish: " + ToString(bearishScore) + separator +
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
string commonStr = GenerateSpecifiedCommonSummary(
|
|
this,
|
|
separator,
|
|
includeScores //
|
|
);
|
|
|
|
//
|
|
string conditionsStr =
|
|
//
|
|
ToString("isClosedOverKijunSen", isClosedOverKijunSen, ignoreFalseConditions, separator) +
|
|
ToString("isClosedUnderKijunSen", isClosedUnderKijunSen, ignoreFalseConditions, separator) +
|
|
ToString("isTenkanSenOverKijunSen", isTenkanSenOverKijunSen, ignoreFalseConditions, separator) +
|
|
ToString("isTenkanSenUnderKijunSen", isTenkanSenUnderKijunSen, ignoreFalseConditions, separator) +
|
|
ToString("isTenkanSenCrossedOverKijunSen", isTenkanSenCrossedOverKijunSen, ignoreFalseConditions, separator) +
|
|
ToString("isTenkanSenCrossedUnderKijunSen", isTenkanSenCrossedUnderKijunSen, ignoreFalseConditions, separator) +
|
|
//
|
|
ToString("isSenkouSpanAOverB", isSenkouSpanAOverB, ignoreFalseConditions, separator) +
|
|
ToString("isSenkouSpanAUnderB", isSenkouSpanAUnderB, ignoreFalseConditions, separator) +
|
|
ToString("isSenkouSpanAOverLast", isSenkouSpanAOverLast, ignoreFalseConditions, separator) +
|
|
ToString("isSenkouSpanAUnderLast", isSenkouSpanAUnderLast, ignoreFalseConditions, separator) +
|
|
ToString("isFutureSenkouSpanAOverB", isFutureSenkouSpanAOverB, ignoreFalseConditions, separator) +
|
|
ToString("isFutureSenkouSpanAUnderB", isFutureSenkouSpanAUnderB, ignoreFalseConditions, separator) +
|
|
ToString("isFutureSenkouSpanAOverLast", isFutureSenkouSpanAOverLast, ignoreFalseConditions, separator) +
|
|
ToString("isFutureSenkouSpanAUnderLast", isFutureSenkouSpanAUnderLast, ignoreFalseConditions, separator) +
|
|
//
|
|
ToString("isSenkouSpanACrossedOverB", isSenkouSpanACrossedOverB, ignoreFalseConditions, separator) +
|
|
ToString("isSenkouSpanACrossedUnderB", isSenkouSpanACrossedUnderB, ignoreFalseConditions, separator) +
|
|
ToString("isSenkouSpanACrossedOverLast", isSenkouSpanACrossedOverLast, ignoreFalseConditions, separator) +
|
|
ToString("isSenkouSpanACrossedUnderLast", isSenkouSpanACrossedUnderLast, ignoreFalseConditions, separator) +
|
|
ToString("isFutureSenkouSpanACrossedOverB", isFutureSenkouSpanACrossedOverB, ignoreFalseConditions, separator) +
|
|
ToString("isFutureSenkouSpanACrossedUnderB", isFutureSenkouSpanACrossedUnderB, ignoreFalseConditions, separator) +
|
|
ToString("isFutureSenkouSpanACrossedOverLast", isFutureSenkouSpanACrossedOverLast, ignoreFalseConditions, separator) +
|
|
ToString("isFutureSenkouSpanACrossedUnderLast", isFutureSenkouSpanACrossedUnderLast, ignoreFalseConditions, separator) +
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
result =
|
|
//
|
|
"[" + GetTag() + "]" + separator +
|
|
(onlyConditions
|
|
? ""
|
|
: commonStr) +
|
|
(!includeScores
|
|
? ""
|
|
: scoresStr) +
|
|
" " + separator +
|
|
(onlyCommons
|
|
? ""
|
|
: conditionsStr) +
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
string GetTag()
|
|
{
|
|
return "XICH";
|
|
}
|
|
|
|
//
|
|
bool HasLongConditions()
|
|
{
|
|
//
|
|
bool result;
|
|
|
|
//
|
|
int zIndex = 0;
|
|
int cIndex = zIndex + 1;
|
|
int pIndex = cIndex + 1;
|
|
|
|
//
|
|
XOHCL cBar;
|
|
result = cBar.Init(
|
|
symbol,
|
|
period,
|
|
cIndex //
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL pBar;
|
|
result = pBar.Init(
|
|
symbol,
|
|
period,
|
|
pIndex //
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool isCloseOverSenkouSpanA = cBar.close > senkouSpanA[cIndex];
|
|
|
|
//
|
|
bool isBaseBullish = isCloseOverSenkouSpanA &&
|
|
isSenkouSpanAOverB &&
|
|
isSenkouSpanAOverLast;
|
|
|
|
//
|
|
bool isKijunSenOverSenkouSpanA = kijunSen[cIndex] > senkouSpanA[cIndex];
|
|
|
|
//
|
|
bool isCloseOverTenkanSen = cBar.close > tenkanSen[cIndex];
|
|
|
|
//
|
|
bool isPriceCloseCrossedUpTenkanSen = pBar.close <= tenkanSen[pIndex] &&
|
|
cBar.close > tenkanSen[cIndex];
|
|
|
|
//
|
|
double cKumoUpper = MathMax(senkouSpanA[cIndex], senkouSpanB[cIndex]);
|
|
double pKumoUpper = MathMax(senkouSpanA[pIndex], senkouSpanB[pIndex]);
|
|
|
|
//
|
|
double cKumoLower = MathMin(senkouSpanA[cIndex], senkouSpanB[cIndex]);
|
|
double pKumoLower = MathMin(senkouSpanA[pIndex], senkouSpanB[pIndex]);
|
|
|
|
//
|
|
bool isTenkanSenOverKumo = tenkanSen[cIndex] > cKumoUpper;
|
|
bool isTenkanSenOverKumoPrev = tenkanSen[pIndex] > pKumoUpper;
|
|
|
|
//
|
|
bool isTenkanSenUnderKumo = tenkanSen[cIndex] < cKumoLower;
|
|
bool isTenkanSenUnderKumoPrev = tenkanSen[pIndex] < pKumoLower;
|
|
|
|
//
|
|
bool isTenkanSenCrossedOverKumo = isTenkanSenOverKumo &&
|
|
!isTenkanSenOverKumoPrev;
|
|
|
|
//
|
|
bool isTenkanSenCrossedUnderKumo = isTenkanSenUnderKumo &&
|
|
!isTenkanSenUnderKumoPrev;
|
|
|
|
//
|
|
bool condition1 =
|
|
isBaseBullish &&
|
|
isCloseOverTenkanSen &&
|
|
isKijunSenOverSenkouSpanA &&
|
|
isTenkanSenCrossedOverKijunSen;
|
|
|
|
//
|
|
bool condition2 =
|
|
isBaseBullish &&
|
|
isCloseOverTenkanSen &&
|
|
isKijunSenOverSenkouSpanA &&
|
|
isTenkanSenOverKijunSen &&
|
|
isSenkouSpanACrossedOverB;
|
|
|
|
//
|
|
bool condition3 =
|
|
isBaseBullish &&
|
|
isKijunSenOverSenkouSpanA &&
|
|
isPriceCloseCrossedUpTenkanSen &&
|
|
isTenkanSenOverKijunSen;
|
|
|
|
//
|
|
bool condition4 =
|
|
isCloseOverTenkanSen &&
|
|
isTenkanSenCrossedOverKumo &&
|
|
isTenkanSenOverKijunSen &&
|
|
isFutureSenkouSpanAOverB &&
|
|
isFutureSenkouSpanAOverLast;
|
|
|
|
//
|
|
result =
|
|
//
|
|
condition1
|
|
//
|
|
||
|
|
//
|
|
condition2
|
|
//
|
|
||
|
|
//
|
|
condition3
|
|
//
|
|
||
|
|
//
|
|
condition4
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool HasShortConditions()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
int zIndex = 0;
|
|
int cIndex = zIndex + 1;
|
|
int pIndex = cIndex + 1;
|
|
|
|
//
|
|
XOHCL cBar;
|
|
result = cBar.Init(
|
|
symbol,
|
|
period,
|
|
cIndex //
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL pBar;
|
|
result = pBar.Init(
|
|
symbol,
|
|
period,
|
|
pIndex //
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool isCloseUnderSenkouSpanB = cBar.close < senkouSpanB[cIndex];
|
|
|
|
//
|
|
bool isBaseBearish = isCloseUnderSenkouSpanB &&
|
|
isSenkouSpanAUnderB &&
|
|
isSenkouSpanAUnderLast;
|
|
|
|
//
|
|
bool isKijunSenUnderSenkouSpanB = kijunSen[cIndex] < senkouSpanB[cIndex];
|
|
|
|
//
|
|
bool isCloseUnderTenkanSen = cBar.close < tenkanSen[cIndex];
|
|
|
|
//
|
|
bool isPriceCloseCrossedDownTenkanSen = pBar.close >= tenkanSen[pIndex] &&
|
|
cBar.close < tenkanSen[cIndex];
|
|
|
|
//
|
|
double cKumoUpper = MathMax(senkouSpanA[cIndex], senkouSpanB[cIndex]);
|
|
double pKumoUpper = MathMax(senkouSpanA[pIndex], senkouSpanB[pIndex]);
|
|
|
|
//
|
|
double cKumoLower = MathMin(senkouSpanA[cIndex], senkouSpanB[cIndex]);
|
|
double pKumoLower = MathMin(senkouSpanA[pIndex], senkouSpanB[pIndex]);
|
|
|
|
//
|
|
bool isTenkanSenOverKumo = tenkanSen[cIndex] > cKumoUpper;
|
|
bool isTenkanSenOverKumoPrev = tenkanSen[pIndex] > pKumoUpper;
|
|
|
|
//
|
|
bool isTenkanSenUnderKumo = tenkanSen[cIndex] < cKumoLower;
|
|
bool isTenkanSenUnderKumoPrev = tenkanSen[pIndex] < pKumoLower;
|
|
|
|
//
|
|
bool isTenkanSenCrossedOverKumo = isTenkanSenOverKumo &&
|
|
!isTenkanSenOverKumoPrev;
|
|
|
|
//
|
|
bool isTenkanSenCrossedUnderKumo = isTenkanSenUnderKumo &&
|
|
!isTenkanSenUnderKumoPrev;
|
|
|
|
//
|
|
bool condition1 =
|
|
isBaseBearish &&
|
|
isCloseUnderTenkanSen &&
|
|
isKijunSenUnderSenkouSpanB &&
|
|
isTenkanSenCrossedUnderKijunSen;
|
|
|
|
//
|
|
bool condition2 =
|
|
isBaseBearish &&
|
|
isCloseUnderTenkanSen &&
|
|
isKijunSenUnderSenkouSpanB &&
|
|
isTenkanSenUnderKijunSen &&
|
|
isSenkouSpanACrossedUnderB;
|
|
|
|
//
|
|
bool condition3 =
|
|
isBaseBearish &&
|
|
isKijunSenUnderSenkouSpanB &&
|
|
isPriceCloseCrossedDownTenkanSen &&
|
|
isTenkanSenUnderKijunSen;
|
|
|
|
//
|
|
bool condition4 =
|
|
isCloseUnderTenkanSen &&
|
|
isTenkanSenCrossedUnderKumo &&
|
|
isTenkanSenUnderKijunSen &&
|
|
isFutureSenkouSpanAUnderB &&
|
|
isFutureSenkouSpanAUnderLast;
|
|
|
|
//
|
|
result =
|
|
//
|
|
condition1
|
|
|
|
||
|
|
//
|
|
condition2
|
|
//
|
|
||
|
|
//
|
|
condition3
|
|
//
|
|
||
|
|
//
|
|
condition4
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
};
|
|
|
|
//
|
|
// Class ...
|
|
class XSCXICHHelper : public XSCBaseHelper
|
|
{
|
|
//
|
|
// Public ...
|
|
public:
|
|
//
|
|
// Props ...
|
|
|
|
//
|
|
// Constructors ...
|
|
XSCXICHHelper() : XSCBaseHelper(_Symbol, _Period)
|
|
{
|
|
}
|
|
|
|
//
|
|
// Deconstructor ...
|
|
~XSCXICHHelper() {}
|
|
|
|
//
|
|
// Tools ...
|
|
bool Init(
|
|
string symbol, // Trading Symbol
|
|
ENUM_TIMEFRAMES period, // Trading Period
|
|
XICHInputs &inputs // Inputs
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
mSymbol = symbol;
|
|
mPeriod = period;
|
|
|
|
//
|
|
result = inputs.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
mInputs = inputs;
|
|
|
|
//
|
|
ArraySetAsSeries(tenkanSenBuffer, true);
|
|
ArraySetAsSeries(kijunSenBuffer, true);
|
|
ArraySetAsSeries(chikouSpanBuffer, true);
|
|
ArraySetAsSeries(senkouSpanABuffer, true);
|
|
ArraySetAsSeries(senkouSpanBBuffer, true);
|
|
ArraySetAsSeries(futureSenkouSpanABuffer, true);
|
|
ArraySetAsSeries(futureSenkouSpanBBuffer, true);
|
|
|
|
//
|
|
mHandler = iCustom(
|
|
mSymbol,
|
|
mPeriod,
|
|
"x-saherelm.xich",
|
|
//
|
|
// Inputs ...
|
|
//
|
|
// TenkanSen ...
|
|
"",
|
|
mInputs.tenkanSenLength,
|
|
mInputs.tenkanSenMode,
|
|
//
|
|
// KijunSen ...
|
|
"",
|
|
mInputs.kijunSenLength,
|
|
mInputs.kijunSenMode,
|
|
//
|
|
// SenkouSpan B ...
|
|
"",
|
|
mInputs.senkouSpanBLength,
|
|
mInputs.senkouSpanBMode,
|
|
//
|
|
// ChikouSpan ...
|
|
"",
|
|
mInputs.chikuoSpanAppliedTo,
|
|
//
|
|
// Presentation ...
|
|
"",
|
|
mInputs.showTenkanSen, // Show Tenkan Sen
|
|
mInputs.showKijunSen, // Show Kijun Sen
|
|
mInputs.showKijunSenPlus, // Show Kijun Sen +
|
|
mInputs.showKijunSenNegative, // Show Kijun Sen -
|
|
mInputs.showChikouSpan, // Show Chikou Span
|
|
mInputs.showSenkouSpanA, // Show Senkou Span A
|
|
mInputs.showSenkouSpanB, // Show Senkou Span B
|
|
mInputs.showKumo, // Show Kumo
|
|
mInputs.shiftKumo // Shift Kumo to Future
|
|
//
|
|
);
|
|
result = mHandler != INVALID_HANDLE;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Inputs ...
|
|
|
|
//
|
|
XICHInputs GetInputs()
|
|
{
|
|
return mInputs;
|
|
}
|
|
|
|
//
|
|
bool SetInputs(
|
|
XICHInputs &inputs // Configs
|
|
)
|
|
{
|
|
//
|
|
return Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
inputs);
|
|
}
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
// TenkanSen ...
|
|
|
|
//
|
|
double GetTenkanSen(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
return tenkanSenBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyTenkanSen(
|
|
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,
|
|
tenkanSenBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
bool IsSameTenkanSen(
|
|
int barIndex, // Start Bar Index
|
|
int verifier = 71 // Number of Verifiers
|
|
)
|
|
{
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
return IsSame(
|
|
tenkanSenBuffer,
|
|
verifier,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
// KijunSen ...
|
|
|
|
//
|
|
double GetKijunSen(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
return kijunSenBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyKijunSen(
|
|
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,
|
|
kijunSenBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
bool IsSameKijunSen(
|
|
int barIndex, // Start Bar Index
|
|
int verifier = 71 // Number of Verifiers
|
|
)
|
|
{
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
return IsSame(
|
|
kijunSenBuffer,
|
|
verifier,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
// ChikouSpan ...
|
|
|
|
//
|
|
double GetChikouSpan(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
barIndex -= mInputs.kijunSenLength;
|
|
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
if (barIndex > ArraySize(chikouSpanBuffer))
|
|
{
|
|
barIndex = ArraySize(chikouSpanBuffer) - 1;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
return chikouSpanBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyChikouSpan(
|
|
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 - mInputs.kijunSenLength,
|
|
count,
|
|
chikouSpanBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
// SenkouSpanA ...
|
|
|
|
//
|
|
double GetSenkouSpanA(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
return senkouSpanABuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopySenkouSpanA(
|
|
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,
|
|
senkouSpanABuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
bool IsSameSenkouSpanA(
|
|
int barIndex, // Start Bar Index
|
|
int verifier = 71 // Number of Verifiers
|
|
)
|
|
{
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
return IsSame(
|
|
senkouSpanABuffer,
|
|
verifier,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
// SenkouSpanB ...
|
|
|
|
//
|
|
double GetSenkouSpanB(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
return senkouSpanBBuffer[barIndex + mInputs.kijunSenLength];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopySenkouSpanB(
|
|
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,
|
|
senkouSpanBBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
bool IsSameSenkouSpanB(
|
|
int barIndex, // Start Bar Index
|
|
int verifier = 71 // Number of Verifiers
|
|
)
|
|
{
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
return IsSame(
|
|
senkouSpanBBuffer,
|
|
verifier,
|
|
barIndex //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Future SenkouSpanA ...
|
|
|
|
//
|
|
double GetFutureSenkouSpanA(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
barIndex -= mInputs.kijunSenLength;
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
return senkouSpanABuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyFutureSenkouSpanA(
|
|
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 - mInputs.kijunSenLength,
|
|
count,
|
|
futureSenkouSpanABuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
// Future SenkouSpanB ...
|
|
|
|
//
|
|
double GetFutureSenkouSpanB(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
barIndex -= mInputs.kijunSenLength;
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
return senkouSpanBBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyFutureSenkouSpanB(
|
|
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 - mInputs.kijunSenLength,
|
|
count,
|
|
futureSenkouSpanBBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
bool GetConditions(
|
|
XICHConditions &conditions, //
|
|
int barIndex = 0, //
|
|
int loopback = 4 //
|
|
)
|
|
{
|
|
//
|
|
bool result = true;
|
|
|
|
//
|
|
if (loopback < 4)
|
|
{
|
|
loopback = 4;
|
|
}
|
|
|
|
//
|
|
conditions.Clean();
|
|
|
|
//
|
|
conditions.symbol = mSymbol;
|
|
conditions.period = mPeriod;
|
|
conditions.time = TimeCurrent();
|
|
|
|
//
|
|
int zIndex = barIndex;
|
|
int cIndex = zIndex + 1;
|
|
int pIndex = cIndex + 1;
|
|
int ppIndex = pIndex + 1;
|
|
|
|
//
|
|
CopyTenkanSen(
|
|
zIndex,
|
|
loopback,
|
|
conditions.tenkanSen //
|
|
);
|
|
CopyKijunSen(
|
|
zIndex,
|
|
loopback,
|
|
conditions.kijunSen //
|
|
);
|
|
CopyChikouSpan(
|
|
zIndex,
|
|
loopback,
|
|
conditions.chikouSpan //
|
|
);
|
|
CopySenkouSpanA(
|
|
zIndex,
|
|
loopback,
|
|
conditions.senkouSpanA //
|
|
);
|
|
CopySenkouSpanB(
|
|
zIndex,
|
|
loopback,
|
|
conditions.senkouSpanB //
|
|
);
|
|
CopyFutureSenkouSpanA(
|
|
zIndex,
|
|
loopback,
|
|
conditions.futureSenkouSpanA //
|
|
);
|
|
CopyFutureSenkouSpanB(
|
|
zIndex,
|
|
loopback,
|
|
conditions.futureSenkouSpanB //
|
|
);
|
|
|
|
//
|
|
// Calculate Conditions ...
|
|
|
|
//
|
|
XOHCL cBar;
|
|
result = cBar.Init(
|
|
_Symbol,
|
|
_Period,
|
|
cIndex //
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool isClosedOverKijunSen = cBar.close > conditions.kijunSen[cIndex];
|
|
bool isClosedUnderKijunSen = cBar.close < conditions.kijunSen[cIndex];
|
|
|
|
//
|
|
bool isTenkanSenOverKijunSen = conditions.tenkanSen[cIndex] > conditions.kijunSen[cIndex];
|
|
bool isTenkanSenUnderKijunSen = conditions.tenkanSen[cIndex] < conditions.kijunSen[cIndex];
|
|
|
|
//
|
|
bool isTenkanSenOverKijunSenPrev = conditions.tenkanSen[pIndex] > conditions.kijunSen[pIndex];
|
|
bool isTenkanSenUnderKijunSenPrev = conditions.tenkanSen[pIndex] < conditions.kijunSen[pIndex];
|
|
|
|
//
|
|
bool isTenkanSenCrossedOverKijunSen = isTenkanSenOverKijunSen &&
|
|
!isTenkanSenOverKijunSenPrev;
|
|
bool isTenkanSenCrossedUnderKijunSen = isTenkanSenUnderKijunSen &&
|
|
!isTenkanSenUnderKijunSenPrev;
|
|
|
|
//
|
|
bool isSenkouSpanAOverB = conditions.senkouSpanA[cIndex] > conditions.senkouSpanB[cIndex];
|
|
bool isSenkouSpanAUnderB = conditions.senkouSpanA[cIndex] < conditions.senkouSpanB[cIndex];
|
|
|
|
//
|
|
bool isSenkouSpanAOverBPrev = conditions.senkouSpanA[pIndex] > conditions.senkouSpanB[pIndex];
|
|
bool isSenkouSpanAUnderBPrev = conditions.senkouSpanA[pIndex] < conditions.senkouSpanB[pIndex];
|
|
|
|
//
|
|
bool isSenkouSpanAOverLast = conditions.senkouSpanA[cIndex] > conditions.senkouSpanA[pIndex];
|
|
bool isSenkouSpanAUnderLast = conditions.senkouSpanA[cIndex] < conditions.senkouSpanA[pIndex];
|
|
|
|
//
|
|
bool isSenkouSpanAOverLastPrev = conditions.senkouSpanA[pIndex] > conditions.senkouSpanA[ppIndex];
|
|
bool isSenkouSpanAUnderLastPrev = conditions.senkouSpanA[pIndex] < conditions.senkouSpanA[ppIndex];
|
|
|
|
//
|
|
bool isFutureSenkouSpanAOverB = conditions.futureSenkouSpanA[cIndex] > conditions.futureSenkouSpanB[cIndex];
|
|
bool isFutureSenkouSpanAUnderB = conditions.futureSenkouSpanA[cIndex] < conditions.futureSenkouSpanB[cIndex];
|
|
|
|
//
|
|
bool isFutureSenkouSpanAOverBPrev = conditions.futureSenkouSpanA[pIndex] > conditions.futureSenkouSpanB[pIndex];
|
|
bool isFutureSenkouSpanAUnderBPrev = conditions.futureSenkouSpanA[pIndex] < conditions.futureSenkouSpanB[pIndex];
|
|
|
|
//
|
|
bool isFutureSenkouSpanAOverLast = conditions.futureSenkouSpanA[cIndex] > conditions.futureSenkouSpanA[pIndex];
|
|
bool isFutureSenkouSpanAUnderLast = conditions.futureSenkouSpanA[cIndex] < conditions.futureSenkouSpanA[pIndex];
|
|
|
|
//
|
|
bool isFutureSenkouSpanAOverLastPrev = conditions.futureSenkouSpanA[pIndex] > conditions.futureSenkouSpanA[ppIndex];
|
|
bool isFutureSenkouSpanAUnderLastPrev = conditions.futureSenkouSpanA[pIndex] < conditions.futureSenkouSpanA[ppIndex];
|
|
|
|
//
|
|
bool isSenkouSpanACrossedOverB = isSenkouSpanAOverB &&
|
|
!isSenkouSpanAOverBPrev;
|
|
bool isSenkouSpanACrossedUnderB = isSenkouSpanAUnderB &&
|
|
!isSenkouSpanAUnderBPrev;
|
|
|
|
//
|
|
bool isSenkouSpanACrossedOverLast = isSenkouSpanAOverLast &
|
|
!isSenkouSpanAOverLastPrev;
|
|
bool isSenkouSpanACrossedUnderLast = isSenkouSpanAUnderLast &&
|
|
!isSenkouSpanAUnderLastPrev;
|
|
|
|
//
|
|
bool isFutureSenkouSpanACrossedOverB = isFutureSenkouSpanAOverB &&
|
|
!isFutureSenkouSpanAOverBPrev;
|
|
bool isFutureSenkouSpanACrossedUnderB = isFutureSenkouSpanAUnderB &&
|
|
!isFutureSenkouSpanAUnderBPrev;
|
|
|
|
//
|
|
bool isFutureSenkouSpanACrossedOverLast = isFutureSenkouSpanAOverLast &&
|
|
!isFutureSenkouSpanAOverLastPrev;
|
|
bool isFutureSenkouSpanACrossedUnderLast = isFutureSenkouSpanAUnderLast &&
|
|
!isFutureSenkouSpanAUnderLastPrev;
|
|
|
|
//
|
|
conditions.isClosedOverKijunSen = isClosedOverKijunSen;
|
|
conditions.isClosedUnderKijunSen = isClosedUnderKijunSen;
|
|
conditions.isTenkanSenOverKijunSen = isTenkanSenOverKijunSen;
|
|
conditions.isTenkanSenUnderKijunSen = isTenkanSenUnderKijunSen;
|
|
conditions.isTenkanSenCrossedOverKijunSen = isTenkanSenCrossedOverKijunSen;
|
|
conditions.isTenkanSenCrossedUnderKijunSen = isTenkanSenCrossedUnderKijunSen;
|
|
conditions.isSenkouSpanAOverB = isSenkouSpanAOverB;
|
|
conditions.isSenkouSpanAUnderB = isSenkouSpanAUnderB;
|
|
conditions.isSenkouSpanAOverLast = isSenkouSpanAOverLast;
|
|
conditions.isSenkouSpanAUnderLast = isSenkouSpanAUnderLast;
|
|
conditions.isFutureSenkouSpanAOverB = isFutureSenkouSpanAOverB;
|
|
conditions.isFutureSenkouSpanAUnderB = isFutureSenkouSpanAUnderB;
|
|
conditions.isFutureSenkouSpanAOverLast = isFutureSenkouSpanAOverLast;
|
|
conditions.isFutureSenkouSpanAUnderLast = isFutureSenkouSpanAUnderLast;
|
|
conditions.isSenkouSpanACrossedOverB = isSenkouSpanACrossedOverB;
|
|
conditions.isSenkouSpanACrossedUnderB = isSenkouSpanACrossedUnderB;
|
|
conditions.isSenkouSpanACrossedOverLast = isSenkouSpanACrossedOverLast;
|
|
conditions.isSenkouSpanACrossedUnderLast = isSenkouSpanACrossedUnderLast;
|
|
conditions.isFutureSenkouSpanACrossedOverB = isFutureSenkouSpanACrossedOverB;
|
|
conditions.isFutureSenkouSpanACrossedUnderB = isFutureSenkouSpanACrossedUnderB;
|
|
conditions.isFutureSenkouSpanACrossedOverLast = isFutureSenkouSpanACrossedOverLast;
|
|
conditions.isFutureSenkouSpanACrossedUnderLast = isFutureSenkouSpanACrossedUnderLast;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Protected ...
|
|
protected:
|
|
//
|
|
// Private ...
|
|
private:
|
|
//
|
|
// Props ...
|
|
XICHInputs mInputs; // Inputs ...
|
|
|
|
//
|
|
// Buffers ...
|
|
double tenkanSenBuffer[];
|
|
double kijunSenBuffer[];
|
|
double chikouSpanBuffer[];
|
|
double senkouSpanABuffer[];
|
|
double senkouSpanBBuffer[];
|
|
double futureSenkouSpanABuffer[];
|
|
double futureSenkouSpanBBuffer[];
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
//
|
|
// Calculate Values Until Now ...
|
|
void Calculate()
|
|
{
|
|
//
|
|
int totalBars = CountBars();
|
|
int calculatedBars = CountCalculatedBars();
|
|
|
|
//
|
|
// TenkanSen ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
X_ICH_TEANKANSEN_LINE,
|
|
0,
|
|
totalBars,
|
|
tenkanSenBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// KijunSen ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
X_ICH_KIJUNSEN_LINE,
|
|
0,
|
|
totalBars,
|
|
kijunSenBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// ChikouSpan ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
X_ICH_CHIKOUSPAN_LINE,
|
|
0,
|
|
totalBars,
|
|
chikouSpanBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// SenkouSpan A ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
X_ICH_SENKOUSPANA_LINE,
|
|
0,
|
|
totalBars,
|
|
senkouSpanABuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// SenkouSpan B ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
X_ICH_SENKOUSPANB_LINE,
|
|
0,
|
|
totalBars,
|
|
senkouSpanBBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// SenkouSpan A ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
X_ICH_SENKOUSPANA_LINE,
|
|
0 - mInputs.kijunSenLength,
|
|
totalBars,
|
|
futureSenkouSpanABuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// SenkouSpan B ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
X_ICH_SENKOUSPANB_LINE,
|
|
0 - mInputs.kijunSenLength,
|
|
totalBars,
|
|
futureSenkouSpanBBuffer
|
|
//
|
|
);
|
|
}
|
|
};
|
|
|
|
//
|
|
// Tools ...
|