cleanup repo ...
This commit is contained in:
@@ -203,6 +203,7 @@ input int rsiLength = 14; // RSI Length
|
||||
input double rsiOBLevel = 70.0; // RSI OB Level
|
||||
input double rsiOSLevel = 30.0; // RSI OS Level
|
||||
input ENUM_APPLIED_PRICE rsiAppliedTo = PRICE_CLOSE; // RSI Applied To
|
||||
input int atrLength = 14; // ATR Length
|
||||
input int barsSignalLength = 14; // Bars Signal Length
|
||||
input ENUM_X_MA_METHOD barsSignalMethod = X_MA_MODE_EMA; // Bars Signalling Method
|
||||
input int deltaSignalLength = 14; // Delta Signal Length
|
||||
@@ -215,7 +216,7 @@ input ENUM_X_MA_METHOD hkSignalBarMethod = X_MA_MODE_EMA; // Hiken Ashi Sign
|
||||
//
|
||||
// Validating ...
|
||||
input group "Validating";
|
||||
input bool forceHasSwing = true; // Force Blocks to Have Swing
|
||||
input bool forceHasSwing = true; // Force Blocks to Have Swing
|
||||
input bool forceHasFLiquidity = false; // Force Blocks to Have Following Liquidity
|
||||
input bool forceHasRLiquidity = false; // Force Blocks to Have Reversal Liquidity
|
||||
input bool validateGapSequence = false; // Validate Block's Gap Sequence
|
||||
@@ -237,10 +238,10 @@ input bool filterBasedOnHKSignalBar = false; // Filter Based on Hiken Ashi Signa
|
||||
//
|
||||
// Alert ...
|
||||
input group "Alerts";
|
||||
input string alertPrefix = ""; // Alert Prefix
|
||||
input string alertPrefix = ""; // Alert Prefix
|
||||
input bool _logAlerts = true; // Log Alerts
|
||||
input bool _pushAlerts = false; // Push Alerts
|
||||
input bool _mailAlerts = false; // Mail Alerts
|
||||
input bool _pushAlerts = false; // Push Alerts
|
||||
input bool _mailAlerts = false; // Mail Alerts
|
||||
input bool _terminalAlerts = true; // Terminal Alerts
|
||||
|
||||
//
|
||||
@@ -264,6 +265,7 @@ input int startCalculationForLastBars = 1000; // Calculate Last n Bars
|
||||
input int sarArrowCode = 159; // Sar Arrow Code
|
||||
input int rrZoneLength = 7; // Draw Risk Reward Ratio till n Bars
|
||||
input int maxSignalR2R = 4; // Max Allowed Signal R2R
|
||||
input double slAtrMultiplier = 0; // Additional SL ATR Multiplier
|
||||
|
||||
//
|
||||
// Styling ...
|
||||
@@ -310,7 +312,7 @@ input ENUM_LINE_STYLE fvgStyle = STYLE_SOLID; // FVG Style
|
||||
#property indicator_chart_window
|
||||
|
||||
//
|
||||
#property indicator_buffers 31
|
||||
#property indicator_buffers 32
|
||||
#property indicator_plots 5
|
||||
|
||||
//
|
||||
@@ -516,6 +518,11 @@ double bullishVolumeSignalBuffer[];
|
||||
#define bearishVolumeSignalBufferIndex mLastBufferIndex + 12
|
||||
double bearishVolumeSignalBuffer[];
|
||||
|
||||
//
|
||||
// ATR ...
|
||||
#define atrBufferIndex mLastBufferIndex + 13
|
||||
double atrBuffer[];
|
||||
|
||||
//
|
||||
// Variables, Properties and etc ...
|
||||
|
||||
@@ -544,6 +551,7 @@ XCPOIDrawer *drawer;
|
||||
bool mEnableAlerts = false;
|
||||
XCBarAnalyser *barAnalyser;
|
||||
int mTrendPeriodLength = 0;
|
||||
int atrHandler = INVALID_HANDLE;
|
||||
int sarHandler = INVALID_HANDLE;
|
||||
int rsiHandler = INVALID_HANDLE;
|
||||
int adxHandler = INVALID_HANDLE;
|
||||
@@ -614,6 +622,19 @@ int OnInit()
|
||||
mTrendPeriodLength = PeriodSeconds(mTrendPeriod) / cPeriodSeconds;
|
||||
}
|
||||
|
||||
//
|
||||
// ATR ...
|
||||
atrHandler = iATR(
|
||||
_Symbol,
|
||||
_Period,
|
||||
atrLength //
|
||||
);
|
||||
bool isInited = atrHandler != INVALID_HANDLE;
|
||||
if (!isInited)
|
||||
{
|
||||
return INIT_FAILED;
|
||||
}
|
||||
|
||||
//
|
||||
// SAR ...
|
||||
sarHandler = iSAR(
|
||||
@@ -622,7 +643,7 @@ int OnInit()
|
||||
sarStep,
|
||||
sarMax //
|
||||
);
|
||||
bool isInited = sarHandler != INVALID_HANDLE;
|
||||
isInited = sarHandler != INVALID_HANDLE;
|
||||
if (!isInited)
|
||||
{
|
||||
return INIT_FAILED;
|
||||
@@ -742,6 +763,7 @@ void OnDeinit(const int reason)
|
||||
ShowBars();
|
||||
|
||||
//
|
||||
IndicatorRelease(atrHandler);
|
||||
IndicatorRelease(sarHandler);
|
||||
IndicatorRelease(rsiHandler);
|
||||
IndicatorRelease(adxHandler);
|
||||
@@ -791,6 +813,10 @@ int OnCalculate(
|
||||
//
|
||||
// Validate Calculated Bars ...
|
||||
|
||||
//
|
||||
// ATR ...
|
||||
int atrCalculatedBars = BarsCalculated(atrHandler);
|
||||
|
||||
//
|
||||
// SAR ...
|
||||
int sarCalculatedBars = BarsCalculated(sarHandler);
|
||||
@@ -809,6 +835,9 @@ int OnCalculate(
|
||||
|
||||
//
|
||||
bool isPassedRequiredCalculatedBars =
|
||||
//
|
||||
// ATR ...
|
||||
atrCalculatedBars >= maxLength &&
|
||||
//
|
||||
// SAR ...
|
||||
sarCalculatedBars >= maxLength &&
|
||||
@@ -836,6 +865,10 @@ int OnCalculate(
|
||||
//
|
||||
// Buffers Copy ...
|
||||
|
||||
//
|
||||
// ATR ...
|
||||
int copiedAtrs = CopyBuffer(atrHandler, MAIN_LINE, 0, limit, atrBuffer);
|
||||
|
||||
//
|
||||
// SAR ...
|
||||
int copiedSars = CopyBuffer(sarHandler, MAIN_LINE, 0, limit, sarBuffer);
|
||||
@@ -863,6 +896,9 @@ int OnCalculate(
|
||||
//
|
||||
// Validate Copied Items ...
|
||||
bool isPassedRequiredCopiedItems =
|
||||
//
|
||||
// ATR ...
|
||||
copiedAtrs >= limit &&
|
||||
//
|
||||
// SAR ...
|
||||
copiedSars >= limit &&
|
||||
@@ -920,6 +956,7 @@ bool ValidateInputs()
|
||||
sarMax > 0 &&
|
||||
sarStep > 0 &&
|
||||
adxLength > 0 &&
|
||||
atrLength > 0 &&
|
||||
rsiLength > 0 &&
|
||||
rsiOBLevel > 0 &&
|
||||
rsiOSLevel > 0 &&
|
||||
@@ -1159,6 +1196,11 @@ void DefineBuffers()
|
||||
//
|
||||
ArraySetAsSeries(bearishVolumeSignalBuffer, true);
|
||||
SetIndexBuffer(bearishVolumeSignalBufferIndex, bearishVolumeSignalBuffer, INDICATOR_CALCULATIONS);
|
||||
|
||||
//
|
||||
// ATR ...
|
||||
ArraySetAsSeries(atrBuffer, true);
|
||||
SetIndexBuffer(atrBufferIndex, atrBuffer, INDICATOR_CALCULATIONS);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2339,10 +2381,17 @@ void DetectTriggerBlock(
|
||||
targets //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
double iATR = atrBuffer[bar_index];
|
||||
double slAdditional = slAtrMultiplier * iATR;
|
||||
|
||||
//
|
||||
has = ToSignal(
|
||||
tb.trigger,
|
||||
tb.signal,
|
||||
targets //
|
||||
targets,
|
||||
slAdditional //
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user