1136 lines
28 KiB
Plaintext
1136 lines
28 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center X121EA MQL5 Expert Advisor
|
|
// -------------------------------------------------
|
|
// Name: X121EA
|
|
// Description: an Exper Advisor which used RSI and MA
|
|
// to Analyse Market ...
|
|
//
|
|
// Maintainer:
|
|
// ------------
|
|
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
|
//
|
|
//////////////////////////////////////////////////////x
|
|
//
|
|
// Global Properties ...
|
|
#property copyright "Copyright 2023, SaherElm IT Center"
|
|
#property link "https://saherelm.ir"
|
|
#property version "1.00"
|
|
#property description "SaherElm X121EA"
|
|
#property strict
|
|
|
|
//
|
|
#define ShortName "X121EA"
|
|
|
|
//
|
|
#include "../Classes/x-saherelm.x121.xea.class.mq5"
|
|
#include "../Signallers/x-saherelm.x92.signaller.class.mq5"
|
|
#include "../Signallers/x-saherelm.xsp.signaller.class.mq5"
|
|
#include "../Signallers/x-saherelm.x110.signaller.class.mq5"
|
|
#include "../Signallers/x-saherelm.x121.signaller.class.mq5"
|
|
#include "../Signallers/x-saherelm.x128.signaller.class.mq5"
|
|
#include "../Signallers/x-saherelm.x786.signaller.class.mq5"
|
|
|
|
//
|
|
// "EURUSDb,USDCHFb,USDJPYb,XAUUSDb"
|
|
// "EURUSDb,USDCHFb,USDJPYb,GBPUSDb,XAUUSDb,AUDUSDb,USDCADb,NZDUSDb"
|
|
|
|
//
|
|
// Inputs ...
|
|
input long x121EAMagicNumber = 78692110; // Magic Number
|
|
input int x121EASlippage = 10; // Slippgae
|
|
input string x121EASymbols = "EURUSDb"; // Symbols
|
|
//
|
|
input bool x121EAAllowLong = true; // Allow Long Trades
|
|
input bool x121EAAllowShort = true; // Allow Short Trades
|
|
input double x121EAMaxAllowedDrawdownFactor = 0.002; // Max Allowed Drawdown Factor
|
|
input double x121EAVolume = 0.01; // Static Volume
|
|
input double x121EAR2R = 1; // Risk to Reward Ratio
|
|
|
|
//
|
|
// Vars ...
|
|
string x121EASymbol;
|
|
ENUM_TIMEFRAMES x121EAPeriod;
|
|
|
|
//
|
|
MqlTick x121EATick;
|
|
|
|
//
|
|
// X121EA ...
|
|
XSCX121EA *mX121EA;
|
|
|
|
//
|
|
// Event Handlers ...
|
|
|
|
//
|
|
// Initialization ...
|
|
int OnInit()
|
|
{
|
|
//
|
|
if (x121EASymbol == NULL || StringLen(x121EASymbol) <= 0)
|
|
{
|
|
x121EASymbol = _Symbol;
|
|
}
|
|
|
|
//
|
|
if (x121EAPeriod == NULL)
|
|
{
|
|
x121EAPeriod = _Period;
|
|
}
|
|
|
|
//
|
|
// Validate Inputs ...
|
|
if (!X121EAValidateInputs())
|
|
{
|
|
return INIT_PARAMETERS_INCORRECT;
|
|
}
|
|
|
|
//
|
|
// Initial EA ...
|
|
if (!InitialEA())
|
|
{
|
|
return INIT_PARAMETERS_INCORRECT;
|
|
}
|
|
|
|
//
|
|
// TesterHideIndicators(true);
|
|
|
|
//
|
|
mX121EA.Alert(ShortName + " Initialized Sccessfully ...");
|
|
|
|
//
|
|
// Init Succeed ...
|
|
return INIT_SUCCEEDED;
|
|
}
|
|
|
|
//
|
|
// DeInitialization ...
|
|
void OnDeinit(const int reason)
|
|
{
|
|
//
|
|
// REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function
|
|
// REASON_REMOVE 1 Program removed from a chart
|
|
// REASON_RECOMPILE 2 Program recompiled
|
|
// REASON_CHARTCHANGE 3 A symbol or a chart period is changed
|
|
// REASON_CHARTCLOSE 4 Chart closed
|
|
// REASON_PARAMETERS 5 Inputs changed by a user
|
|
// REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings
|
|
// REASON_TEMPLATE 7 Another chart template applied
|
|
// REASON_INITFAILED 8 The OnInit() handler returned a non-zero value
|
|
// REASON_CLOSE 9 Terminal closed
|
|
|
|
//
|
|
// De Initialize X121EA Providers ...
|
|
mX121EA.Alert(ShortName + " Deinitialized ...");
|
|
}
|
|
|
|
//
|
|
// On Tick Handler ...
|
|
void OnTick()
|
|
{
|
|
//
|
|
// Reading Tick ...
|
|
if (!SymbolInfoTick(x121EASymbol, x121EATick))
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
mX121EA.OnTick();
|
|
}
|
|
|
|
//
|
|
// Custom Functions ...
|
|
|
|
//
|
|
// Validate Variables nd Inputs ...
|
|
bool X121EAValidateInputs()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
x121EASlippage > 0 &&
|
|
x121EAMagicNumber > 0
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Initialize Specific Providers ...
|
|
bool InitialEA()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Here We Have to Initial 4 instance of X5Provider ...
|
|
// - EURUSD/M5;
|
|
// - USDCHF/M5;
|
|
// - USDJPY/M5;
|
|
// - XAUUSD/M5;
|
|
|
|
//
|
|
result = IsValid(x121EASymbols);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
string symbols[];
|
|
int symbolsCount = SplitContent(
|
|
symbols,
|
|
x121EASymbols);
|
|
result = symbolsCount > 0;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Instantiate X121EA Class ...
|
|
mX121EA = new XSCX121EA(
|
|
x121EASlippage, // Slippgae
|
|
x121EAMagicNumber // Magic Number
|
|
);
|
|
|
|
//
|
|
mX121EA.SetAlertPrefix(ShortName);
|
|
|
|
//
|
|
// Prepare Providers and Add them into mX121EA class ...
|
|
for (int i = 0; i < symbolsCount; i++)
|
|
{
|
|
//
|
|
// Requirements ...
|
|
string iSymbol = symbols[i];
|
|
ENUM_TIMEFRAMES iPeriod = PERIOD_M5;
|
|
|
|
//
|
|
// Define Structure ...
|
|
X121ProviderDescriptor iDescriptor;
|
|
|
|
//
|
|
iDescriptor.symbol = iSymbol;
|
|
iDescriptor.period = iPeriod;
|
|
|
|
//
|
|
// Attach Signallers ...
|
|
|
|
//
|
|
// X786 Signaller ...
|
|
X786Signaller *x786Signaller = new X786Signaller();
|
|
x786Signaller.Default();
|
|
x786Signaller.r2r = x121EAR2R;
|
|
x786Signaller.maxAllowedLong = 1;
|
|
x786Signaller.maxAllowedShort = 1;
|
|
x786Signaller.allowLong = x121EAAllowLong;
|
|
x786Signaller.allowShort = x121EAAllowShort;
|
|
x786Signaller.maxAllowedOpenPositionAge = 0;
|
|
x786Signaller.minRequiredProfitPerTrade = 0;
|
|
x786Signaller.openNextPositionOnProfit = false;
|
|
x786Signaller.staticVolumeLong = x121EAVolume;
|
|
x786Signaller.staticVolumeShort = x121EAVolume;
|
|
x786Signaller.delayBetweenTwoSameTypeSignals = 6;
|
|
|
|
//
|
|
// X121 Signaller ...
|
|
X121Signaller *x121Signaller = new X121Signaller();
|
|
x121Signaller.Default();
|
|
x121Signaller.r2r = x121EAR2R;
|
|
x121Signaller.maxAllowedLong = 1;
|
|
x121Signaller.maxAllowedShort = 1;
|
|
x121Signaller.allowLong = x121EAAllowLong;
|
|
x121Signaller.allowShort = x121EAAllowShort;
|
|
x121Signaller.maxAllowedOpenPositionAge = 0;
|
|
x121Signaller.minRequiredProfitPerTrade = 0;
|
|
x121Signaller.openNextPositionOnProfit = false;
|
|
x121Signaller.staticVolumeLong = x121EAVolume;
|
|
x121Signaller.staticVolumeShort = x121EAVolume;
|
|
x121Signaller.delayBetweenTwoSameTypeSignals = 6;
|
|
|
|
//
|
|
// X110 Signaller ...
|
|
X110Signaller *x110Signaller = new X110Signaller();
|
|
x110Signaller.Default();
|
|
x110Signaller.r2r = x121EAR2R;
|
|
x110Signaller.maxAllowedLong = 1;
|
|
x110Signaller.maxAllowedShort = 1;
|
|
x110Signaller.allowLong = x121EAAllowLong;
|
|
x110Signaller.allowShort = x121EAAllowShort;
|
|
x110Signaller.maxAllowedOpenPositionAge = 0;
|
|
x110Signaller.minRequiredProfitPerTrade = 0;
|
|
x110Signaller.openNextPositionOnProfit = false;
|
|
x110Signaller.staticVolumeLong = x121EAVolume;
|
|
x110Signaller.staticVolumeShort = x121EAVolume;
|
|
x110Signaller.delayBetweenTwoSameTypeSignals = 6;
|
|
|
|
//
|
|
// X92 Signaller ...
|
|
X92Signaller *x92Signaller = new X92Signaller();
|
|
x92Signaller.Default();
|
|
x92Signaller.r2r = x121EAR2R;
|
|
x92Signaller.SetSymbol(iSymbol);
|
|
x92Signaller.SetPeriod(iPeriod);
|
|
x92Signaller.maxAllowedLong = 1;
|
|
x92Signaller.maxAllowedShort = 1;
|
|
x92Signaller.allowLong = x121EAAllowLong;
|
|
x92Signaller.allowShort = x121EAAllowShort;
|
|
x92Signaller.maxAllowedOpenPositionAge = 0;
|
|
x92Signaller.minRequiredProfitPerTrade = 0;
|
|
x92Signaller.openNextPositionOnProfit = false;
|
|
x92Signaller.staticVolumeLong = x121EAVolume;
|
|
x92Signaller.staticVolumeShort = x121EAVolume;
|
|
x92Signaller.delayBetweenTwoSameTypeSignals = 6;
|
|
|
|
//
|
|
// X128 Signaller ...
|
|
X128Signaller *x128Signaller = new X128Signaller();
|
|
x128Signaller.Default();
|
|
x128Signaller.r2r = x121EAR2R;
|
|
x128Signaller.maxAllowedLong = 1;
|
|
x128Signaller.maxAllowedShort = 1;
|
|
x128Signaller.allowLong = false; // x121EAAllowLong;
|
|
x128Signaller.allowShort = false; // x121EAAllowShort;
|
|
x128Signaller.maxAllowedOpenPositionAge = 0;
|
|
x128Signaller.minRequiredProfitPerTrade = 0;
|
|
x128Signaller.openNextPositionOnProfit = false;
|
|
x128Signaller.staticVolumeLong = x121EAVolume;
|
|
x128Signaller.staticVolumeShort = x121EAVolume;
|
|
x128Signaller.delayBetweenTwoSameTypeSignals = 6;
|
|
|
|
//
|
|
// XSP Signaller ...
|
|
XSPSignaller *xSPSignaller = new XSPSignaller();
|
|
xSPSignaller.Default();
|
|
xSPSignaller.maxAllowedLong = 0;
|
|
xSPSignaller.maxAllowedShort = 0;
|
|
xSPSignaller.allowLong = false; // x121EAAllowLong;
|
|
xSPSignaller.allowShort = false; // x121EAAllowShort;
|
|
xSPSignaller.maxAllowedOpenPositionAge = 0;
|
|
xSPSignaller.minRequiredProfitPerTrade = 0;
|
|
xSPSignaller.openNextPositionOnProfit = false;
|
|
xSPSignaller.staticVolumeLong = x121EAVolume;
|
|
xSPSignaller.staticVolumeShort = x121EAVolume;
|
|
xSPSignaller.delayBetweenTwoSameTypeSignals = 6;
|
|
|
|
//
|
|
Clean(iDescriptor.signallers);
|
|
|
|
//
|
|
int idx = 0;
|
|
ArrayResize(iDescriptor.signallers, 3);
|
|
|
|
//
|
|
iDescriptor.signallers[idx] = x786Signaller;
|
|
idx++;
|
|
iDescriptor.signallers[idx] = x121Signaller;
|
|
idx++;
|
|
iDescriptor.signallers[idx] = x110Signaller;
|
|
idx++;
|
|
// iDescriptor.signallers[idx] = x92Signaller;
|
|
// idx++;
|
|
// iDescriptor.signallers[idx] = x128Signaller;
|
|
// idx++;
|
|
// iDescriptor.signallers[idx] = xSPSignaller;
|
|
// idx++;
|
|
|
|
//
|
|
// Set Inputs to Default ...
|
|
iDescriptor.inputs.Default();
|
|
|
|
//
|
|
// Prepare Input Requirements ...
|
|
|
|
//
|
|
iDescriptor.inputs.symbol = iSymbol;
|
|
iDescriptor.inputs.period = iPeriod;
|
|
|
|
//
|
|
ConfigureDescriptor(iDescriptor);
|
|
|
|
//
|
|
ApplyPreDefineConfigurations(iDescriptor);
|
|
|
|
//
|
|
// Init Inputs ...
|
|
result = iDescriptor.inputs.Init();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Validate Inputs ...
|
|
bool isInputsValid = iDescriptor.inputs.IsValid();
|
|
if (!isInputsValid)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//
|
|
result = mX121EA.AddProvider(iDescriptor);
|
|
if (!result)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Configurators ...
|
|
|
|
//
|
|
// Configuring Descriptors ...
|
|
void ConfigureDescriptor(
|
|
X121ProviderDescriptor &iDescriptor //
|
|
)
|
|
{
|
|
//
|
|
// XASCT ...
|
|
iDescriptor.inputs.asctInputs.showLongs = false;
|
|
iDescriptor.inputs.asctInputs.showShorts = false;
|
|
|
|
//
|
|
// XHK ...
|
|
iDescriptor.inputs.hkInputs.drawHikenAshi = false;
|
|
iDescriptor.inputs.hkInputs.drawSmoothedHikenAshi = false;
|
|
|
|
//
|
|
// XHULL ...
|
|
iDescriptor.inputs.hullInputs.showUpZone = false;
|
|
iDescriptor.inputs.hullInputs.showDownZone = false;
|
|
|
|
//
|
|
// XSSLC ...
|
|
iDescriptor.inputs.sslcInputs.showUp = false;
|
|
iDescriptor.inputs.sslcInputs.showDown = false;
|
|
|
|
//
|
|
// XMRB ...
|
|
iDescriptor.inputs.mrbInputs.showFastMa = false;
|
|
iDescriptor.inputs.mrbInputs.showSlowMa = false;
|
|
iDescriptor.inputs.mrbInputs.showRibbon = false;
|
|
|
|
//
|
|
// XMC ...
|
|
iDescriptor.inputs.mcInputs.showFastMa = false;
|
|
iDescriptor.inputs.mcInputs.showSlowMa = false;
|
|
iDescriptor.inputs.mcInputs.showVerifierMa = false;
|
|
|
|
//
|
|
// XICH ...
|
|
iDescriptor.inputs.ichInputs.showKumo = false;
|
|
iDescriptor.inputs.ichInputs.showKijunSen = false;
|
|
iDescriptor.inputs.ichInputs.showTenkanSen = false;
|
|
iDescriptor.inputs.ichInputs.showChikouSpan = false;
|
|
iDescriptor.inputs.ichInputs.showSenkouSpanA = false;
|
|
iDescriptor.inputs.ichInputs.showSenkouSpanB = false;
|
|
iDescriptor.inputs.ichInputs.showKijunSenPlus = false;
|
|
iDescriptor.inputs.ichInputs.showKijunSenNegative = false;
|
|
|
|
//
|
|
// XCHE ...
|
|
iDescriptor.inputs.cheInputs.showLongExit1Line = false;
|
|
iDescriptor.inputs.cheInputs.showShortExit1Line = false;
|
|
iDescriptor.inputs.cheInputs.showLongExit2Line = false;
|
|
iDescriptor.inputs.cheInputs.showShortExit2Line = false;
|
|
|
|
//
|
|
// XPV ...
|
|
iDescriptor.inputs.pvInputs.showPeaksAndVales = false;
|
|
iDescriptor.inputs.pvInputs.showLevels = false;
|
|
iDescriptor.inputs.pvInputs.showConsolidations = false;
|
|
iDescriptor.inputs.pvInputs.showFibo1Levels = false;
|
|
iDescriptor.inputs.pvInputs.showFibo2Levels = false;
|
|
iDescriptor.inputs.pvInputs.showFibo3Levels = false;
|
|
iDescriptor.inputs.pvInputs.showFibo4Levels = false;
|
|
iDescriptor.inputs.pvInputs.showFibo5Levels = false;
|
|
|
|
//
|
|
// XZG ...
|
|
iDescriptor.inputs.zgInputs.showZigZag = false;
|
|
iDescriptor.inputs.zgInputs.showPeaksAndVales = false;
|
|
|
|
//
|
|
// XDON ...
|
|
iDescriptor.inputs.donInputs.showOpen = false;
|
|
iDescriptor.inputs.donInputs.showHigh = false;
|
|
iDescriptor.inputs.donInputs.showClose = false;
|
|
iDescriptor.inputs.donInputs.showLow = false;
|
|
|
|
//
|
|
// XSTR ...
|
|
iDescriptor.inputs.strInputs.showTrends = false;
|
|
iDescriptor.inputs.strInputs.fillTrends = false;
|
|
|
|
//
|
|
// Short MArket ...
|
|
iDescriptor.inputs.sMarketPeriod = NULL;
|
|
iDescriptor.inputs.sMarketMethod = X_PERIOD_AUTO;
|
|
|
|
//
|
|
// Medium Market ...
|
|
iDescriptor.inputs.mMarketPeriod = NULL;
|
|
iDescriptor.inputs.mMarketMethod = X_PERIOD_AUTO;
|
|
|
|
//
|
|
// Long Market ...
|
|
iDescriptor.inputs.lMarketPeriod = NULL;
|
|
iDescriptor.inputs.lMarketMethod = X_PERIOD_AUTO;
|
|
|
|
//
|
|
int fontSize = 12;
|
|
double fontAngel = 90;
|
|
string fontName = "Arial";
|
|
ENUM_ANCHOR_POINT fontAnchor = ANCHOR_LEFT_UPPER;
|
|
|
|
//
|
|
// Current Market ...
|
|
ConfigureCurrentMarketDrawSpecs(
|
|
//
|
|
iDescriptor,
|
|
//
|
|
"Current",
|
|
//
|
|
false, // Draw Labels ...
|
|
false, // Draw C Bar ...
|
|
false, // Draw P Bar ...
|
|
false, // Draw C Bar Mid Line ...
|
|
false, // Draw P Bar Mid Line ...
|
|
//
|
|
fontSize,
|
|
fontAngel,
|
|
fontName,
|
|
fontAnchor // ,
|
|
//
|
|
// cBarPrefix
|
|
// pBarPrefix
|
|
// openLabel
|
|
// closeLabel
|
|
// highLabel
|
|
// lowLabel
|
|
// midLineLabel
|
|
);
|
|
|
|
//
|
|
// Short Market ...
|
|
ConfigureShortMarketDrawSpecs(
|
|
//
|
|
iDescriptor,
|
|
//
|
|
iDescriptor.inputs.sMarketPeriod,
|
|
iDescriptor.inputs.sMarketMethod,
|
|
//
|
|
"Short",
|
|
//
|
|
false, // Draw Labels ...
|
|
false, // Draw C Bar ...
|
|
false, // Draw P Bar ...
|
|
false, // Draw C Bar Mid Line ...
|
|
false, // Draw P Bar Mid Line ...
|
|
//
|
|
fontSize,
|
|
fontAngel,
|
|
fontName,
|
|
fontAnchor // ,
|
|
//
|
|
// cBarPrefix
|
|
// pBarPrefix
|
|
// openLabel
|
|
// closeLabel
|
|
// highLabel
|
|
// lowLabel
|
|
// midLineLabel
|
|
);
|
|
|
|
//
|
|
// Medium Market ...
|
|
ConfigureMediumMarketDrawSpecs(
|
|
//
|
|
iDescriptor,
|
|
//
|
|
iDescriptor.inputs.mMarketPeriod,
|
|
iDescriptor.inputs.mMarketMethod,
|
|
//
|
|
"Medium",
|
|
//
|
|
false, // Draw Labels ...
|
|
false, // Draw C Bar ...
|
|
false, // Draw P Bar ...
|
|
false, // Draw C Bar Mid Line ...
|
|
false, // Draw P Bar Mid Line ...
|
|
//
|
|
fontSize,
|
|
fontAngel,
|
|
fontName,
|
|
fontAnchor // ,
|
|
//
|
|
// cBarPrefix
|
|
// pBarPrefix
|
|
// openLabel
|
|
// closeLabel
|
|
// highLabel
|
|
// lowLabel
|
|
// midLineLabel
|
|
);
|
|
|
|
//
|
|
// Long Market ...
|
|
ConfigureLongMarketDrawSpecs(
|
|
//
|
|
iDescriptor,
|
|
//
|
|
iDescriptor.inputs.lMarketPeriod,
|
|
iDescriptor.inputs.lMarketMethod,
|
|
//
|
|
"Long",
|
|
//
|
|
false, // Draw Labels ...
|
|
false, // Draw C Bar ...
|
|
false, // Draw P Bar ...
|
|
false, // Draw C Bar Mid Line ...
|
|
false, // Draw P Bar Mid Line ...
|
|
//
|
|
fontSize,
|
|
fontAngel,
|
|
fontName,
|
|
fontAnchor // ,
|
|
//
|
|
// cBarPrefix
|
|
// pBarPrefix
|
|
// openLabel
|
|
// closeLabel
|
|
// highLabel
|
|
// lowLabel
|
|
// midLineLabel
|
|
);
|
|
|
|
//
|
|
// Hind Market ...
|
|
ConfigureHindMarketDrawSpecs(
|
|
//
|
|
iDescriptor,
|
|
//
|
|
iDescriptor.inputs.hMarketPeriod,
|
|
iDescriptor.inputs.hMarketMethod,
|
|
//
|
|
"Hind",
|
|
//
|
|
false, // Draw Labels ...
|
|
false, // Draw C Bar ...
|
|
false, // Draw P Bar ...
|
|
false, // Draw C Bar Mid Line ...
|
|
false, // Draw P Bar Mid Line ...
|
|
//
|
|
fontSize,
|
|
fontAngel,
|
|
fontName,
|
|
fontAnchor // ,
|
|
//
|
|
// cBarPrefix
|
|
// pBarPrefix
|
|
// openLabel
|
|
// closeLabel
|
|
// highLabel
|
|
// lowLabel
|
|
// midLineLabel
|
|
);
|
|
}
|
|
|
|
//
|
|
// Current ...
|
|
void ConfigureCurrentMarketDrawSpecs(
|
|
X121ProviderDescriptor &iDescriptor,
|
|
string prefix = "Current",
|
|
bool drawLabels = false,
|
|
bool drawCBar = false,
|
|
bool drawPBar = false,
|
|
bool drawCBarMid = false,
|
|
bool drawPBarMid = false,
|
|
int fontSize = 12,
|
|
double fontAngel = 90,
|
|
string fontName = "Arial",
|
|
ENUM_ANCHOR_POINT fontAnchor = ANCHOR_LEFT_UPPER,
|
|
string cBarPrefix = "C",
|
|
string pBarPrefix = "P",
|
|
string openLabel = "O",
|
|
string closeLabel = "C",
|
|
string highLabel = "H",
|
|
string lowLabel = "L",
|
|
string midLineLabel = "Mid" //
|
|
)
|
|
{
|
|
//
|
|
ConfigureMarketDrawSpecs(
|
|
iDescriptor.inputs.cMarketInputs,
|
|
//
|
|
drawLabels,
|
|
drawCBar,
|
|
drawPBar,
|
|
drawCBarMid,
|
|
drawPBarMid,
|
|
fontSize,
|
|
fontAngel,
|
|
fontName,
|
|
fontAnchor,
|
|
prefix,
|
|
cBarPrefix,
|
|
pBarPrefix,
|
|
openLabel,
|
|
closeLabel,
|
|
highLabel,
|
|
lowLabel,
|
|
midLineLabel //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Short ...
|
|
void ConfigureShortMarketDrawSpecs(
|
|
X121ProviderDescriptor &iDescriptor,
|
|
ENUM_TIMEFRAMES period = NULL,
|
|
ENUM_X_PERIOD_METHOD method = X_PERIOD_AUTO,
|
|
string prefix = "Short",
|
|
bool drawLabels = false,
|
|
bool drawCBar = false,
|
|
bool drawPBar = false,
|
|
bool drawCBarMid = false,
|
|
bool drawPBarMid = false,
|
|
int fontSize = 12,
|
|
double fontAngel = 90,
|
|
string fontName = "Arial",
|
|
ENUM_ANCHOR_POINT fontAnchor = ANCHOR_LEFT_UPPER,
|
|
string cBarPrefix = "C",
|
|
string pBarPrefix = "P",
|
|
string openLabel = "O",
|
|
string closeLabel = "C",
|
|
string highLabel = "H",
|
|
string lowLabel = "L",
|
|
string midLineLabel = "Mid" //
|
|
)
|
|
{
|
|
//
|
|
// Short Market ...
|
|
iDescriptor.inputs.sMarketPeriod = period;
|
|
iDescriptor.inputs.sMarketMethod = method;
|
|
|
|
//
|
|
ConfigureMarketDrawSpecs(
|
|
iDescriptor.inputs.sMarketInputs,
|
|
//
|
|
drawLabels,
|
|
drawCBar,
|
|
drawPBar,
|
|
drawCBarMid,
|
|
drawPBarMid,
|
|
fontSize,
|
|
fontAngel,
|
|
fontName,
|
|
fontAnchor,
|
|
prefix,
|
|
cBarPrefix,
|
|
pBarPrefix,
|
|
openLabel,
|
|
closeLabel,
|
|
highLabel,
|
|
lowLabel,
|
|
midLineLabel //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Medium ...
|
|
void ConfigureMediumMarketDrawSpecs(
|
|
X121ProviderDescriptor &iDescriptor,
|
|
ENUM_TIMEFRAMES period = NULL,
|
|
ENUM_X_PERIOD_METHOD method = X_PERIOD_AUTO,
|
|
string prefix = "Medium",
|
|
bool drawLabels = false,
|
|
bool drawCBar = false,
|
|
bool drawPBar = false,
|
|
bool drawCBarMid = false,
|
|
bool drawPBarMid = false,
|
|
int fontSize = 12,
|
|
double fontAngel = 90,
|
|
string fontName = "Arial",
|
|
ENUM_ANCHOR_POINT fontAnchor = ANCHOR_LEFT_UPPER,
|
|
string cBarPrefix = "C",
|
|
string pBarPrefix = "P",
|
|
string openLabel = "O",
|
|
string closeLabel = "C",
|
|
string highLabel = "H",
|
|
string lowLabel = "L",
|
|
string midLineLabel = "Mid" //
|
|
)
|
|
{
|
|
//
|
|
// Medium Market ...
|
|
iDescriptor.inputs.mMarketPeriod = period;
|
|
iDescriptor.inputs.mMarketMethod = method;
|
|
|
|
//
|
|
ConfigureMarketDrawSpecs(
|
|
iDescriptor.inputs.mMarketInputs,
|
|
//
|
|
drawLabels,
|
|
drawCBar,
|
|
drawPBar,
|
|
drawCBarMid,
|
|
drawPBarMid,
|
|
fontSize,
|
|
fontAngel,
|
|
fontName,
|
|
fontAnchor,
|
|
prefix,
|
|
cBarPrefix,
|
|
pBarPrefix,
|
|
openLabel,
|
|
closeLabel,
|
|
highLabel,
|
|
lowLabel,
|
|
midLineLabel //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Long ...
|
|
void ConfigureLongMarketDrawSpecs(
|
|
X121ProviderDescriptor &iDescriptor,
|
|
ENUM_TIMEFRAMES period = NULL,
|
|
ENUM_X_PERIOD_METHOD method = X_PERIOD_AUTO,
|
|
string prefix = "Long",
|
|
bool drawLabels = false,
|
|
bool drawCBar = false,
|
|
bool drawPBar = false,
|
|
bool drawCBarMid = false,
|
|
bool drawPBarMid = false,
|
|
int fontSize = 12,
|
|
double fontAngel = 90,
|
|
string fontName = "Arial",
|
|
ENUM_ANCHOR_POINT fontAnchor = ANCHOR_LEFT_UPPER,
|
|
string cBarPrefix = "C",
|
|
string pBarPrefix = "P",
|
|
string openLabel = "O",
|
|
string closeLabel = "C",
|
|
string highLabel = "H",
|
|
string lowLabel = "L",
|
|
string midLineLabel = "Mid" //
|
|
)
|
|
{
|
|
//
|
|
// Long Market ...
|
|
iDescriptor.inputs.lMarketPeriod = period;
|
|
iDescriptor.inputs.lMarketMethod = method;
|
|
|
|
//
|
|
ConfigureMarketDrawSpecs(
|
|
iDescriptor.inputs.lMarketInputs,
|
|
//
|
|
drawLabels,
|
|
drawCBar,
|
|
drawPBar,
|
|
drawCBarMid,
|
|
drawPBarMid,
|
|
fontSize,
|
|
fontAngel,
|
|
fontName,
|
|
fontAnchor,
|
|
prefix,
|
|
cBarPrefix,
|
|
pBarPrefix,
|
|
openLabel,
|
|
closeLabel,
|
|
highLabel,
|
|
lowLabel,
|
|
midLineLabel //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Hind ...
|
|
void ConfigureHindMarketDrawSpecs(
|
|
X121ProviderDescriptor &iDescriptor,
|
|
ENUM_TIMEFRAMES period = NULL,
|
|
ENUM_X_PERIOD_METHOD method = X_PERIOD_AUTO,
|
|
string prefix = "Hind",
|
|
bool drawLabels = false,
|
|
bool drawCBar = false,
|
|
bool drawPBar = false,
|
|
bool drawCBarMid = false,
|
|
bool drawPBarMid = false,
|
|
int fontSize = 12,
|
|
double fontAngel = 90,
|
|
string fontName = "Arial",
|
|
ENUM_ANCHOR_POINT fontAnchor = ANCHOR_LEFT_UPPER,
|
|
string cBarPrefix = "C",
|
|
string pBarPrefix = "P",
|
|
string openLabel = "O",
|
|
string closeLabel = "C",
|
|
string highLabel = "H",
|
|
string lowLabel = "L",
|
|
string midLineLabel = "Mid" //
|
|
)
|
|
{
|
|
//
|
|
// Hind Market ...
|
|
iDescriptor.inputs.hMarketPeriod = period;
|
|
iDescriptor.inputs.hMarketMethod = method;
|
|
|
|
//
|
|
ConfigureMarketDrawSpecs(
|
|
iDescriptor.inputs.hMarketInputs,
|
|
//
|
|
drawLabels,
|
|
drawCBar,
|
|
drawPBar,
|
|
drawCBarMid,
|
|
drawPBarMid,
|
|
fontSize,
|
|
fontAngel,
|
|
fontName,
|
|
fontAnchor,
|
|
prefix,
|
|
cBarPrefix,
|
|
pBarPrefix,
|
|
openLabel,
|
|
closeLabel,
|
|
highLabel,
|
|
lowLabel,
|
|
midLineLabel //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Configure Market ...
|
|
void ConfigureMarketDrawSpecs(
|
|
X121MCycleInputs &inputs,
|
|
bool drawLabels = false,
|
|
bool drawCBar = false,
|
|
bool drawPBar = false,
|
|
bool drawCBarMid = false,
|
|
bool drawPBarMid = false,
|
|
int fontSize = 12,
|
|
double fontAngel = 90,
|
|
string fontName = "Arial",
|
|
ENUM_ANCHOR_POINT fontAnchor = ANCHOR_LEFT_UPPER,
|
|
string prefix = "",
|
|
string cBarPrefix = "C",
|
|
string pBarPrefix = "P",
|
|
string openLabel = "O",
|
|
string closeLabel = "C",
|
|
string highLabel = "H",
|
|
string lowLabel = "L",
|
|
string midLineLabel = "Mid" //
|
|
)
|
|
{
|
|
inputs.drawLabels = drawLabels;
|
|
inputs.drawCBar = drawCBar;
|
|
inputs.drawPBar = drawPBar;
|
|
inputs.drawCBarMid = drawCBarMid;
|
|
inputs.drawPBarMid = drawPBarMid;
|
|
inputs.cBarDrawSpecs.Default();
|
|
inputs.pBarDrawSpecs.Default();
|
|
|
|
//
|
|
if (drawCBarMid)
|
|
{
|
|
inputs.cBarMidDrawSpecs.clr = clrYellow;
|
|
}
|
|
|
|
//
|
|
if (drawPBarMid)
|
|
{
|
|
inputs.pBarMidDrawSpecs.clr = clrYellow;
|
|
}
|
|
|
|
//
|
|
if (drawLabels)
|
|
{
|
|
//
|
|
string cBarStr = prefix + " " + cBarPrefix + " ";
|
|
string pBarStr = prefix + " " + pBarPrefix + " ";
|
|
|
|
//
|
|
if (drawCBar)
|
|
{
|
|
//
|
|
inputs.cBarDrawSpecs.openStyle.Label(
|
|
cBarStr + openLabel,
|
|
inputs.cBarDrawSpecs.openStyle.clr,
|
|
fontName,
|
|
fontSize,
|
|
fontAnchor,
|
|
fontAngel //
|
|
);
|
|
|
|
//
|
|
inputs.cBarDrawSpecs.highStyle.Label(
|
|
cBarStr + highLabel,
|
|
inputs.cBarDrawSpecs.highStyle.clr,
|
|
fontName,
|
|
fontSize,
|
|
fontAnchor,
|
|
fontAngel //
|
|
);
|
|
|
|
//
|
|
inputs.cBarDrawSpecs.closeStyle.Label(
|
|
cBarStr + closeLabel,
|
|
inputs.cBarDrawSpecs.closeStyle.clr,
|
|
fontName,
|
|
fontSize,
|
|
fontAnchor,
|
|
fontAngel //
|
|
);
|
|
|
|
//
|
|
inputs.cBarDrawSpecs.lowStyle.Label(
|
|
cBarStr + lowLabel,
|
|
inputs.cBarDrawSpecs.lowStyle.clr,
|
|
fontName,
|
|
fontSize,
|
|
fontAnchor,
|
|
fontAngel //
|
|
);
|
|
}
|
|
|
|
//
|
|
if (drawPBar)
|
|
{
|
|
//
|
|
inputs.pBarDrawSpecs.openStyle.Label(
|
|
pBarStr + openLabel,
|
|
inputs.pBarDrawSpecs.openStyle.clr,
|
|
fontName,
|
|
fontSize,
|
|
fontAnchor,
|
|
fontAngel //
|
|
);
|
|
|
|
//
|
|
inputs.pBarDrawSpecs.highStyle.Label(
|
|
pBarStr + highLabel,
|
|
inputs.pBarDrawSpecs.highStyle.clr,
|
|
fontName,
|
|
fontSize,
|
|
fontAnchor,
|
|
fontAngel //
|
|
);
|
|
|
|
//
|
|
inputs.pBarDrawSpecs.closeStyle.Label(
|
|
pBarStr + closeLabel,
|
|
inputs.pBarDrawSpecs.closeStyle.clr,
|
|
fontName,
|
|
fontSize,
|
|
fontAnchor,
|
|
fontAngel //
|
|
);
|
|
|
|
//
|
|
inputs.pBarDrawSpecs.lowStyle.Label(
|
|
pBarStr + lowLabel,
|
|
inputs.pBarDrawSpecs.lowStyle.clr,
|
|
fontName,
|
|
fontSize,
|
|
fontAnchor,
|
|
fontAngel //
|
|
);
|
|
}
|
|
|
|
//
|
|
if (drawCBarMid)
|
|
{
|
|
//
|
|
inputs.cBarMidDrawSpecs.Label(
|
|
cBarStr + midLineLabel,
|
|
clrYellow,
|
|
fontName,
|
|
fontSize,
|
|
fontAnchor,
|
|
fontAngel //
|
|
);
|
|
}
|
|
|
|
//
|
|
if (drawPBarMid)
|
|
{
|
|
//
|
|
inputs.pBarMidDrawSpecs.Label(
|
|
pBarStr + midLineLabel,
|
|
clrYellow,
|
|
fontName,
|
|
fontSize,
|
|
fontAnchor,
|
|
fontAngel //
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
void ApplyPreDefineConfigurations(X121ProviderDescriptor &iDescriptor)
|
|
{
|
|
//
|
|
bool isX786 = false;
|
|
bool isX121 = false;
|
|
bool isX110 = false;
|
|
|
|
//
|
|
if (isX786)
|
|
{
|
|
}
|
|
|
|
//
|
|
if (isX121)
|
|
{
|
|
}
|
|
|
|
//
|
|
if (isX110)
|
|
{
|
|
//
|
|
iDescriptor.inputs.strInputs.showTrends = isX110;
|
|
|
|
//
|
|
iDescriptor.inputs.mcInputs.showVerifierMa = isX110;
|
|
|
|
//
|
|
iDescriptor.inputs.ichInputs.showKumo = true; // isX110;
|
|
iDescriptor.inputs.ichInputs.showKijunSen = true; // isX110;
|
|
iDescriptor.inputs.ichInputs.showTenkanSen = true; // isX110;
|
|
iDescriptor.inputs.ichInputs.showSenkouSpanA = isX110;
|
|
iDescriptor.inputs.ichInputs.showSenkouSpanB = isX110;
|
|
|
|
//
|
|
iDescriptor.inputs.cheInputs.showLongExit1Line = isX110;
|
|
iDescriptor.inputs.cheInputs.showShortExit1Line = isX110;
|
|
iDescriptor.inputs.cheInputs.showLongExit2Line = isX110;
|
|
iDescriptor.inputs.cheInputs.showShortExit2Line = isX110;
|
|
|
|
//
|
|
iDescriptor.inputs.pvInputs.showPeaksAndVales = isX110;
|
|
iDescriptor.inputs.pvInputs.showFibo1Levels = isX110;
|
|
iDescriptor.inputs.pvInputs.showFibo2Levels = isX110;
|
|
iDescriptor.inputs.pvInputs.showFibo3Levels = isX110;
|
|
iDescriptor.inputs.pvInputs.showFibo4Levels = isX110;
|
|
iDescriptor.inputs.pvInputs.showFibo5Levels = isX110;
|
|
}
|
|
|
|
//
|
|
iDescriptor.inputs.ichInputs.showKumo = false; // isX110;
|
|
iDescriptor.inputs.ichInputs.showKijunSen = false; // isX110;
|
|
iDescriptor.inputs.ichInputs.showTenkanSen = false; // isX110;
|
|
}
|
|
|
|
// |