Skip to content

Commit

Permalink
Adds WAD
Browse files Browse the repository at this point in the history
  • Loading branch information
kenorb committed Aug 28, 2023
1 parent fd13785 commit 49f9d77
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions Stg_Oscillator.mq5
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <EA31337-classes/Indicators/Indi_UltimateOscillator.mqh>
#include <EA31337-classes/Indicators/Indi_Volumes.mqh>
#include <EA31337-classes/Indicators/Indi_WPR.mqh>
#include <EA31337-classes/Indicators/Indi_WilliamsAD.mqh>
// #include <EA31337-classes/Indicators/Oscillator/includes.h>
#include <EA31337-classes/Strategy.mqh>

Expand Down
20 changes: 18 additions & 2 deletions Stg_Oscillator.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

enum ENUM_STG_OSCILLATOR_TYPE {
STG_OSCILLATOR_TYPE_0_NONE = 0, // (None)
STG_OSCILLATOR_TYPE_AC, // AC
STG_OSCILLATOR_TYPE_AD, // AD
STG_OSCILLATOR_TYPE_AC, // AC: Accelerator/Decelerator
STG_OSCILLATOR_TYPE_AD, // AD: Accumulation/Distribution
STG_OSCILLATOR_TYPE_AO, // AO: Awesome
STG_OSCILLATOR_TYPE_ATR, // ATR
STG_OSCILLATOR_TYPE_BEARS, // Bears Power
Expand All @@ -26,6 +26,7 @@ enum ENUM_STG_OSCILLATOR_TYPE {
STG_OSCILLATOR_TYPE_STOCH, // Stochastic
STG_OSCILLATOR_TYPE_TRIX, // TRIX: Triple Exponential Average
STG_OSCILLATOR_TYPE_UO, // UO: Ultimate Oscillator
STG_OSCILLATOR_TYPE_WAD, // WAD: Larry Williams' Accumulation/Distribution
STG_OSCILLATOR_TYPE_WPR, // WPR
STG_OSCILLATOR_TYPE_VOL, // VOL: Volumes
};
Expand Down Expand Up @@ -149,6 +150,9 @@ INPUT int Oscillator_Indi_UO_InpMiddleK = 2; //
INPUT int Oscillator_Indi_UO_InpSlowK = 1; // Slow K
INPUT int Oscillator_Indi_UO_Shift = 0; // Shift
INPUT ENUM_IDATA_SOURCE_TYPE Oscillator_Indi_UO_SourceType = IDATA_BUILTIN; // Source type
INPUT_GROUP("Oscillator strategy: Williams' Accumulation/Distribution oscillator params");
INPUT int Oscillator_Indi_WAD_Shift = 0; // Shift
INPUT ENUM_IDATA_SOURCE_TYPE Oscillator_Indi_WAD_SourceType = IDATA_BUILTIN; // Source type
INPUT_GROUP("Oscillator strategy: WPR oscillator params");
INPUT int Oscillator_Indi_WPR_Period = 18; // Period
INPUT int Oscillator_Indi_WPR_Shift = 0; // Shift
Expand Down Expand Up @@ -284,6 +288,10 @@ class Stg_Oscillator : public Strategy {
_result &= dynamic_cast<Indi_WPR *>(_indi).GetFlag(INDI_ENTRY_FLAG_IS_VALID, _shift) &&
dynamic_cast<Indi_WPR *>(_indi).GetFlag(INDI_ENTRY_FLAG_IS_VALID, _shift + 1);
break;
case STG_OSCILLATOR_TYPE_WAD:
_result &= dynamic_cast<Indi_WilliamsAD *>(_indi).GetFlag(INDI_ENTRY_FLAG_IS_VALID, _shift) &&
dynamic_cast<Indi_WilliamsAD *>(_indi).GetFlag(INDI_ENTRY_FLAG_IS_VALID, _shift + 1);
break;
case STG_OSCILLATOR_TYPE_VOL:
_result &= dynamic_cast<Indi_Volumes *>(_indi).GetFlag(INDI_ENTRY_FLAG_IS_VALID, _shift) &&
dynamic_cast<Indi_Volumes *>(_indi).GetFlag(INDI_ENTRY_FLAG_IS_VALID, _shift + 1);
Expand Down Expand Up @@ -476,6 +484,14 @@ class Stg_Oscillator : public Strategy {
SetIndicator(new Indi_UltimateOscillator(_indi_params), ::Oscillator_Type);
break;
}
case STG_OSCILLATOR_TYPE_WAD: // Williams' AD
{
IndiWilliamsADParams _indi_params(::Oscillator_Indi_WAD_Shift);
_indi_params.SetDataSourceType(Oscillator_Indi_WAD_SourceType);
_indi_params.SetTf(Get<ENUM_TIMEFRAMES>(STRAT_PARAM_TF));
SetIndicator(new Indi_WilliamsAD(_indi_params), ::Oscillator_Type);
break;
}
case STG_OSCILLATOR_TYPE_WPR: // WPR
{
IndiWPRParams _indi_params(::Oscillator_Indi_WPR_Period, ::Oscillator_Indi_WPR_Shift);
Expand Down

0 comments on commit 49f9d77

Please sign in to comment.