add MQL5Test Workspace Content as BKP Solution ...
This commit is contained in:
@@ -0,0 +1,849 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 Helper Class Library
|
||||
// ----------------------------------------------
|
||||
// Name: XSCXMRBHelper
|
||||
// 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
|
||||
|
||||
//
|
||||
// START Definitions ...
|
||||
//
|
||||
|
||||
//
|
||||
// Inputs ...
|
||||
struct XMRBInputs
|
||||
{
|
||||
//
|
||||
// Ribbon 1 ...
|
||||
int fast1Length; // Fast
|
||||
int slow1Length; // Slow
|
||||
|
||||
//
|
||||
// Ribbon 2 ...
|
||||
int fast2Length; // Fast
|
||||
int slow2Length; // Slow
|
||||
|
||||
//
|
||||
// Ribbon 3 ...
|
||||
int fast3Length; // Fast
|
||||
int slow3Length; // Slow
|
||||
|
||||
//
|
||||
// Ribbon 4 ...
|
||||
int fast4Length; // Fast
|
||||
int slow4Length; // Slow
|
||||
|
||||
//
|
||||
// Ribbon 5 ...
|
||||
int fast5Length; // Fast
|
||||
int slow5Length; // Slow
|
||||
|
||||
//
|
||||
// Calculation ...
|
||||
ENUM_MA_METHOD ribbonMode; // Mode
|
||||
ENUM_APPLIED_PRICE ribbonAppliedTo; // Applied To
|
||||
|
||||
//
|
||||
// Presentation ...
|
||||
bool showFastMa; // Show Fast
|
||||
bool showSlowMa; // Show Slow
|
||||
bool showRibbon; // Show Ribbon
|
||||
};
|
||||
|
||||
//
|
||||
// Index of Lines ...
|
||||
enum ENUM_XMRB_BUFFERS
|
||||
{
|
||||
//
|
||||
// Main Requirements ...
|
||||
XMRB_FAST_LINE = 0,
|
||||
XMRB_SLOW_LINE = 1,
|
||||
//
|
||||
// RIBBON 1 ...
|
||||
XMRB_R1_FAST_LINE = 2,
|
||||
XMRB_R1_SLOW_LINE = 3,
|
||||
//
|
||||
// RIBBON 2 ...
|
||||
XMRB_R2_FAST_LINE = 4,
|
||||
XMRB_R2_SLOW_LINE = 5,
|
||||
//
|
||||
// RIBBON 3 ...
|
||||
XMRB_R3_FAST_LINE = 6,
|
||||
XMRB_R3_SLOW_LINE = 7,
|
||||
//
|
||||
// RIBBON 4 ...
|
||||
XMRB_R4_FAST_LINE = 8,
|
||||
XMRB_R4_SLOW_LINE = 9,
|
||||
//
|
||||
// RIBBON 5 ...
|
||||
XMRB_R5_FAST_LINE = 10,
|
||||
XMRB_R5_SLOW_LINE = 11,
|
||||
};
|
||||
|
||||
//
|
||||
// Retrieve Info Model ...
|
||||
struct XMRBInfo
|
||||
{
|
||||
//
|
||||
// Symbol ...
|
||||
string symbol;
|
||||
|
||||
//
|
||||
// Period ...
|
||||
ENUM_TIMEFRAMES period;
|
||||
|
||||
//
|
||||
// Bar Time ...
|
||||
datetime barTime;
|
||||
|
||||
//
|
||||
// Bar Index ...
|
||||
int barIndex;
|
||||
|
||||
//
|
||||
// Values ...
|
||||
double fast;
|
||||
double slow;
|
||||
double fastR1;
|
||||
double slowR1;
|
||||
double fastR2;
|
||||
double slowR2;
|
||||
double fastR3;
|
||||
double slowR3;
|
||||
double fastR4;
|
||||
double slowR4;
|
||||
double fastR5;
|
||||
double slowR5;
|
||||
|
||||
//
|
||||
// Conditions ...
|
||||
|
||||
//
|
||||
bool isFastOverSlow;
|
||||
bool isFastCrossedOverSlow;
|
||||
bool isFastUnderSlow;
|
||||
bool isFastCrossedUnderSlow;
|
||||
|
||||
//
|
||||
bool isR1FastOverSlow;
|
||||
bool isR1FastCrossedOverSlow;
|
||||
bool isR1FastUnderSlow;
|
||||
bool isR1FastCrossedUnderSlow;
|
||||
|
||||
//
|
||||
bool isR2FastOverSlow;
|
||||
bool isR2FastCrossedOverSlow;
|
||||
bool isR2FastUnderSlow;
|
||||
bool isR2FastCrossedUnderSlow;
|
||||
|
||||
//
|
||||
bool isR3FastOverSlow;
|
||||
bool isR3FastCrossedOverSlow;
|
||||
bool isR3FastUnderSlow;
|
||||
bool isR3FastCrossedUnderSlow;
|
||||
|
||||
//
|
||||
bool isR4FastOverSlow;
|
||||
bool isR4FastCrossedOverSlow;
|
||||
bool isR4FastUnderSlow;
|
||||
bool isR4FastCrossedUnderSlow;
|
||||
|
||||
//
|
||||
bool isR5FastOverSlow;
|
||||
bool isR5FastCrossedOverSlow;
|
||||
bool isR5FastUnderSlow;
|
||||
bool isR5FastCrossedUnderSlow;
|
||||
};
|
||||
|
||||
//
|
||||
// END Definitions ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Import and Inclused requirements ...
|
||||
//
|
||||
|
||||
//
|
||||
// Includes ...
|
||||
#include "../Libraries/x-saherelm.common.lib.mq5"
|
||||
#include "../Classes/x-saherelm.xhelper.class.mq5"
|
||||
|
||||
//
|
||||
// END Import and Inclused requirements ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Overrides ...
|
||||
//
|
||||
|
||||
//
|
||||
// END Overrides ...
|
||||
//
|
||||
|
||||
//
|
||||
// a Class for Helping Indicators Requirements ...
|
||||
class XSCXMRBHelper : public XSCBaseHelper
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
public:
|
||||
//
|
||||
// Buffers ...
|
||||
double fastBuffer[];
|
||||
double slowBuffer[];
|
||||
double fastR1Buffer[];
|
||||
double slowR1Buffer[];
|
||||
double fastR2Buffer[];
|
||||
double slowR2Buffer[];
|
||||
double fastR3Buffer[];
|
||||
double slowR3Buffer[];
|
||||
double fastR4Buffer[];
|
||||
double slowR4Buffer[];
|
||||
double fastR5Buffer[];
|
||||
double slowR5Buffer[];
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
void XSCXMRBHelper(
|
||||
string symbol, // Trading Symbol
|
||||
ENUM_TIMEFRAMES period // Trading Time Frame
|
||||
) : XSCBaseHelper(symbol, period)
|
||||
{
|
||||
PrepareTag();
|
||||
}
|
||||
|
||||
//
|
||||
// Deconstructor ...
|
||||
void ~XSCXMRBHelper()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// START Properties ...
|
||||
//
|
||||
|
||||
//
|
||||
// Show Fast ...
|
||||
bool ShowFast(
|
||||
bool show // Show or Hide
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (mShowFastMa == show)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
mShowFastMa = show;
|
||||
result = Init();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Show Slow ...
|
||||
bool ShowSlow(
|
||||
bool show // Show or Hide
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (mShowSlowMa == show)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
mShowSlowMa = show;
|
||||
result = Init();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Show Ribbon ...
|
||||
bool ShowRibbon(
|
||||
bool show // Show or Hide
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (mShowRibbon == show)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
mShowRibbon = show;
|
||||
result = Init();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// END Properties ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Provided Functions ...
|
||||
//
|
||||
|
||||
//
|
||||
// Prepare Tag ...
|
||||
virtual void PrepareTag()
|
||||
{
|
||||
mTag = "XMRB" + GetTagPrefix();
|
||||
}
|
||||
|
||||
//
|
||||
virtual int GetMaxLength()
|
||||
{
|
||||
//
|
||||
int result = -1;
|
||||
|
||||
//
|
||||
result = MathMax(mFast1Length, mFast2Length);
|
||||
result = MathMax(result, mFast3Length);
|
||||
result = MathMax(result, mFast4Length);
|
||||
result = MathMax(result, mFast5Length);
|
||||
|
||||
//
|
||||
result = MathMax(result, mSlow1Length);
|
||||
result = MathMax(result, mSlow2Length);
|
||||
result = MathMax(result, mSlow3Length);
|
||||
result = MathMax(result, mSlow4Length);
|
||||
result = MathMax(result, mSlow5Length);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Initial Indicator Handler ...
|
||||
bool Init()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Validate Inputs ...
|
||||
result =
|
||||
//
|
||||
(mFast1Length > 2 &&
|
||||
mFast2Length > mFast1Length &&
|
||||
mFast3Length > mFast2Length &&
|
||||
mFast4Length > mFast3Length &&
|
||||
mFast5Length > mFast4Length &&
|
||||
mSlow1Length > mFast1Length &&
|
||||
mSlow2Length > mFast2Length &&
|
||||
mSlow3Length > mFast3Length &&
|
||||
mSlow4Length > mFast4Length &&
|
||||
mSlow5Length > mFast5Length &&
|
||||
mSlow2Length > mSlow1Length &&
|
||||
mSlow3Length > mSlow2Length &&
|
||||
mSlow4Length > mSlow3Length &&
|
||||
mSlow5Length > mSlow4Length
|
||||
//
|
||||
)
|
||||
//
|
||||
;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize Handler ...
|
||||
mHandler = iCustom(
|
||||
//
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
"x-saherelm.x121.xmrb",
|
||||
//
|
||||
// Inputs ...
|
||||
//
|
||||
// Ribbon 1 ...
|
||||
"",
|
||||
mFast1Length,
|
||||
mSlow1Length,
|
||||
//
|
||||
// Ribbon 2 ...
|
||||
"",
|
||||
mFast2Length,
|
||||
mSlow2Length,
|
||||
//
|
||||
// Ribbon 3 ...
|
||||
"",
|
||||
mFast3Length,
|
||||
mSlow3Length,
|
||||
//
|
||||
// Ribbon 4 ...
|
||||
"",
|
||||
mFast4Length,
|
||||
mSlow4Length,
|
||||
//
|
||||
// Ribbon 5 ...
|
||||
"",
|
||||
mFast5Length,
|
||||
mSlow5Length,
|
||||
//
|
||||
// Calculation ...
|
||||
"",
|
||||
//
|
||||
// Mode ...
|
||||
mRibbonMode,
|
||||
//
|
||||
// Applied To ...
|
||||
mRibbonAppliedTo,
|
||||
//
|
||||
// Presentation ...
|
||||
"",
|
||||
//
|
||||
// Show Fast ...
|
||||
mShowFastMa,
|
||||
//
|
||||
// Show Slow ...
|
||||
mShowSlowMa,
|
||||
//
|
||||
// Show Ribbon ...
|
||||
mShowRibbon
|
||||
//
|
||||
);
|
||||
result = mHandler != INVALID_HANDLE;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Current Config ...
|
||||
XMRBInputs GetConfig()
|
||||
{
|
||||
//
|
||||
XMRBInputs result;
|
||||
|
||||
//
|
||||
result.fast1Length = mFast1Length;
|
||||
result.slow1Length = mSlow1Length;
|
||||
result.fast2Length = mFast2Length;
|
||||
result.slow2Length = mSlow2Length;
|
||||
result.fast3Length = mFast3Length;
|
||||
result.slow3Length = mSlow3Length;
|
||||
result.fast4Length = mFast4Length;
|
||||
result.slow4Length = mSlow4Length;
|
||||
result.fast5Length = mFast5Length;
|
||||
result.slow5Length = mSlow5Length;
|
||||
result.ribbonMode = mRibbonMode;
|
||||
result.ribbonAppliedTo = mRibbonAppliedTo;
|
||||
result.showFastMa = mShowFastMa;
|
||||
result.showSlowMa = mShowSlowMa;
|
||||
result.showRibbon = mShowRibbon;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Set Config ...
|
||||
bool SetConfig(XMRBInputs &config)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
mFast1Length = config.fast1Length;
|
||||
mSlow1Length = config.slow1Length;
|
||||
mFast2Length = config.fast2Length;
|
||||
mSlow2Length = config.slow2Length;
|
||||
mFast3Length = config.fast3Length;
|
||||
mSlow3Length = config.slow3Length;
|
||||
mFast4Length = config.fast4Length;
|
||||
mSlow4Length = config.slow4Length;
|
||||
mFast5Length = config.fast5Length;
|
||||
mSlow5Length = config.slow5Length;
|
||||
mRibbonMode = config.ribbonMode;
|
||||
mRibbonAppliedTo = config.ribbonAppliedTo;
|
||||
mShowFastMa = config.showFastMa;
|
||||
mShowSlowMa = config.showSlowMa;
|
||||
mShowRibbon = config.showRibbon;
|
||||
|
||||
//
|
||||
result = Init();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Reading Buffers based on Given Bar Index ...
|
||||
virtual void Calculate(
|
||||
int barIndex // Given Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
// FAST ...
|
||||
ArraySetAsSeries(fastBuffer, true);
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XMRB_FAST_LINE,
|
||||
barIndex,
|
||||
mLoopbackBars,
|
||||
fastBuffer);
|
||||
|
||||
//
|
||||
// SLOW ...
|
||||
ArraySetAsSeries(slowBuffer, true);
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XMRB_SLOW_LINE,
|
||||
barIndex,
|
||||
mLoopbackBars,
|
||||
slowBuffer);
|
||||
|
||||
//
|
||||
// RIBBON 1 ...
|
||||
|
||||
//
|
||||
// FAST ...
|
||||
ArraySetAsSeries(fastR1Buffer, true);
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XMRB_R1_FAST_LINE,
|
||||
barIndex,
|
||||
mLoopbackBars,
|
||||
fastR1Buffer);
|
||||
|
||||
//
|
||||
// SLOW ...
|
||||
ArraySetAsSeries(slowR1Buffer, true);
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XMRB_R1_SLOW_LINE,
|
||||
barIndex,
|
||||
mLoopbackBars,
|
||||
slowR1Buffer);
|
||||
|
||||
//
|
||||
// RIBBON 2 ...
|
||||
|
||||
//
|
||||
// FAST ...
|
||||
ArraySetAsSeries(fastR2Buffer, true);
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XMRB_R2_FAST_LINE,
|
||||
barIndex,
|
||||
mLoopbackBars,
|
||||
fastR2Buffer);
|
||||
|
||||
//
|
||||
// SLOW ...
|
||||
ArraySetAsSeries(slowR2Buffer, true);
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XMRB_R2_SLOW_LINE,
|
||||
barIndex,
|
||||
mLoopbackBars,
|
||||
slowR2Buffer);
|
||||
|
||||
//
|
||||
// RIBBON 3 ...
|
||||
|
||||
//
|
||||
// FAST ...
|
||||
ArraySetAsSeries(fastR3Buffer, true);
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XMRB_R3_FAST_LINE,
|
||||
barIndex,
|
||||
mLoopbackBars,
|
||||
fastR3Buffer);
|
||||
|
||||
//
|
||||
// SLOW ...
|
||||
ArraySetAsSeries(slowR3Buffer, true);
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XMRB_R3_SLOW_LINE,
|
||||
barIndex,
|
||||
mLoopbackBars,
|
||||
slowR3Buffer);
|
||||
|
||||
//
|
||||
// RIBBON 4 ...
|
||||
|
||||
//
|
||||
// FAST ...
|
||||
ArraySetAsSeries(fastR4Buffer, true);
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XMRB_R4_FAST_LINE,
|
||||
barIndex,
|
||||
mLoopbackBars,
|
||||
fastR4Buffer);
|
||||
|
||||
//
|
||||
// SLOW ...
|
||||
ArraySetAsSeries(slowR4Buffer, true);
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XMRB_R4_SLOW_LINE,
|
||||
barIndex,
|
||||
mLoopbackBars,
|
||||
slowR4Buffer);
|
||||
|
||||
//
|
||||
// RIBBON 5 ...
|
||||
|
||||
//
|
||||
// FAST ...
|
||||
ArraySetAsSeries(fastR5Buffer, true);
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XMRB_R5_FAST_LINE,
|
||||
barIndex,
|
||||
mLoopbackBars,
|
||||
fastR5Buffer);
|
||||
|
||||
//
|
||||
// SLOW ...
|
||||
ArraySetAsSeries(slowR5Buffer, true);
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
XMRB_R5_SLOW_LINE,
|
||||
barIndex,
|
||||
mLoopbackBars,
|
||||
slowR5Buffer);
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Info at Specific Bar Index ...
|
||||
XMRBInfo GetInfo(
|
||||
int barIndex // Given Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
XMRBInfo result;
|
||||
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Do Calculations ...
|
||||
Calculate(barIndex);
|
||||
|
||||
//
|
||||
barIndex--;
|
||||
if (barIndex < 0) {
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Generate Candle Time ...
|
||||
datetime barTime = GetCandleTime(
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
barIndex);
|
||||
|
||||
//
|
||||
// Fill Result ...
|
||||
result.symbol = mSymbol;
|
||||
result.period = mPeriod;
|
||||
result.barTime = barTime;
|
||||
result.barIndex = barIndex;
|
||||
|
||||
//
|
||||
double fast = fastBuffer[barIndex];
|
||||
double fastPrev = fastBuffer[barIndex + 1];
|
||||
double slow = slowBuffer[barIndex];
|
||||
double slowPrev = slowBuffer[barIndex + 1];
|
||||
double fastR1 = fastR1Buffer[barIndex];
|
||||
double fastR1Prev = fastR1Buffer[barIndex + 1];
|
||||
double slowR1 = slowR1Buffer[barIndex];
|
||||
double slowR1Prev = slowR1Buffer[barIndex + 1];
|
||||
double fastR2 = fastR2Buffer[barIndex];
|
||||
double fastR2Prev = fastR2Buffer[barIndex + 1];
|
||||
double slowR2 = slowR2Buffer[barIndex];
|
||||
double slowR2Prev = slowR2Buffer[barIndex + 1];
|
||||
double fastR3 = fastR3Buffer[barIndex];
|
||||
double fastR3Prev = fastR3Buffer[barIndex + 1];
|
||||
double slowR3 = slowR3Buffer[barIndex];
|
||||
double slowR3Prev = slowR3Buffer[barIndex + 1];
|
||||
double fastR4 = fastR4Buffer[barIndex];
|
||||
double fastR4Prev = fastR4Buffer[barIndex + 1];
|
||||
double slowR4 = slowR4Buffer[barIndex];
|
||||
double slowR4Prev = slowR4Buffer[barIndex + 1];
|
||||
double fastR5 = fastR5Buffer[barIndex];
|
||||
double fastR5Prev = fastR5Buffer[barIndex + 1];
|
||||
double slowR5 = slowR5Buffer[barIndex];
|
||||
double slowR5Prev = slowR5Buffer[barIndex + 1];
|
||||
|
||||
//
|
||||
result.fast = fast;
|
||||
result.slow = slow;
|
||||
result.fastR1 = fastR1;
|
||||
result.slowR1 = slowR1;
|
||||
result.fastR2 = fastR2;
|
||||
result.slowR2 = slowR2;
|
||||
result.fastR3 = fastR3;
|
||||
result.slowR3 = slowR3;
|
||||
result.fastR4 = fastR4;
|
||||
result.slowR4 = slowR4;
|
||||
result.fastR5 = fastR5;
|
||||
result.slowR5 = slowR5;
|
||||
|
||||
//
|
||||
result.isFastOverSlow =
|
||||
fast > slow;
|
||||
result.isFastCrossedOverSlow =
|
||||
fast > slow && fastPrev <= slowPrev;
|
||||
result.isFastUnderSlow =
|
||||
fast < slow;
|
||||
result.isFastCrossedUnderSlow =
|
||||
fast < slow && fastPrev >= slowPrev;
|
||||
|
||||
//
|
||||
result.isR1FastOverSlow =
|
||||
fastR1 > slowR1;
|
||||
result.isR1FastCrossedOverSlow =
|
||||
fastR1 > slowR1 && fastR1Prev <= slowR1Prev;
|
||||
result.isR1FastUnderSlow =
|
||||
fastR1 < slowR1;
|
||||
result.isR1FastCrossedUnderSlow =
|
||||
fastR1 < slowR1 && fastR1Prev >= slowR1Prev;
|
||||
|
||||
//
|
||||
result.isR2FastOverSlow =
|
||||
fastR2 > slowR2;
|
||||
result.isR2FastCrossedOverSlow =
|
||||
fastR2 > slowR2 && fastR2Prev <= slowR2Prev;
|
||||
result.isR2FastUnderSlow =
|
||||
fastR2 < slowR2;
|
||||
result.isR2FastCrossedUnderSlow =
|
||||
fastR2 < slowR2 && fastR2Prev >= slowR2Prev;
|
||||
|
||||
//
|
||||
result.isR3FastOverSlow =
|
||||
fastR3 > slowR3;
|
||||
result.isR3FastCrossedOverSlow =
|
||||
fastR3 > slowR3 && fastR3Prev <= slowR3Prev;
|
||||
result.isR3FastUnderSlow =
|
||||
fastR3 < slowR3;
|
||||
result.isR3FastCrossedUnderSlow =
|
||||
fastR3 < slowR3 && fastR3Prev >= slowR3Prev;
|
||||
|
||||
//
|
||||
result.isR4FastOverSlow =
|
||||
fastR4 > slowR4;
|
||||
result.isR4FastCrossedOverSlow =
|
||||
fastR4 > slowR4 && fastR4Prev <= slowR4Prev;
|
||||
result.isR4FastUnderSlow =
|
||||
fastR4 < slowR4;
|
||||
result.isR4FastCrossedUnderSlow =
|
||||
fastR4 < slowR4 && fastR4Prev >= slowR4Prev;
|
||||
|
||||
//
|
||||
result.isR5FastOverSlow =
|
||||
fastR5 > slowR5;
|
||||
result.isR5FastCrossedOverSlow =
|
||||
fastR5 > slowR5 && fastR5Prev <= slowR5Prev;
|
||||
result.isR5FastUnderSlow =
|
||||
fastR5 < slowR5;
|
||||
result.isR5FastCrossedUnderSlow =
|
||||
fastR5 < slowR5 && fastR5Prev >= slowR5Prev;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// END Provided Functions ...
|
||||
//
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
//
|
||||
// Private ...
|
||||
private:
|
||||
//
|
||||
// Indicator Properties ...
|
||||
//
|
||||
// Market ...
|
||||
//
|
||||
// Ribbon 1 ...
|
||||
int mFast1Length;
|
||||
int mSlow1Length;
|
||||
//
|
||||
// Ribbon 2 ...
|
||||
int mFast2Length;
|
||||
int mSlow2Length;
|
||||
//
|
||||
// Ribbon 3 ...
|
||||
int mFast3Length;
|
||||
int mSlow3Length;
|
||||
//
|
||||
// Ribbon 4 ...
|
||||
int mFast4Length;
|
||||
int mSlow4Length;
|
||||
//
|
||||
// Ribbon 5 ...
|
||||
int mFast5Length;
|
||||
int mSlow5Length;
|
||||
//
|
||||
// Calculation ...
|
||||
//
|
||||
// Mode ...
|
||||
ENUM_MA_METHOD mRibbonMode;
|
||||
//
|
||||
// Applied To ...
|
||||
ENUM_APPLIED_PRICE mRibbonAppliedTo;
|
||||
//
|
||||
// Presentation ...
|
||||
//
|
||||
// Show Fast ...
|
||||
bool mShowFastMa;
|
||||
//
|
||||
// Show Slow ...
|
||||
bool mShowSlowMa;
|
||||
//
|
||||
// Show Ribbon ...
|
||||
bool mShowRibbon;
|
||||
};
|
||||
|
||||
//
|
||||
// START Usefull Functions ...
|
||||
//
|
||||
|
||||
//
|
||||
// END Usefull Functions ...
|
||||
//
|
||||
Reference in New Issue
Block a user