From c02f42e3eeb98a2476eeaa4cce419d466f21de16 Mon Sep 17 00:00:00 2001 From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com> Date: Mon, 4 Nov 2019 01:17:28 +0900 Subject: [PATCH] DCA Calculator bugfix --- Core/Main/PTMagic.cs | 18 +++++++++- Core/ProfitTrailer/StrategyHelper.cs | 51 ++++++++++++++++++++++++++++ Monitor/Pages/DCACalculator.cshtml | 4 +-- 3 files changed, 70 insertions(+), 3 deletions(-) diff --git a/Core/Main/PTMagic.cs b/Core/Main/PTMagic.cs index 2c8d2a1..be101bf 100644 --- a/Core/Main/PTMagic.cs +++ b/Core/Main/PTMagic.cs @@ -2313,10 +2313,26 @@ namespace Core.Main this.LastRuntimeSummary.DCATrigger = dcaDefaultTrigger; + + // Get PROFITPERCENTAGE strategy label + string ProfitPercentageLabel = ""; + for (char c = 'A'; c <= 'Z'; c++) + { + + string buyStrategyName = SettingsHandler.GetCurrentPropertyValue(dcaProperties, "DEFAULT_DCA_" + c + "_buy_strategy", ""); + if (buyStrategyName.Contains("PROFITPERCENTAGE")) + { + + ProfitPercentageLabel = "" + c; + } + } + + this.Log.DoLogInfo("DCA ProfitPercentage Label:" + ProfitPercentageLabel); + // Get configured DCA triggers for (int dca = 1; dca <= maxDCALevel; dca++) { - string dcaTriggerString = SettingsHandler.GetCurrentPropertyValue(dcaProperties, "buy_trigger_" + dca.ToString(), "DEFAULT_DCA_buy_trigger_" + dca.ToString()); + string dcaTriggerString = SettingsHandler.GetCurrentPropertyValue(dcaProperties, ProfitPercentageLabel + "buy_value_" + dca.ToString(), "DEFAULT_DCA_" + ProfitPercentageLabel + "_buy_value_" + dca.ToString()); if (!String.IsNullOrEmpty(dcaTriggerString)) { double dcaTrigger = SystemHelper.TextToDouble(dcaTriggerString, 0, "en-US"); diff --git a/Core/ProfitTrailer/StrategyHelper.cs b/Core/ProfitTrailer/StrategyHelper.cs index 7b0fbf1..285c89c 100644 --- a/Core/ProfitTrailer/StrategyHelper.cs +++ b/Core/ProfitTrailer/StrategyHelper.cs @@ -336,6 +336,45 @@ namespace Core.ProfitTrailer case "anderson": result = String.Concat(strategyLetter, "AND"); break; + case "pdlow": + result = String.Concat(strategyLetter, "PDL"); + break; + case "pdclose": + result = String.Concat(strategyLetter, "PDC"); + break; + case "signal": + result = String.Concat(strategyLetter, "SIG"); + break; + case "changepercentage": + result = String.Concat(strategyLetter, "CHGPCT"); + break; + case "profitpercentage": + result = String.Concat(strategyLetter, "PPCT"); + break; + case "lastdcabuy": + result = String.Concat(strategyLetter, "LASTDCA"); + break; + case "fixedprice": + result = String.Concat(strategyLetter, "FIXED"); + break; + case "lowatrband": + result = String.Concat(strategyLetter, "LATR"); + break; + case "highatrband": + result = String.Concat(strategyLetter, "HATR"); + break; + case "atrpercentage": + result = String.Concat(strategyLetter, "ATRPCT"); + break; + case "vwappercentage": + result = String.Concat(strategyLetter, "VWAP"); + break; + case "mvwappercentage": + result = String.Concat(strategyLetter, "MVWAP"); + break; + case "btcdominance": + result = String.Concat(strategyLetter, "BTCDOM"); + break; case "config som enabled": result = String.Concat(strategyLetter, "SOM"); break; @@ -445,7 +484,19 @@ namespace Core.ProfitTrailer case "dema": case "hma": case "pdhigh": + case "pdlow": + case "pdclose": case "signal": + case "changepercentage": + case "profitpercentage": + case "lastdcabuy": + case "fixedprice": + case "lowatrband": + case "highatrband": + case "atrpercentage": + case "vwappercentage": + case "mvwappercentage": + case "btcdominance": result = true; break; default: diff --git a/Monitor/Pages/DCACalculator.cshtml b/Monitor/Pages/DCACalculator.cshtml index 2d77cfb..a8ba2d1 100644 --- a/Monitor/Pages/DCACalculator.cshtml +++ b/Monitor/Pages/DCACalculator.cshtml @@ -18,7 +18,7 @@
- Use this calculator to help building a proper setup for your Profit Trailer settings for ALL_max_trading_pairs, ALL_@maxCostCaption.ToLower()_cost and DCA levels.
+ Use this calculator to help build a proper setup for your Profit Trailer settings for DEFAULT_max_trading_pairs, DEFAULT_@maxCostCaption.ToLower()_cost and DCA PROFITPERCENTAGE buy levels.
To do so enter your available balance and adjust the values to whatever you consider the best setting for your parameters.
If you are having problems understanding the different modes, please read this wiki article.