diff --git a/Experts/2MA_Cross.ex5 b/Experts/2MA_Cross.ex5 index 18aaaba..223ce14 100644 Binary files a/Experts/2MA_Cross.ex5 and b/Experts/2MA_Cross.ex5 differ diff --git a/Experts/2MA_Cross.mq5 b/Experts/2MA_Cross.mq5 index 0fc074a..3f675e7 100644 --- a/Experts/2MA_Cross.mq5 +++ b/Experts/2MA_Cross.mq5 @@ -1,17 +1,25 @@ #property copyright "Copyright 2017-2021, Artur Zas" +// GNU General Public License v3.0 -> https://github.com/9nix6/Median-and-Turbo-Renko-indicator-bundle/blob/master/LICENSE #property link "https://www.az-invest.eu" -#property version "1.13" -//#define ULTIMATE_RENKO_LICENSE // uncomment when used on Ultimate Renko chart from https://www.az-invest.eu/ultimate-renko-indicator-generator-for-metatrader-5 -//#define TICKCHART_LICENSE // uncomment when used on a Tick chart from https://www.az-invest.eu/Tick-chart-and-volume-chart-for-mt5 +#property version "1.16" +//#define ULTIMATE_RENKO_LICENSE // uncomment when used on Ultimate Renko chart from https://www.az-invest.eu/ultimate-renko-indicator-generator-for-metatrader-5 +//#define VOLUMECHART_LICENSE // uncomment when used on a Tick & Volume bar chart from https://www.az-invest.eu/Tick-chart-and-volume-chart-for-mt5 +//#define RANGEBAR_LICENSE // uncomment when used on a Tick & Volume bar chart from https://www.az-invest.eu/rangebars-for-metatrader-5 +//#define SECONDSCHART_LICENSE // uncomment when used on a Seconds TF bar chart from https://www.az-invest.eu/seconds-timeframe-chart-for-metatrader-5 +//#define LINEBREAKCHART_LICENSE // uncomment when used on a Line Break chart from https://www.az-invest.eu // -// Uncomment only ONE of the 3 directives listed below and recompile +// Uncomment only ONE of the 5 directives listed below and recompile // ----------------------------------------------------------------- // -// -//#define EA_ON_RANGE_BARS // Use EA on RangeBar chart -//#define EA_ON_RENKO // Use EA on Renko charts -#define EA_ON_XTICK_CHART // Use EA on XTick Chart +//#define EA_ON_RANGE_BARS // Use EA on RangeBar chart +//#define EA_ON_RENKO // Use EA on Renko charts +//#define EA_ON_XTICK_CHART // Use EA on XTick Chart (obsolete) +#define EA_ON_TICK_VOLUME_CHART // Use EA on Tick & Volume Bar Chart +//#define EA_ON_SECONDS_CHART // Use EA on Seconds Interval chart +//#define EA_ON_LINEBREAK_CHART // Use EA on LineBreak charts + +//#define DEVELOPER_VERSION // used when I develop ;) should always be commented out // Uncomment the directive below and recompile if EA is used with P-Renko BR Ultimate // ---------------------------------------------------------------------------------- @@ -38,6 +46,18 @@ #include TickChart *customBars = NULL; #endif +#ifdef EA_ON_TICK_VOLUME_CHART + #include + TickChart *customBars = NULL; +#endif +#ifdef EA_ON_SECONDS_CHART + #include + SecondsChart *customBars = NULL; +#endif +#ifdef EA_ON_LINEBREAK_CHART + #include + LineBreakChart *customBars = NULL; +#endif #include #include @@ -49,8 +69,10 @@ enum ENUM_TRADE_DIRECTION TRADE_DIRECTION_ALL = 1000, // Buy & Sell }; -// EA input parameters +#ifdef SHOW_INDICATOR_INPUTS + input group "EA parameters" +#endif input double Lots = 0.1; // Traded lots input uint StopLoss = 100; // Stop Loss (in points) input uint TakeProfit = 250; // Take profit (in points) @@ -99,6 +121,18 @@ ENUM_POSITION_TYPE validation; static int _MA1 = TICKCHART_MA1; static int _MA2 = TICKCHART_MA2; #endif +#ifdef EA_ON_TICK_VOLUME_CHART + static int _MA1 = VOLUMECHART_MA1; + static int _MA2 = VOLUMECHART_MA2; +#endif +#ifdef EA_ON_SECONDS_CHART + static int _MA1 = SECONDS_MA1; + static int _MA2 = SECONDS_MA2; +#endif +#ifdef EA_ON_LINEBREAK_CHART + static int _MA1 = LINEBREAK_MA1; + static int _MA2 = LINEBREAK_MA2; +#endif //+------------------------------------------------------------------+ //| Expert initialization function | @@ -116,6 +150,15 @@ int OnInit() #ifdef EA_ON_XTICK_CHART customBars = new TickChart(MQLInfoInteger((int)MQL5_TESTING) ? false : true); #endif + #ifdef EA_ON_TICK_VOLUME_CHART + customBars = new TickChart(MQLInfoInteger((int)MQL5_TESTING) ? false : true); + #endif + #ifdef EA_ON_SECONDS_CHART + customBars = new SecondsChart(MQLInfoInteger((int)MQL5_TESTING) ? false : true); + #endif + #ifdef EA_ON_LINEBREAK_CHART + customBars = new LineBreakChart(MQLInfoInteger((int)MQL5_TESTING) ? false : true); + #endif } customBars.Init(); diff --git a/Experts/PriceMA_Cross.ex5 b/Experts/PriceMA_Cross.ex5 index 05e9919..0f2bbae 100644 Binary files a/Experts/PriceMA_Cross.ex5 and b/Experts/PriceMA_Cross.ex5 differ diff --git a/Experts/PriceMA_Cross.mq5 b/Experts/PriceMA_Cross.mq5 index c9c16d2..62650b2 100644 --- a/Experts/PriceMA_Cross.mq5 +++ b/Experts/PriceMA_Cross.mq5 @@ -1,17 +1,26 @@ #property copyright "Copyright 2017-2021, Artur Zas" +// GNU General Public License v3.0 -> https://github.com/9nix6/Median-and-Turbo-Renko-indicator-bundle/blob/master/LICENSE #property link "https://www.az-invest.eu" -#property version "1.05" +#property version "1.08" + //#define ULTIMATE_RENKO_LICENSE // uncomment when used on Ultimate Renko chart from https://www.az-invest.eu/ultimate-renko-indicator-generator-for-metatrader-5 -//#define TICKCHART_LICENSE // uncomment when used on a Tick chart from https://www.az-invest.eu/Tick-chart-and-volume-chart-for-mt5 +//#define VOLUMECHART_LICENSE // uncomment when used on a Tick & Volume bar chart from https://www.az-invest.eu/Tick-chart-and-volume-chart-for-mt5 +//#define RANGEBAR_LICENSE // uncomment when used on a Tick & Volume bar chart from https://www.az-invest.eu/rangebars-for-metatrader-5 +//#define SECONDSCHART_LICENSE // uncomment when used on a Seconds TF bar chart from https://www.az-invest.eu/seconds-timeframe-chart-for-metatrader-5 +//#define LINEBREAKCHART_LICENSE // uncomment when used on a Line Break chart from https://www.az-invest.eu // -// Uncomment only ONE of the 3 directives listed below and recompile +// Uncomment only ONE of the 5 directives listed below and recompile // ----------------------------------------------------------------- // -// -//#define EA_ON_RANGE_BARS // Use EA on RangeBar chart -//#define EA_ON_RENKO // Use EA on Renko charts -#define EA_ON_XTICK_CHART // Use EA on XTick Chart +//#define EA_ON_RANGE_BARS // Use EA on RangeBar chart +//#define EA_ON_RENKO // Use EA on Renko charts +//#define EA_ON_XTICK_CHART // Use EA on XTick Chart (obsolete) +#define EA_ON_TICK_VOLUME_CHART // Use EA on Tick & Volume Bar Chart +//#define EA_ON_SECONDS_CHART // Use EA on Seconds Interval chart +//#define EA_ON_LINEBREAK_CHART // Use EA on LineBreak charts + +//#define DEVELOPER_VERSION // used when I develop ;) should always be commented out // Uncomment the directive below and recompile if EA is used with P-Renko BR Ultimate // ---------------------------------------------------------------------------------- @@ -38,6 +47,18 @@ #include TickChart *customBars = NULL; #endif +#ifdef EA_ON_TICK_VOLUME_CHART + #include + TickChart *customBars = NULL; +#endif +#ifdef EA_ON_SECONDS_CHART + #include + SecondsChart *customBars = NULL; +#endif +#ifdef EA_ON_LINEBREAK_CHART + #include + LineBreakChart *customBars = NULL; +#endif #include #include @@ -49,8 +70,9 @@ enum ENUM_TRADE_DIRECTION TRADE_DIRECTION_ALL = 1000, // Buy & Sell }; -// EA input parameters - +#ifdef SHOW_INDICATOR_INPUTS + input group "EA parameters" +#endif input double Lots = 0.1; // Traded lots input uint StopLoss = 0; // Stop Loss input uint TakeProfit = 0; // Take profit @@ -103,6 +125,18 @@ ENUM_POSITION_TYPE validation; static int _MA1 = TICKCHART_MA1; static int _MA2 = TICKCHART_MA2; #endif +#ifdef EA_ON_TICK_VOLUME_CHART + static int _MA1 = VOLUMECHART_MA1; + static int _MA2 = VOLUMECHART_MA2; +#endif +#ifdef EA_ON_SECONDS_CHART + static int _MA1 = SECONDS_MA1; + static int _MA2 = SECONDS_MA2; +#endif +#ifdef EA_ON_LINEBREAK_CHART + static int _MA1 = LINEBREAK_MA1; + static int _MA2 = LINEBREAK_MA2; +#endif //+------------------------------------------------------------------+ //| Expert initialization function | @@ -120,6 +154,15 @@ int OnInit() #ifdef EA_ON_XTICK_CHART customBars = new TickChart(MQLInfoInteger((int)MQL5_TESTING) ? false : true); #endif + #ifdef EA_ON_TICK_VOLUME_CHART + customBars = new TickChart(MQLInfoInteger((int)MQL5_TESTING) ? false : true); + #endif + #ifdef EA_ON_SECONDS_CHART + customBars = new SecondsChart(MQLInfoInteger((int)MQL5_TESTING) ? false : true); + #endif + #ifdef EA_ON_LINEBREAK_CHART + customBars = new LineBreakChart(MQLInfoInteger((int)MQL5_TESTING) ? false : true); + #endif } customBars.Init(); diff --git a/Experts/TickChart_ExampleEA.ex5 b/Experts/TickChart_ExampleEA.ex5 new file mode 100644 index 0000000..a9971ce Binary files /dev/null and b/Experts/TickChart_ExampleEA.ex5 differ diff --git a/Experts/TickChart_ExampleEA.mq5 b/Experts/TickChart_ExampleEA.mq5 index 90e9c14..8d81e4d 100644 --- a/Experts/TickChart_ExampleEA.mq5 +++ b/Experts/TickChart_ExampleEA.mq5 @@ -20,7 +20,7 @@ input int InpRSIPeriod = 14; // RSI period // You need to include the TickChart.mqh header file // -#include +#include // // To use the TickChart indicator in your EA you need do instantiate the indicator class (TickChart) // and call the Init() and Deinit() methods in your EA's OnInit() and OnDeinit() functions. @@ -114,7 +114,7 @@ void OnTick() double MA1[]; // array to be filled by values of the first moving average double MA2[]; // array to be filled by values of the second moving average - if(tickChart.GetMA(TICKCHART_MA1, MA1, startAtBar, numberOfBars) && tickChart.GetMA(TICKCHART_MA2, MA2, startAtBar, numberOfBars)) + if(tickChart.GetMA(VOLUMECHART_MA1, MA1, startAtBar, numberOfBars) && tickChart.GetMA(VOLUMECHART_MA2, MA2, startAtBar, numberOfBars)) { // // Values are stored in the MA1 and MA2 arrays and are now ready for use diff --git a/Include/AZ-INVEST/CustomBarConfig.mqh b/Include/AZ-INVEST/CustomBarConfig.mqh index 633066d..9e028d4 100644 --- a/Include/AZ-INVEST/CustomBarConfig.mqh +++ b/Include/AZ-INVEST/CustomBarConfig.mqh @@ -1,17 +1,26 @@ +//#define DEVELOPER_VERSION +//#define DISPLAY_DEBUG_MSG #define MQL5_MARKET_VERSION +//#define P_RENKO_BR_PRO //#define ULTIMATE_RENKO_LICENSE -//#define RANGEBARS_LICENSE +//#define RANGEBAR_LICENSE //#define SECONDSCHART_LICENSE -#define TICKCHART_LICENSE -//#define VOLUMECHART_LICENSE +//#define TICKCHART_LICENSE +#define VOLUMECHART_LICENSE +//#define LINEBREAKCHART_LICENSE + +#ifdef P_RENKO_BR_PRO + #include + #define AZINVEST_CCI MedianRenkoIndicator +#endif #ifdef TICKCHART_LICENSE #include #define AZINVEST_CCI TickChartIndicator #endif -#ifdef RANGEBARS_LICENSE +#ifdef RANGEBAR_LICENSE #include #define AZINVEST_CCI RangeBarIndicator #endif @@ -31,6 +40,12 @@ #define AZINVEST_CCI VolumeChartIndicator #endif +#ifdef LINEBREAKCHART_LICENSE + #include + #define AZINVEST_CCI LineBreakChartIndicator +#endif + + #ifdef AZINVEST_CCI AZINVEST_CCI customChartIndicator; #endif diff --git a/Include/AZ-INVEST/SDK/CommonSettings.mqh b/Include/AZ-INVEST/SDK/CommonSettings.mqh index f96ecc5..9c400f7 100644 Binary files a/Include/AZ-INVEST/SDK/CommonSettings.mqh and b/Include/AZ-INVEST/SDK/CommonSettings.mqh differ diff --git a/Include/AZ-INVEST/SDK/CustomChartInputs.mqh b/Include/AZ-INVEST/SDK/CustomChartInputs.mqh index b96e006..e28699e 100644 Binary files a/Include/AZ-INVEST/SDK/CustomChartInputs.mqh and b/Include/AZ-INVEST/SDK/CustomChartInputs.mqh differ diff --git a/Include/AZ-INVEST/SDK/CustomChartSettingsBase.mqh b/Include/AZ-INVEST/SDK/CustomChartSettingsBase.mqh index 8357e91..3ab0686 100644 Binary files a/Include/AZ-INVEST/SDK/CustomChartSettingsBase.mqh and b/Include/AZ-INVEST/SDK/CustomChartSettingsBase.mqh differ diff --git a/Include/AZ-INVEST/SDK/IndicatorAccess.mqh b/Include/AZ-INVEST/SDK/IndicatorAccess.mqh deleted file mode 100644 index 26c3583..0000000 --- a/Include/AZ-INVEST/SDK/IndicatorAccess.mqh +++ /dev/null @@ -1,31 +0,0 @@ -class CIndicatorAccess -{ - private: - - public: - - void CIndicatorAccess(); - void ~CIndicatorAccess(); - - int Lowest(double &seriesArray[], int count=WHOLE_ARRAY, int start=0); - int Highest(double &seriesArray[], int count=WHOLE_ARRAY, int start=0); - -}; - -void CIndicatorAccess::CIndicatorAccess(void) -{ -} - -void CIndicatorAccess::~CIndicatorAccess(void) -{ -} - -int CIndicatorAccess::Lowest(double &seriesArray[], int count=WHOLE_ARRAY, int start=0) -{ - return ArrayMinimum(seriesArray, start, MathMin(count, ArraySize(seriesArray))); -} - -int CIndicatorAccess::Highest(double &seriesArray[], int count=WHOLE_ARRAY, int start=0) -{ - return ArrayMaximum(seriesArray, start, MathMin(count, ArraySize(seriesArray))); -} \ No newline at end of file diff --git a/Include/AZ-INVEST/SDK/TickCustomChartSettings.mqh b/Include/AZ-INVEST/SDK/TickCustomChartSettings.mqh deleted file mode 100644 index 55585fc..0000000 --- a/Include/AZ-INVEST/SDK/TickCustomChartSettings.mqh +++ /dev/null @@ -1,97 +0,0 @@ -#include - -#ifdef DEVELOPER_VERSION - #define CUSTOM_CHART_NAME "TickChart_TEST" -#else - #ifdef AMP_VERSION - #define CUSTOM_CHART_NAME "DTA Tickchart" - #else - #define CUSTOM_CHART_NAME "X Tick Chart" - #endif -#endif - -// -// Tick chart specific settings -// -#ifdef SHOW_INDICATOR_INPUTS - #ifdef MQL5_MARKET_DEMO // hardcoded values - - int barSizeInTicks = 900; // Ticks per bar - int showNumberOfDays = 7; // Show history for number of days - ENUM_BOOL resetOpenOnNewTradingDay = true; // Synchronize first bar's open on new day - - #else // user defined settings - - input int barSizeInTicks = 1000; // Ticks per bar - input int showNumberOfDays = 5; // Show history for number of days - input ENUM_BOOL resetOpenOnNewTradingDay = true; // Synchronize first bar's open on new day - - #endif -#else // don't SHOW_INDICATOR_INPUTS - int barSizeInTicks = 1000; // Ticks per bar - int showNumberOfDays = 5; // Show history for number of days - ENUM_BOOL resetOpenOnNewTradingDay = true; // Synchronize first bar's open on new day -#endif - -// -// Remaining settings are located in the include file below. -// These are common for all custom charts -// -#include - -struct TICKCHART_SETTINGS -{ - int barSizeInTicks; - int showNumberOfDays; - ENUM_BOOL resetOpenOnNewTradingDay; -}; - -class CTickCustomChartSettigns : public CCustomChartSettingsBase -{ - protected: - - TICKCHART_SETTINGS settings; - - public: - - CTickCustomChartSettigns(); - ~CTickCustomChartSettigns(); - - TICKCHART_SETTINGS GetTickChartSettings() { return this.settings; }; - - virtual void SetCustomChartSettings(); - virtual string GetSettingsFileName(); - virtual uint CustomChartSettingsToFile(int handle); - virtual uint CustomChartSettingsFromFile(int handle); -}; - -void CTickCustomChartSettigns::CTickCustomChartSettigns() -{ - settingsFileName = GetSettingsFileName(); -} - -void CTickCustomChartSettigns::~CTickCustomChartSettigns() -{ -} - -string CTickCustomChartSettigns::GetSettingsFileName() -{ - return CUSTOM_CHART_NAME+(string)ChartID()+".set"; -} - -uint CTickCustomChartSettigns::CustomChartSettingsToFile(int file_handle) -{ - return FileWriteStruct(file_handle,this.settings); -} - -uint CTickCustomChartSettigns::CustomChartSettingsFromFile(int file_handle) -{ - return FileReadStruct(file_handle,this.settings); -} - -void CTickCustomChartSettigns::SetCustomChartSettings() -{ - settings.barSizeInTicks = barSizeInTicks; - settings.showNumberOfDays = showNumberOfDays; - settings.resetOpenOnNewTradingDay = resetOpenOnNewTradingDay; -} diff --git a/Include/AZ-INVEST/SDK/TickChart.mqh b/Include/AZ-INVEST/SDK/VolumeBarChart.mqh similarity index 70% rename from Include/AZ-INVEST/SDK/TickChart.mqh rename to Include/AZ-INVEST/SDK/VolumeBarChart.mqh index 5f74b4f..cce52b6 100644 --- a/Include/AZ-INVEST/SDK/TickChart.mqh +++ b/Include/AZ-INVEST/SDK/VolumeBarChart.mqh @@ -1,24 +1,47 @@ #property copyright "Copyright 2018-2021, Level Up Software" -#property link "http://www.az-invest.eu" +#property link "https://www.az-invest.eu" #ifdef DEVELOPER_VERSION - #define TICKCHART_INDICATOR_NAME "TickChart\\TickChart307" + #define VOLUMECHART_INDICATOR_NAME "VolumeTickChart\\TickChart3.16" #else #ifdef AMP_VERSION - #define TICKCHART_INDICATOR_NAME "DTA Tickchart" + #define VOLUMECHART_INDICATOR_NAME "DTA Tickchart" #else - #ifdef TICKCHART_LICENSE + #ifdef VOLUMECHART_LICENSE #ifdef MQL5_MARKET_VERSION - #define TICKCHART_INDICATOR_NAME "Market\\X Tick Chart" + #define VOLUMECHART_INDICATOR_NAME "Market\\X Tick Chart" #else - #define TICKCHART_INDICATOR_NAME "TickChart" + #define VOLUMECHART_INDICATOR_NAME "TickChart" #endif #else - #define TICKCHART_INDICATOR_NAME "Market\\X Tick Chart" + #define VOLUMECHART_INDICATOR_NAME "Market\\X Tick Chart" #endif #endif #endif +#define VOLUMECHART_OPEN 00 +#define VOLUMECHART_HIGH 01 +#define VOLUMECHART_LOW 02 +#define VOLUMECHART_CLOSE 03 +#define VOLUMECHART_BAR_COLOR 04 +#define VOLUMECHART_SESSION_RECT_H 05 +#define VOLUMECHART_SESSION_RECT_L 06 +#define VOLUMECHART_MA1 07 +#define VOLUMECHART_MA2 08 +#define VOLUMECHART_MA3 09 +#define VOLUMECHART_MA4 10 +#define VOLUMECHART_CHANNEL_HIGH 11 +#define VOLUMECHART_CHANNEL_MID 12 +#define VOLUMECHART_CHANNEL_LOW 13 +#define VOLUMECHART_BAR_OPEN_TIME 14 +#define VOLUMECHART_TICK_VOLUME 15 +#define VOLUMECHART_REAL_VOLUME 16 +#define VOLUMECHART_BUY_VOLUME 17 +#define VOLUMECHART_SELL_VOLUME 18 +#define VOLUMECHART_BUYSELL_VOLUME 19 +#define VOLUMECHART_RUNTIME_ID 20 + +// LEGACY CODE #define TICKCHART_OPEN 00 #define TICKCHART_HIGH 01 #define TICKCHART_LOW 02 @@ -40,25 +63,26 @@ #define TICKCHART_SELL_VOLUME 18 #define TICKCHART_BUYSELL_VOLUME 19 #define TICKCHART_RUNTIME_ID 20 +// -#include +#include class TickChart { private: - CTickCustomChartSettigns * tickChartSettings; + CVolumeCustomChartSettigns * volumeChartSettings; - int tickChartHandle; // tick chart indicator handle + int volumeChartHandle; // tick chart indicator handle string tickChartSymbol; - bool usedByIndicatorOnTickChart; + bool usedByIndicatorOnVolumeChart; datetime prevBarTime; public: TickChart(); - TickChart(bool isUsedByIndicatorOnTickChart); + TickChart(bool isUsedByIndicatorOnVolumeChart); TickChart(string symbol); ~TickChart(void); @@ -67,7 +91,7 @@ class TickChart bool Reload(); void ReleaseHandle(); - int GetHandle(void) { return tickChartHandle; }; + int GetHandle(void) { return volumeChartHandle; }; double GetRuntimeId(); bool IsNewBar(); @@ -94,42 +118,42 @@ class TickChart TickChart::TickChart(void) { - tickChartSettings = new CTickCustomChartSettigns(); - tickChartHandle = INVALID_HANDLE; + volumeChartSettings = new CVolumeCustomChartSettigns(); + volumeChartHandle = INVALID_HANDLE; tickChartSymbol = _Symbol; - usedByIndicatorOnTickChart = false; + usedByIndicatorOnVolumeChart = false; prevBarTime = 0; } -TickChart::TickChart(bool isUsedByIndicatorOnTickChart) +TickChart::TickChart(bool isUsedByIndicatorOnVolumeChart) { - tickChartSettings = new CTickCustomChartSettigns(); - tickChartHandle = INVALID_HANDLE; + volumeChartSettings = new CVolumeCustomChartSettigns(); + volumeChartHandle = INVALID_HANDLE; tickChartSymbol = _Symbol; - usedByIndicatorOnTickChart = isUsedByIndicatorOnTickChart; + usedByIndicatorOnVolumeChart = isUsedByIndicatorOnVolumeChart; prevBarTime = 0; } TickChart::TickChart(string symbol) { - tickChartSettings = new CTickCustomChartSettigns(); - tickChartHandle = INVALID_HANDLE; + volumeChartSettings = new CVolumeCustomChartSettigns(); + volumeChartHandle = INVALID_HANDLE; tickChartSymbol = symbol; - usedByIndicatorOnTickChart = false; + usedByIndicatorOnVolumeChart = false; prevBarTime = 0; } TickChart::~TickChart(void) { - if(tickChartSettings != NULL) - delete tickChartSettings; + if(volumeChartSettings != NULL) + delete volumeChartSettings; } void TickChart::ReleaseHandle() { - if(tickChartHandle != INVALID_HANDLE) + if(volumeChartHandle != INVALID_HANDLE) { - IndicatorRelease(tickChartHandle); + IndicatorRelease(volumeChartHandle); } } @@ -141,46 +165,46 @@ int TickChart::Init() { if(!MQLInfoInteger((int)MQL5_TESTING)) { - if(usedByIndicatorOnTickChart) + if(usedByIndicatorOnVolumeChart) { // // Indicator on Tick Chart uses the values of the TickChart for calculations // - IndicatorRelease(tickChartHandle); + IndicatorRelease(volumeChartHandle); - tickChartHandle = GetIndicatorHandle(); - return tickChartHandle; + volumeChartHandle = GetIndicatorHandle(); + return volumeChartHandle; } - if(!tickChartSettings.Load()) + if(!volumeChartSettings.Load()) { - if(tickChartHandle != INVALID_HANDLE) + if(volumeChartHandle != INVALID_HANDLE) { // could not read new settings - keep old settings - return tickChartHandle; + return volumeChartHandle; } else { - Print("Failed to load indicator settings - "+TICKCHART_INDICATOR_NAME+" not on chart"); + Print("Failed to load indicator settings - "+VOLUMECHART_INDICATOR_NAME+" not on chart"); return INVALID_HANDLE; } } - if(tickChartHandle != INVALID_HANDLE) + if(volumeChartHandle != INVALID_HANDLE) Deinit(); } else { - if(usedByIndicatorOnTickChart) + if(usedByIndicatorOnVolumeChart) { // // Indicator on Tick Chart uses the values of the TickChart for calculations // - tickChartHandle = GetIndicatorHandle(); - return tickChartHandle; + volumeChartHandle = GetIndicatorHandle(); + return volumeChartHandle; } else { @@ -188,74 +212,60 @@ int TickChart::Init() // // Load settings from EA inputs // - tickChartSettings.Load(); + volumeChartSettings.Load(); #endif } } - TICKCHART_SETTINGS s = tickChartSettings.GetTickChartSettings(); - CHART_INDICATOR_SETTINGS cis = tickChartSettings.GetChartIndicatorSettings(); + VOLUMECHART_SETTINGS s = volumeChartSettings.GetVolumeChartSettings(); + CHART_INDICATOR_SETTINGS cis = volumeChartSettings.GetChartIndicatorSettings(); - tickChartHandle = iCustom(this.tickChartSymbol, _Period, TICKCHART_INDICATOR_NAME, - s.barSizeInTicks, s.showNumberOfDays, s.resetOpenOnNewTradingDay, - TradingSessionTime, + volumeChartHandle = iCustom(this.tickChartSymbol, _Period, VOLUMECHART_INDICATOR_NAME, + s.barSizeInVolume, + s.algorithm, + s.showNumberOfDays, + s.resetOpenOnNewTradingDay, + "=", showPivots, pivotPointCalculationType, - RColor, - PColor, - SColor, - PDHColor, - PDLColor, - PDCColor, -#ifdef AMP_VERSION - NewBarAlert, - ReversalBarAlert, - MaCrossAlert, - UseAlertWindow, - UseSound, - UsePushNotifications, -#else + "=", AlertMeWhen, AlertNotificationType, -#endif - cis.MA1on, + "=", cis.MA1lineType, cis.MA1period, cis.MA1method, cis.MA1applyTo, cis.MA1shift, cis.MA1priceLabel, - cis.MA2on, cis.MA2lineType, cis.MA2period, cis.MA2method, cis.MA2applyTo, cis.MA2shift, cis.MA2priceLabel, - cis.MA3on, cis.MA3lineType, cis.MA3period, cis.MA3method, cis.MA3applyTo, cis.MA3shift, cis.MA3priceLabel, - cis.MA4on, cis.MA4lineType, cis.MA4period, cis.MA4method, cis.MA4applyTo, cis.MA4shift, cis.MA4priceLabel, + "=", cis.ShowChannel, cis.ChannelPeriod, cis.ChannelAtrPeriod, cis.ChannelAppliedPrice, cis.ChannelMultiplier, -#ifndef AMP_VERSION - cis.ChannelBandsDeviations, -#endif + cis.ChannelBandsDeviations, cis.ChannelPriceLabel, cis.ChannelMidPriceLabel, + "=", true); // used in EA // TopBottomPaddingPercentage, // showCurrentBarOpenTime, @@ -264,16 +274,16 @@ int TickChart::Init() // DisplayAsBarChart // ShiftObj; all letft at defaults - if(tickChartHandle == INVALID_HANDLE) + if(volumeChartHandle == INVALID_HANDLE) { - Print(TICKCHART_INDICATOR_NAME+" indicator init failed on error ",GetLastError()); + Print(VOLUMECHART_INDICATOR_NAME+" indicator init failed on error ",GetLastError()); } else { - Print(TICKCHART_INDICATOR_NAME+" indicator init OK"); + Print(VOLUMECHART_INDICATOR_NAME+" indicator init OK"); } - return tickChartHandle; + return volumeChartHandle; } // @@ -285,25 +295,25 @@ bool TickChart::Reload() bool actionNeeded = false; int temp = GetIndicatorHandle(); - if(temp != tickChartHandle) + if(temp != volumeChartHandle) { - IndicatorRelease(tickChartHandle); - tickChartHandle = INVALID_HANDLE; + IndicatorRelease(volumeChartHandle); + volumeChartHandle = INVALID_HANDLE; actionNeeded = true; } - if(tickChartSettings.Changed(GetRuntimeId())) + if(volumeChartSettings.Changed(GetRuntimeId())) { actionNeeded = true; } if(actionNeeded) { - if(tickChartHandle != INVALID_HANDLE) + if(volumeChartHandle != INVALID_HANDLE) { - IndicatorRelease(tickChartHandle); - tickChartHandle = INVALID_HANDLE; + IndicatorRelease(volumeChartHandle); + volumeChartHandle = INVALID_HANDLE; } if(Init() == INVALID_HANDLE) @@ -321,15 +331,15 @@ bool TickChart::Reload() void TickChart::Deinit() { - if(tickChartHandle == INVALID_HANDLE) + if(volumeChartHandle == INVALID_HANDLE) return; - if(!usedByIndicatorOnTickChart) + if(!usedByIndicatorOnVolumeChart) { - if(IndicatorRelease(tickChartHandle)) - Print(TICKCHART_INDICATOR_NAME+" indicator handle released"); + if(IndicatorRelease(volumeChartHandle)) + Print(VOLUMECHART_INDICATOR_NAME+" indicator handle released"); else - Print("Failed to release "+TICKCHART_INDICATOR_NAME+" indicator handle"); + Print("Failed to release "+VOLUMECHART_INDICATOR_NAME+" indicator handle"); } } @@ -382,21 +392,21 @@ bool TickChart::GetMqlRates(MqlRates &ratesInfoArray[], int start, int count) return false; - if(CopyBuffer(tickChartHandle,TICKCHART_OPEN,start,count,o) == -1) + if(CopyBuffer(volumeChartHandle,VOLUMECHART_OPEN,start,count,o) == -1) return false; - if(CopyBuffer(tickChartHandle,TICKCHART_LOW,start,count,l) == -1) + if(CopyBuffer(volumeChartHandle,VOLUMECHART_LOW,start,count,l) == -1) return false; - if(CopyBuffer(tickChartHandle,TICKCHART_HIGH,start,count,h) == -1) + if(CopyBuffer(volumeChartHandle,VOLUMECHART_HIGH,start,count,h) == -1) return false; - if(CopyBuffer(tickChartHandle,TICKCHART_CLOSE,start,count,c) == -1) + if(CopyBuffer(volumeChartHandle,VOLUMECHART_CLOSE,start,count,c) == -1) return false; - if(CopyBuffer(tickChartHandle,TICKCHART_BAR_OPEN_TIME,start,count,time) == -1) + if(CopyBuffer(volumeChartHandle,VOLUMECHART_BAR_OPEN_TIME,start,count,time) == -1) return false; - if(CopyBuffer(tickChartHandle,TICKCHART_BAR_COLOR,start,count,barColor) == -1) + if(CopyBuffer(volumeChartHandle,VOLUMECHART_BAR_COLOR,start,count,barColor) == -1) return false; - if(CopyBuffer(tickChartHandle,TICKCHART_TICK_VOLUME,start,count,tick_volume) == -1) + if(CopyBuffer(volumeChartHandle,VOLUMECHART_TICK_VOLUME,start,count,tick_volume) == -1) return false; - if(CopyBuffer(tickChartHandle,TICKCHART_REAL_VOLUME,start,count,real_volume) == -1) + if(CopyBuffer(volumeChartHandle,VOLUMECHART_REAL_VOLUME,start,count,real_volume) == -1) return false; if(ArrayResize(ratesInfoArray,count) == -1) @@ -437,11 +447,11 @@ bool TickChart::GetBuySellVolumeBreakdown(double &buy[], double &sell[], double if(ArrayResize(bs,count) == -1) return false; - if(CopyBuffer(tickChartHandle,TICKCHART_BUY_VOLUME,start,count,b) == -1) + if(CopyBuffer(volumeChartHandle,VOLUMECHART_BUY_VOLUME,start,count,b) == -1) return false; - if(CopyBuffer(tickChartHandle,TICKCHART_SELL_VOLUME,start,count,s) == -1) + if(CopyBuffer(volumeChartHandle,VOLUMECHART_SELL_VOLUME,start,count,s) == -1) return false; - if(CopyBuffer(tickChartHandle,TICKCHART_BUYSELL_VOLUME,start,count,bs) == -1) + if(CopyBuffer(volumeChartHandle,VOLUMECHART_BUYSELL_VOLUME,start,count,bs) == -1) return false; if(ArrayResize(buy,count) == -1) @@ -479,13 +489,13 @@ bool TickChart::GetMA(int MaBufferId, double &MA[], int start, int count) if(ArrayResize(MA, count) == -1) return false; - if(MaBufferId != TICKCHART_MA1 && MaBufferId != TICKCHART_MA2 && MaBufferId != TICKCHART_MA3 && MaBufferId != TICKCHART_MA4) + if(MaBufferId != VOLUMECHART_MA1 && MaBufferId != VOLUMECHART_MA2 && MaBufferId != VOLUMECHART_MA3 && MaBufferId != VOLUMECHART_MA4) { Print("Incorrect MA buffer id specified in "+__FUNCTION__); return false; } - if(CopyBuffer(tickChartHandle, MaBufferId,start,count,tempMA) == -1) + if(CopyBuffer(volumeChartHandle, MaBufferId,start,count,tempMA) == -1) { return false; } @@ -514,7 +524,7 @@ bool TickChart::GetMA1(double &MA[], int start, int count) if(ArrayResize(MA,count) == -1) return false; - if(CopyBuffer(tickChartHandle,TICKCHART_MA1,start,count,tempMA) == -1) + if(CopyBuffer(volumeChartHandle,VOLUMECHART_MA1,start,count,tempMA) == -1) return false; for(int i=0; i +#include -class TickChartIndicator +class VolumeChartIndicator { private: @@ -54,8 +54,8 @@ class TickChartIndicator bool IsNewBar; - TickChartIndicator(); - ~TickChartIndicator(); + VolumeChartIndicator(); + ~VolumeChartIndicator(); void SetUseAppliedPriceFlag(ENUM_APPLIED_PRICE _applied_price) { this.useAppliedPrice = true; this.applied_price = _applied_price; }; void SetGetVolumesFlag() { this.getVolumes = true; }; @@ -93,7 +93,7 @@ class TickChartIndicator datetime GetArrayValueDateTime(datetime &arr[], int index); }; -TickChartIndicator::TickChartIndicator(void) +VolumeChartIndicator::VolumeChartIndicator(void) { tickChart = new TickChart(UseOnTickChart); if(tickChart != NULL) @@ -109,7 +109,7 @@ TickChartIndicator::TickChartIndicator(void) prevRatesTotal = 0; } -TickChartIndicator::~TickChartIndicator(void) +VolumeChartIndicator::~VolumeChartIndicator(void) { if(tickChart != NULL) { @@ -118,7 +118,7 @@ TickChartIndicator::~TickChartIndicator(void) } } -bool TickChartIndicator::CheckStatus(void) +bool VolumeChartIndicator::CheckStatus(void) { int handle = tickChart.GetHandle(); if(handle == INVALID_HANDLE) @@ -127,7 +127,7 @@ bool TickChartIndicator::CheckStatus(void) return true; } -bool TickChartIndicator::NeedsReload(void) +bool VolumeChartIndicator::NeedsReload(void) { if(tickChart.Reload()) { @@ -138,11 +138,11 @@ bool TickChartIndicator::NeedsReload(void) return false; } -void TickChartIndicator::OnDeinit(const int reason) +void VolumeChartIndicator::OnDeinit(const int reason) { } -bool TickChartIndicator::OnCalculate(const int _rates_total,const int _prev_calculated, const datetime &_Time[], const double &_Close[]) +bool VolumeChartIndicator::OnCalculate(const int _rates_total,const int _prev_calculated, const datetime &_Time[], const double &_Close[]) { if(firstRun) { @@ -256,7 +256,7 @@ bool TickChartIndicator::OnCalculate(const int _rates_total,const int _prev_calc return true; } -bool TickChartIndicator::BufferSynchronizationCheck(const double &buffer[]) +bool VolumeChartIndicator::BufferSynchronizationCheck(const double &buffer[]) { if(ArraySize(buffer) != ArraySize(Close)) { @@ -269,7 +269,7 @@ bool TickChartIndicator::BufferSynchronizationCheck(const double &buffer[]) return true; } -int TickChartIndicator::GetOLHC(int start, int count) +int VolumeChartIndicator::GetOLHC(int start, int count) { if((start == 0) && (count == 0) && dataReady) { @@ -317,7 +317,7 @@ int TickChartIndicator::GetOLHC(int start, int count) } -void TickChartIndicator::OLHCShiftRight() +void VolumeChartIndicator::OLHCShiftRight() { int count = ArraySize(this.Open); @@ -376,7 +376,7 @@ void TickChartIndicator::OLHCShiftRight() } } -void TickChartIndicator::OLHCResize() +void VolumeChartIndicator::OLHCResize() { int count = ArraySize(this.Open); @@ -409,7 +409,7 @@ void TickChartIndicator::OLHCResize() OLHCShiftRight(); } -bool TickChartIndicator::Canvas_IsNewBar(const datetime &_Time[]) +bool VolumeChartIndicator::Canvas_IsNewBar(const datetime &_Time[]) { ArraySetAsSeries(_Time,true); datetime now = _Time[0]; @@ -424,7 +424,7 @@ bool TickChartIndicator::Canvas_IsNewBar(const datetime &_Time[]) return false; } -bool TickChartIndicator::Canvas_IsRatesTotalChanged(int ratesTotalNow) +bool VolumeChartIndicator::Canvas_IsRatesTotalChanged(int ratesTotalNow) { if(prevRatesTotal == 0) prevRatesTotal = ratesTotalNow; @@ -438,7 +438,7 @@ bool TickChartIndicator::Canvas_IsRatesTotalChanged(int ratesTotalNow) return false; } -int TickChartIndicator::Canvas_RatesTotalChangedBy(int ratesTotalNow) +int VolumeChartIndicator::Canvas_RatesTotalChangedBy(int ratesTotalNow) { int changedBy = 0; @@ -455,7 +455,7 @@ int TickChartIndicator::Canvas_RatesTotalChangedBy(int ratesTotalNow) return 0; } -int TickChartIndicator::GetOLHCForIndicatorCalc(double &o[],double &l[],double &h[],double &c[],datetime &t[], long &tickVolume[],long &realVolume[], double &buyVolume[], double &sellVolume[], double &buySellVolume[], int start, int count) +int VolumeChartIndicator::GetOLHCForIndicatorCalc(double &o[],double &l[],double &h[],double &c[],datetime &t[], long &tickVolume[],long &realVolume[], double &buyVolume[], double &sellVolume[], double &buySellVolume[], int start, int count) { int handle; double temp[]; @@ -499,7 +499,7 @@ int TickChartIndicator::GetOLHCForIndicatorCalc(double &o[],double &l[],double & if(handle == INVALID_HANDLE) return -1; - int __count = CopyBuffer(handle,TICKCHART_OPEN,start,count,temp); + int __count = CopyBuffer(handle,VOLUMECHART_OPEN,start,count,temp); if(__count == -1) { if(GetLastError() == ERR_INDICATOR_DATA_NOT_FOUND) @@ -542,22 +542,22 @@ int TickChartIndicator::GetOLHCForIndicatorCalc(double &o[],double &l[],double & ArrayCopy(o,temp,(count-__count),0); - if(CopyBuffer(handle,TICKCHART_LOW,start,__count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_LOW,start,__count,temp) == -1) return -1; ArrayCopy(l,temp,(count-__count),0); - if(CopyBuffer(handle,TICKCHART_HIGH,start,__count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_HIGH,start,__count,temp) == -1) return -1; ArrayCopy(h,temp,(count-__count),0); - if(CopyBuffer(handle,TICKCHART_CLOSE,start,__count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_CLOSE,start,__count,temp) == -1) return -1; ArrayCopy(c,temp,(count-__count),0); if(getTime) { - if(CopyBuffer(handle,TICKCHART_BAR_OPEN_TIME,start,__count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_BAR_OPEN_TIME,start,__count,temp) == -1) return -1; ArrayCopy(t,temp,(count-__count),0); @@ -565,32 +565,32 @@ int TickChartIndicator::GetOLHCForIndicatorCalc(double &o[],double &l[],double & if(getVolumes) { - if(CopyBuffer(handle,TICKCHART_TICK_VOLUME,start,__count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_TICK_VOLUME,start,__count,temp) == -1) return -1; ArrayCopy(tickVolume,temp,(count-__count),0); - if(CopyBuffer(handle,TICKCHART_REAL_VOLUME,start,__count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_REAL_VOLUME,start,__count,temp) == -1) return -1; ArrayCopy(realVolume,temp,(count-__count),0); } -#ifdef P_TICKCHART_BR - #ifdef P_TICKCHART_BR_PRO +#ifdef P_VOLUMECHART_BR + #ifdef P_VOLUMECHART_BR_PRO if(getVolumeBreakdown) { - if(CopyBuffer(handle,TICKCHART_BUY_VOLUME,start,__count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_BUY_VOLUME,start,__count,temp) == -1) return -1; ArrayCopy(buyVolume,temp,(count-__count),0); - if(CopyBuffer(handle,TICKCHART_SELL_VOLUME,start,__count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_SELL_VOLUME,start,__count,temp) == -1) return -1; ArrayCopy(sellVolume,temp,(count-__count),0); - if(CopyBuffer(handle,TICKCHART_BUYSELL_VOLUME,start,__count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_BUYSELL_VOLUME,start,__count,temp) == -1) return -1; ArrayCopy(buySellVolume,temp,(count-__count),0); @@ -600,17 +600,17 @@ int TickChartIndicator::GetOLHCForIndicatorCalc(double &o[],double &l[],double & #else if(getVolumeBreakdown) { - if(CopyBuffer(handle,TICKCHART_BUY_VOLUME,start,__count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_BUY_VOLUME,start,__count,temp) == -1) return -1; ArrayCopy(buyVolume,temp,(count-__count),0); - if(CopyBuffer(handle,TICKCHART_SELL_VOLUME,start,__count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_SELL_VOLUME,start,__count,temp) == -1) return -1; ArrayCopy(sellVolume,temp,(count-__count),0); - if(CopyBuffer(handle,TICKCHART_BUYSELL_VOLUME,start,__count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_BUYSELL_VOLUME,start,__count,temp) == -1) return -1; ArrayCopy(buySellVolume,temp,(count-__count),0); @@ -620,21 +620,21 @@ int TickChartIndicator::GetOLHCForIndicatorCalc(double &o[],double &l[],double & } else { - if(CopyBuffer(handle,TICKCHART_OPEN,start,count,o) == -1) + if(CopyBuffer(handle,VOLUMECHART_OPEN,start,count,o) == -1) return -1; - if(CopyBuffer(handle,TICKCHART_LOW,start,count,l) == -1) + if(CopyBuffer(handle,VOLUMECHART_LOW,start,count,l) == -1) return -1; - if(CopyBuffer(handle,TICKCHART_HIGH,start,count,h) == -1) + if(CopyBuffer(handle,VOLUMECHART_HIGH,start,count,h) == -1) return -1; - if(CopyBuffer(handle,TICKCHART_CLOSE,start,count,c) == -1) + if(CopyBuffer(handle,VOLUMECHART_CLOSE,start,count,c) == -1) return -1; if(getTime) { - if(CopyBuffer(handle,TICKCHART_BAR_OPEN_TIME,start,count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_BAR_OPEN_TIME,start,count,temp) == -1) return -1; ArrayCopy(t,temp); @@ -642,32 +642,32 @@ int TickChartIndicator::GetOLHCForIndicatorCalc(double &o[],double &l[],double & if(getVolumes) { - if(CopyBuffer(handle,TICKCHART_TICK_VOLUME,start,count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_TICK_VOLUME,start,count,temp) == -1) return -1; ArrayCopy(tickVolume,temp); - if(CopyBuffer(handle,TICKCHART_REAL_VOLUME,start,count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_REAL_VOLUME,start,count,temp) == -1) return -1; ArrayCopy(realVolume,temp); } -#ifdef P_TICKCHART_BR - #ifdef P_TICKCHART_BR_PRO +#ifdef P_VOLUMECHART_BR + #ifdef P_VOLUMECHART_BR_PRO if(getVolumeBreakdown) { - if(CopyBuffer(handle,TICKCHART_BUY_VOLUME,start,count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_BUY_VOLUME,start,count,temp) == -1) return -1; ArrayCopy(buyVolume,temp); - if(CopyBuffer(handle,TICKCHART_SELL_VOLUME,start,count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_SELL_VOLUME,start,count,temp) == -1) return -1; ArrayCopy(sellVolume,temp); - if(CopyBuffer(handle,TICKCHART_BUYSELL_VOLUME,start,count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_BUYSELL_VOLUME,start,count,temp) == -1) return -1; ArrayCopy(buySellVolume,temp); @@ -677,17 +677,17 @@ int TickChartIndicator::GetOLHCForIndicatorCalc(double &o[],double &l[],double & #else if(getVolumeBreakdown) { - if(CopyBuffer(handle,TICKCHART_BUY_VOLUME,start,count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_BUY_VOLUME,start,count,temp) == -1) return -1; ArrayCopy(buyVolume,temp); - if(CopyBuffer(handle,TICKCHART_SELL_VOLUME,start,count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_SELL_VOLUME,start,count,temp) == -1) return -1; ArrayCopy(sellVolume,temp); - if(CopyBuffer(handle,TICKCHART_BUYSELL_VOLUME,start,count,temp) == -1) + if(CopyBuffer(handle,VOLUMECHART_BUYSELL_VOLUME,start,count,temp) == -1) return -1; ArrayCopy(buySellVolume,temp); @@ -702,7 +702,7 @@ int TickChartIndicator::GetOLHCForIndicatorCalc(double &o[],double &l[],double & // Get "count" custom chart's MqlRates into "ratesInfoArray[]" array starting from "start" bar // -int TickChartIndicator::GetOLHCAndApplPriceForIndicatorCalc(double &o[],double &l[],double &h[],double &c[],datetime &t[],long &tickVolume[],long &realVolume[],double &buyVolume[], double &sellVolume[], double &buySellVolume[],double &price[],ENUM_APPLIED_PRICE _applied_price, int start, int count) +int VolumeChartIndicator::GetOLHCAndApplPriceForIndicatorCalc(double &o[],double &l[],double &h[],double &c[],datetime &t[],long &tickVolume[],long &realVolume[],double &buyVolume[], double &sellVolume[], double &buySellVolume[],double &price[],ENUM_APPLIED_PRICE _applied_price, int start, int count) { dataReady = true; @@ -745,7 +745,7 @@ int TickChartIndicator::GetOLHCAndApplPriceForIndicatorCalc(double &o[],double & // TFMigrate: // https://www.mql5.com/en/forum/2842#comment_39496 // -ENUM_TIMEFRAMES TickChartIndicator::TFMigrate(int tf) +ENUM_TIMEFRAMES VolumeChartIndicator::TFMigrate(int tf) { switch(tf) { @@ -781,7 +781,7 @@ ENUM_TIMEFRAMES TickChartIndicator::TFMigrate(int tf) } } -datetime TickChartIndicator::iTime(string symbol,int tf,int index) +datetime VolumeChartIndicator::iTime(string symbol,int tf,int index) { if(index < 0) { @@ -806,7 +806,7 @@ datetime TickChartIndicator::iTime(string symbol,int tf,int index) // Function used for calculating the Apllied Price based on Renko OLHC values // -double TickChartIndicator::CalcAppliedPrice(const MqlRates &_rates, ENUM_APPLIED_PRICE _applied_price) +double VolumeChartIndicator::CalcAppliedPrice(const MqlRates &_rates, ENUM_APPLIED_PRICE _applied_price) { if(_applied_price == PRICE_CLOSE) return _rates.close; @@ -826,7 +826,7 @@ double TickChartIndicator::CalcAppliedPrice(const MqlRates &_rates, ENUM_APPLIED return 0.0; } -double TickChartIndicator::CalcAppliedPrice(const double &o,const double &l,const double &h,const double &c, ENUM_APPLIED_PRICE _applied_price) +double VolumeChartIndicator::CalcAppliedPrice(const double &o,const double &l,const double &h,const double &c, ENUM_APPLIED_PRICE _applied_price) { if(_applied_price == PRICE_CLOSE) return c; @@ -846,7 +846,7 @@ double TickChartIndicator::CalcAppliedPrice(const double &o,const double &l,cons return 0.0; } -void TickChartIndicator::BufferShiftLeft(double &buffer[]) +void VolumeChartIndicator::BufferShiftLeft(double &buffer[]) { int size = ArraySize(buffer); @@ -856,7 +856,7 @@ void TickChartIndicator::BufferShiftLeft(double &buffer[]) } -long TickChartIndicator::GetArrayValueLong(long &arr[], int index) +long VolumeChartIndicator::GetArrayValueLong(long &arr[], int index) { int size = ArraySize(arr); if(index < size) @@ -869,7 +869,7 @@ long TickChartIndicator::GetArrayValueLong(long &arr[], int index) } } -double TickChartIndicator::GetArrayValueDouble(double &arr[], int index) +double VolumeChartIndicator::GetArrayValueDouble(double &arr[], int index) { int size = ArraySize(arr); if(index < size) @@ -882,7 +882,7 @@ double TickChartIndicator::GetArrayValueDouble(double &arr[], int index) } } -datetime TickChartIndicator::GetArrayValueDateTime(datetime &arr[], int index) +datetime VolumeChartIndicator::GetArrayValueDateTime(datetime &arr[], int index) { int size = ArraySize(arr); if(index < size) diff --git a/Include/AZ-INVEST/SDK/VolumeCustomChartSettings.mqh b/Include/AZ-INVEST/SDK/VolumeCustomChartSettings.mqh new file mode 100644 index 0000000..717f69c --- /dev/null +++ b/Include/AZ-INVEST/SDK/VolumeCustomChartSettings.mqh @@ -0,0 +1,111 @@ +#include + +#ifdef USE_LICENSE + #ifdef DEVELOPER_VERSION + #define CUSTOM_CHART_NAME "TickChart_TEST" + #else + #ifdef AMP_VERSION + #define CUSTOM_CHART_NAME "DTA Tickchart" + #else + #define CUSTOM_CHART_NAME "Volume bar chart" + #endif + #endif +#else + #ifdef VOLUMECHART_LICENSE + #define CUSTOM_CHART_NAME "Volume bar chart" + #else + #ifdef DEVELOPER_VERSION + #define CUSTOM_CHART_NAME "VolumeChart_TEST" + #else + #define CUSTOM_CHART_NAME "Volume bar chart" + #endif + #endif +#endif + +// +// Volume chart specific settings +// +#ifdef SHOW_INDICATOR_INPUTS + #ifdef MQL5_MARKET_DEMO // hardcoded values + + // FUTURE TODO IF NEEDED + + #else // user defined settings + + input int barSizeInVolume = 1000; // Bar size + input ENUM_VOLUME_CHART_CALCULATION algorithm = VOLUME_CHART_USE_TICKS; // Operating mode + input int showNumberOfDays = 5; // Show history for number of days + input ENUM_BOOL resetOpenOnNewTradingDay = true; // Synchronize first bar's open on new day + + #endif +#else // don't SHOW_INDICATOR_INPUTS + int barSizeInVolume = 1000; // Bar size + ENUM_VOLUME_CHART_CALCULATION algorithm = VOLUME_CHART_USE_TICKS; // Operating mode + int showNumberOfDays = 5; // Show history for number of days + ENUM_BOOL resetOpenOnNewTradingDay = true; // Synchronize first bar's open on new day +#endif + +// +// Remaining settings are located in the include file below. +// These are common for all custom charts +// +#include + +struct VOLUMECHART_SETTINGS +{ + int barSizeInVolume; + ENUM_VOLUME_CHART_CALCULATION algorithm; + int showNumberOfDays; + ENUM_BOOL resetOpenOnNewTradingDay; +}; + +class CVolumeCustomChartSettigns : public CCustomChartSettingsBase +{ + protected: + + VOLUMECHART_SETTINGS settings; + + public: + + CVolumeCustomChartSettigns(); + ~CVolumeCustomChartSettigns(); + + VOLUMECHART_SETTINGS GetVolumeChartSettings() { return this.settings; }; + + virtual void SetCustomChartSettings(); + virtual string GetSettingsFileName(); + virtual uint CustomChartSettingsToFile(int handle); + virtual uint CustomChartSettingsFromFile(int handle); +}; + +void CVolumeCustomChartSettigns::CVolumeCustomChartSettigns() +{ + settingsFileName = GetSettingsFileName(); +} + +void CVolumeCustomChartSettigns::~CVolumeCustomChartSettigns() +{ +} + +string CVolumeCustomChartSettigns::GetSettingsFileName() +{ + return CUSTOM_CHART_NAME+(string)ChartID()+".set"; +} + +uint CVolumeCustomChartSettigns::CustomChartSettingsToFile(int file_handle) +{ + return FileWriteStruct(file_handle,this.settings); +} + +uint CVolumeCustomChartSettigns::CustomChartSettingsFromFile(int file_handle) +{ + return FileReadStruct(file_handle,this.settings); +} + +void CVolumeCustomChartSettigns::SetCustomChartSettings() +{ + settings.barSizeInVolume = barSizeInVolume; + settings.algorithm = algorithm; + settings.showNumberOfDays = showNumberOfDays; + settings.resetOpenOnNewTradingDay = resetOpenOnNewTradingDay; +} diff --git a/Indicators/TickChart/ADX Cross Alerts.ex5 b/Indicators/TickChart/ADX Cross Alerts.ex5 index 39ee344..13b26da 100644 Binary files a/Indicators/TickChart/ADX Cross Alerts.ex5 and b/Indicators/TickChart/ADX Cross Alerts.ex5 differ diff --git a/Indicators/TickChart/ADX.ex5 b/Indicators/TickChart/ADX.ex5 index d404748..900407b 100644 Binary files a/Indicators/TickChart/ADX.ex5 and b/Indicators/TickChart/ADX.ex5 differ diff --git a/Indicators/TickChart/ATP.ex5 b/Indicators/TickChart/ATP.ex5 index 9b4dabb..3a053a0 100644 Binary files a/Indicators/TickChart/ATP.ex5 and b/Indicators/TickChart/ATP.ex5 differ diff --git a/Indicators/TickChart/ATR.ex5 b/Indicators/TickChart/ATR.ex5 index cd53bf0..a1bec18 100644 Binary files a/Indicators/TickChart/ATR.ex5 and b/Indicators/TickChart/ATR.ex5 differ diff --git a/Indicators/TickChart/AroonOscillator.ex5 b/Indicators/TickChart/AroonOscillator.ex5 index 44cf694..12526d4 100644 Binary files a/Indicators/TickChart/AroonOscillator.ex5 and b/Indicators/TickChart/AroonOscillator.ex5 differ diff --git a/Indicators/TickChart/AwesomeOscillator.ex5 b/Indicators/TickChart/AwesomeOscillator.ex5 index 18b10e0..6634a34 100644 Binary files a/Indicators/TickChart/AwesomeOscillator.ex5 and b/Indicators/TickChart/AwesomeOscillator.ex5 differ diff --git a/Indicators/TickChart/BB_MACD.ex5 b/Indicators/TickChart/BB_MACD.ex5 index 6ade5a1..6da987c 100644 Binary files a/Indicators/TickChart/BB_MACD.ex5 and b/Indicators/TickChart/BB_MACD.ex5 differ diff --git a/Indicators/TickChart/BollingerBandsMacd.ex5 b/Indicators/TickChart/BollingerBandsMacd.ex5 index 382624c..dd91399 100644 Binary files a/Indicators/TickChart/BollingerBandsMacd.ex5 and b/Indicators/TickChart/BollingerBandsMacd.ex5 differ diff --git a/Indicators/TickChart/CCI(alternative).ex5 b/Indicators/TickChart/CCI(alternative).ex5 index 0c550eb..d16ff8b 100644 Binary files a/Indicators/TickChart/CCI(alternative).ex5 and b/Indicators/TickChart/CCI(alternative).ex5 differ diff --git a/Indicators/TickChart/CCI.ex5 b/Indicators/TickChart/CCI.ex5 index ebe7c33..bceffc7 100644 Binary files a/Indicators/TickChart/CCI.ex5 and b/Indicators/TickChart/CCI.ex5 differ diff --git a/Indicators/TickChart/ChaikinVolatility.ex5 b/Indicators/TickChart/ChaikinVolatility.ex5 index 5b3cb1e..2cb0b4f 100644 Binary files a/Indicators/TickChart/ChaikinVolatility.ex5 and b/Indicators/TickChart/ChaikinVolatility.ex5 differ diff --git a/Indicators/TickChart/ColorHMA.ex5 b/Indicators/TickChart/ColorHMA.ex5 index cb2ed0d..5f850e8 100644 Binary files a/Indicators/TickChart/ColorHMA.ex5 and b/Indicators/TickChart/ColorHMA.ex5 differ diff --git a/Indicators/TickChart/DT_Oscillator.ex5 b/Indicators/TickChart/DT_Oscillator.ex5 index 88911f6..1c1aef0 100644 Binary files a/Indicators/TickChart/DT_Oscillator.ex5 and b/Indicators/TickChart/DT_Oscillator.ex5 differ diff --git a/Indicators/TickChart/DidiIndex.ex5 b/Indicators/TickChart/DidiIndex.ex5 new file mode 100644 index 0000000..2ae3d38 Binary files /dev/null and b/Indicators/TickChart/DidiIndex.ex5 differ diff --git a/Indicators/TickChart/DidiIndex.mq5 b/Indicators/TickChart/DidiIndex.mq5 new file mode 100644 index 0000000..adc51cb Binary files /dev/null and b/Indicators/TickChart/DidiIndex.mq5 differ diff --git a/Indicators/TickChart/DonchianChannel.ex5 b/Indicators/TickChart/DonchianChannel.ex5 index 16b8141..a0fb52e 100644 Binary files a/Indicators/TickChart/DonchianChannel.ex5 and b/Indicators/TickChart/DonchianChannel.ex5 differ diff --git a/Indicators/TickChart/Envelopes.ex5 b/Indicators/TickChart/Envelopes.ex5 index 43b9a84..8e1940f 100644 Binary files a/Indicators/TickChart/Envelopes.ex5 and b/Indicators/TickChart/Envelopes.ex5 differ diff --git a/Indicators/TickChart/Fractals.ex5 b/Indicators/TickChart/Fractals.ex5 index 70c9d5b..d080c97 100644 Binary files a/Indicators/TickChart/Fractals.ex5 and b/Indicators/TickChart/Fractals.ex5 differ diff --git a/Indicators/TickChart/GMMA.ex5 b/Indicators/TickChart/GMMA.ex5 index ced327e..cdc45be 100644 Binary files a/Indicators/TickChart/GMMA.ex5 and b/Indicators/TickChart/GMMA.ex5 differ diff --git a/Indicators/TickChart/Gann_Hi_Lo_Activator.ex5 b/Indicators/TickChart/Gann_Hi_Lo_Activator.ex5 index 9d034ac..c51d747 100644 Binary files a/Indicators/TickChart/Gann_Hi_Lo_Activator.ex5 and b/Indicators/TickChart/Gann_Hi_Lo_Activator.ex5 differ diff --git a/Indicators/TickChart/Gann_Hi_Lo_Activator_SSL.ex5 b/Indicators/TickChart/Gann_Hi_Lo_Activator_SSL.ex5 index 461f954..2604657 100644 Binary files a/Indicators/TickChart/Gann_Hi_Lo_Activator_SSL.ex5 and b/Indicators/TickChart/Gann_Hi_Lo_Activator_SSL.ex5 differ diff --git a/Indicators/TickChart/HA_Smoothed.ex5 b/Indicators/TickChart/HA_Smoothed.ex5 index 7141a7c..3655d69 100644 Binary files a/Indicators/TickChart/HA_Smoothed.ex5 and b/Indicators/TickChart/HA_Smoothed.ex5 differ diff --git a/Indicators/TickChart/HalfTrend.ex5 b/Indicators/TickChart/HalfTrend.ex5 index d847c1f..8856ae5 100644 Binary files a/Indicators/TickChart/HalfTrend.ex5 and b/Indicators/TickChart/HalfTrend.ex5 differ diff --git a/Indicators/TickChart/Heiken_Ashi.ex5 b/Indicators/TickChart/Heiken_Ashi.ex5 index 84084c2..dfae3ab 100644 Binary files a/Indicators/TickChart/Heiken_Ashi.ex5 and b/Indicators/TickChart/Heiken_Ashi.ex5 differ diff --git a/Indicators/TickChart/Ichimoku.ex5 b/Indicators/TickChart/Ichimoku.ex5 index abbe6b6..ab31a90 100644 Binary files a/Indicators/TickChart/Ichimoku.ex5 and b/Indicators/TickChart/Ichimoku.ex5 differ diff --git a/Indicators/TickChart/KeltnerChannel.ex5 b/Indicators/TickChart/KeltnerChannel.ex5 index 67faeac..2476650 100644 Binary files a/Indicators/TickChart/KeltnerChannel.ex5 and b/Indicators/TickChart/KeltnerChannel.ex5 differ diff --git a/Indicators/TickChart/LRMA.ex5 b/Indicators/TickChart/LRMA.ex5 index db18340..684323d 100644 Binary files a/Indicators/TickChart/LRMA.ex5 and b/Indicators/TickChart/LRMA.ex5 differ diff --git a/Indicators/TickChart/LinearRegression.ex5 b/Indicators/TickChart/LinearRegression.ex5 index 7209daa..a041caf 100644 Binary files a/Indicators/TickChart/LinearRegression.ex5 and b/Indicators/TickChart/LinearRegression.ex5 differ diff --git a/Indicators/TickChart/MA.ex5 b/Indicators/TickChart/MA.ex5 index 5c429d1..cf66c07 100644 Binary files a/Indicators/TickChart/MA.ex5 and b/Indicators/TickChart/MA.ex5 differ diff --git a/Indicators/TickChart/MACD.ex5 b/Indicators/TickChart/MACD.ex5 index 8cb7eab..e4d6493 100644 Binary files a/Indicators/TickChart/MACD.ex5 and b/Indicators/TickChart/MACD.ex5 differ diff --git a/Indicators/TickChart/MACD_Line.ex5 b/Indicators/TickChart/MACD_Line.ex5 index 693f600..9bf7fe1 100644 Binary files a/Indicators/TickChart/MACD_Line.ex5 and b/Indicators/TickChart/MACD_Line.ex5 differ diff --git a/Indicators/TickChart/Momentum.ex5 b/Indicators/TickChart/Momentum.ex5 index bd90370..a50fcab 100644 Binary files a/Indicators/TickChart/Momentum.ex5 and b/Indicators/TickChart/Momentum.ex5 differ diff --git a/Indicators/TickChart/NRTR.ex5 b/Indicators/TickChart/NRTR.ex5 index a03831f..d344b60 100644 Binary files a/Indicators/TickChart/NRTR.ex5 and b/Indicators/TickChart/NRTR.ex5 differ diff --git a/Indicators/TickChart/OBV.ex5 b/Indicators/TickChart/OBV.ex5 index aa7c265..d9d1db6 100644 Binary files a/Indicators/TickChart/OBV.ex5 and b/Indicators/TickChart/OBV.ex5 differ diff --git a/Indicators/TickChart/OscillatorCandles.ex5 b/Indicators/TickChart/OscillatorCandles.ex5 index 87cb212..a6b2ea4 100644 Binary files a/Indicators/TickChart/OscillatorCandles.ex5 and b/Indicators/TickChart/OscillatorCandles.ex5 differ diff --git a/Indicators/TickChart/ParabolicSAR.ex5 b/Indicators/TickChart/ParabolicSAR.ex5 index 9c07013..56c6103 100644 Binary files a/Indicators/TickChart/ParabolicSAR.ex5 and b/Indicators/TickChart/ParabolicSAR.ex5 differ diff --git a/Indicators/TickChart/ProVolume.ex5 b/Indicators/TickChart/ProVolume.ex5 index a4c289f..27c9154 100644 Binary files a/Indicators/TickChart/ProVolume.ex5 and b/Indicators/TickChart/ProVolume.ex5 differ diff --git a/Indicators/TickChart/QQE.ex5 b/Indicators/TickChart/QQE.ex5 index 9bc43d4..7cff49c 100644 Binary files a/Indicators/TickChart/QQE.ex5 and b/Indicators/TickChart/QQE.ex5 differ diff --git a/Indicators/TickChart/ROC.ex5 b/Indicators/TickChart/ROC.ex5 index a5773b0..c5f14b7 100644 Binary files a/Indicators/TickChart/ROC.ex5 and b/Indicators/TickChart/ROC.ex5 differ diff --git a/Indicators/TickChart/RSI.ex5 b/Indicators/TickChart/RSI.ex5 index 6446e21..267b1b1 100644 Binary files a/Indicators/TickChart/RSI.ex5 and b/Indicators/TickChart/RSI.ex5 differ diff --git a/Indicators/TickChart/RVI.ex5 b/Indicators/TickChart/RVI.ex5 index ed9cdf2..9eb8de1 100644 Binary files a/Indicators/TickChart/RVI.ex5 and b/Indicators/TickChart/RVI.ex5 differ diff --git a/Indicators/TickChart/StdDev.ex5 b/Indicators/TickChart/StdDev.ex5 index 0f9fe62..fef3243 100644 Binary files a/Indicators/TickChart/StdDev.ex5 and b/Indicators/TickChart/StdDev.ex5 differ diff --git a/Indicators/TickChart/Stochastic.ex5 b/Indicators/TickChart/Stochastic.ex5 index 37dde99..aaac200 100644 Binary files a/Indicators/TickChart/Stochastic.ex5 and b/Indicators/TickChart/Stochastic.ex5 differ diff --git a/Indicators/TickChart/T3.ex5 b/Indicators/TickChart/T3.ex5 index 4ba2f6d..339e6d7 100644 Binary files a/Indicators/TickChart/T3.ex5 and b/Indicators/TickChart/T3.ex5 differ diff --git a/Indicators/TickChart/TDI.ex5 b/Indicators/TickChart/TDI.ex5 index 9559afa..a94196d 100644 Binary files a/Indicators/TickChart/TDI.ex5 and b/Indicators/TickChart/TDI.ex5 differ diff --git a/Indicators/TickChart/TMA_CenteredBands.ex5 b/Indicators/TickChart/TMA_CenteredBands.ex5 index 8dbe419..ed4bd00 100644 Binary files a/Indicators/TickChart/TMA_CenteredBands.ex5 and b/Indicators/TickChart/TMA_CenteredBands.ex5 differ diff --git a/Indicators/TickChart/TRIX.ex5 b/Indicators/TickChart/TRIX.ex5 index b552809..3a1585c 100644 Binary files a/Indicators/TickChart/TRIX.ex5 and b/Indicators/TickChart/TRIX.ex5 differ diff --git a/Indicators/TickChart/TimeLine.ex5 b/Indicators/TickChart/TimeLine.ex5 index f3f82e7..0536b95 100644 Binary files a/Indicators/TickChart/TimeLine.ex5 and b/Indicators/TickChart/TimeLine.ex5 differ diff --git a/Indicators/TickChart/VEMA_Wilders_DMI.ex5 b/Indicators/TickChart/VEMA_Wilders_DMI.ex5 index 43d8f0e..29dc78f 100644 Binary files a/Indicators/TickChart/VEMA_Wilders_DMI.ex5 and b/Indicators/TickChart/VEMA_Wilders_DMI.ex5 differ diff --git a/Indicators/TickChart/VWAP_lite.ex5 b/Indicators/TickChart/VWAP_lite.ex5 index c986f13..32889f4 100644 Binary files a/Indicators/TickChart/VWAP_lite.ex5 and b/Indicators/TickChart/VWAP_lite.ex5 differ diff --git a/Indicators/TickChart/Volatility.ex5 b/Indicators/TickChart/Volatility.ex5 index 4d8f994..70f36df 100644 Binary files a/Indicators/TickChart/Volatility.ex5 and b/Indicators/TickChart/Volatility.ex5 differ diff --git a/Indicators/TickChart/Volume_Average_percent.ex5 b/Indicators/TickChart/Volume_Average_percent.ex5 new file mode 100644 index 0000000..85b64c2 Binary files /dev/null and b/Indicators/TickChart/Volume_Average_percent.ex5 differ diff --git a/Indicators/TickChart/Volume_Average_percent.mq5 b/Indicators/TickChart/Volume_Average_percent.mq5 new file mode 100644 index 0000000..f825d00 Binary files /dev/null and b/Indicators/TickChart/Volume_Average_percent.mq5 differ diff --git a/Indicators/TickChart/Volumes.ex5 b/Indicators/TickChart/Volumes.ex5 index 8b1c7ff..80f4c48 100644 Binary files a/Indicators/TickChart/Volumes.ex5 and b/Indicators/TickChart/Volumes.ex5 differ diff --git a/Indicators/TickChart/WPR.ex5 b/Indicators/TickChart/WPR.ex5 index 2b7020a..f2959d9 100644 Binary files a/Indicators/TickChart/WPR.ex5 and b/Indicators/TickChart/WPR.ex5 differ diff --git a/Indicators/TickChart/WeisWaves.ex5 b/Indicators/TickChart/WeisWaves.ex5 index 260e12e..6d515aa 100644 Binary files a/Indicators/TickChart/WeisWaves.ex5 and b/Indicators/TickChart/WeisWaves.ex5 differ diff --git a/Indicators/TickChart/ZigZag.ex5 b/Indicators/TickChart/ZigZag.ex5 index e7ab606..81ee7ef 100644 Binary files a/Indicators/TickChart/ZigZag.ex5 and b/Indicators/TickChart/ZigZag.ex5 differ