marketTrendChanges = globalMarketTrendChanges[marketTrend.Name];
if (marketTrendChanges != null && marketTrendChanges.Count > 0)
{
-
-
double totalTrendChange = 0;
int trendChangeCount = marketTrendChanges.Count;
-
foreach (MarketTrendChange marketTrendChange in marketTrendChanges)
{
if (marketTrend.IgnoreOutlier != 0)
@@ -452,29 +411,23 @@ namespace Core.MarketAnalyzer
totalTrendChange += marketTrendChange.TrendChange;
}
}
-
double averageTrendChange = totalTrendChange / trendChangeCount;
-
result.Add(marketTrend.Name, averageTrendChange);
-
log.DoLogInfo("Built average market trend change '" + marketTrend.Name + "' (" + averageTrendChange.ToString("#,#0.00") + "% in " + marketTrend.TrendMinutes.ToString() + " minutes) for " + marketTrendChanges.Count.ToString() + " markets.");
}
else
{
result.Add(marketTrend.Name, 0);
-
log.DoLogWarn("No market trend changes found for '" + marketTrend.Name + "' - returning 0%");
}
}
else
{
result.Add(marketTrend.Name, 0);
-
log.DoLogWarn("Market trend '" + marketTrend.Name + "' not found in globalMarketTrendChanges[] - returning 0%");
}
}
}
-
return result;
}
}
From 9a38b7a19407b6d46878d4b34d12334ec082858e Mon Sep 17 00:00:00 2001
From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com>
Date: Mon, 1 Feb 2021 02:29:15 +0900
Subject: [PATCH 07/11] IgnoreOutlier
---
Core/DataObjects/PTMagicData.cs | 2 +-
Core/MarketAnalyzer/BaseAnalyzer.cs | 4 ++--
Monitor/Pages/SettingsAnalyzer.cshtml.cs | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Core/DataObjects/PTMagicData.cs b/Core/DataObjects/PTMagicData.cs
index 3a98e25..bee52ca 100644
--- a/Core/DataObjects/PTMagicData.cs
+++ b/Core/DataObjects/PTMagicData.cs
@@ -147,7 +147,7 @@ namespace Core.Main.DataObjects.PTMagicData
public string AllowedMarkets { get; set; } = "";
[DefaultValue(0)]
- public int IgnoreOutlier { get; set; } = 0;
+ public int TrendThreshold { get; set; } = 0;
[DefaultValue(true)]
public bool ExcludeMainCurrency { get; set; } = true;
diff --git a/Core/MarketAnalyzer/BaseAnalyzer.cs b/Core/MarketAnalyzer/BaseAnalyzer.cs
index 6bfaff2..b60d0f0 100644
--- a/Core/MarketAnalyzer/BaseAnalyzer.cs
+++ b/Core/MarketAnalyzer/BaseAnalyzer.cs
@@ -394,9 +394,9 @@ namespace Core.MarketAnalyzer
int trendChangeCount = marketTrendChanges.Count;
foreach (MarketTrendChange marketTrendChange in marketTrendChanges)
{
- if (marketTrend.IgnoreOutlier != 0)
+ if (marketTrend.TrendThreshold != 0)
{
- if ((marketTrendChange.TrendChange > marketTrend.IgnoreOutlier) || (marketTrendChange.TrendChange < (marketTrend.IgnoreOutlier * -1)))
+ if ((marketTrendChange.TrendChange > marketTrend.TrendThreshold) || (marketTrendChange.TrendChange < (marketTrend.TrendThreshold * -1)))
{
log.DoLogInfo("Market trend '" + marketTrend.Name + "' is ignoring " + marketTrendChange.Market + " for exceeding TrendThreshold.");
trendChangeCount += -1;
diff --git a/Monitor/Pages/SettingsAnalyzer.cshtml.cs b/Monitor/Pages/SettingsAnalyzer.cshtml.cs
index 86a09b4..0fd8bb9 100644
--- a/Monitor/Pages/SettingsAnalyzer.cshtml.cs
+++ b/Monitor/Pages/SettingsAnalyzer.cshtml.cs
@@ -77,7 +77,7 @@ namespace Monitor.Pages
mt.TrendCurrency = HttpContext.Request.Form[mtFormKey + "TrendCurrency"];
mt.IgnoredMarkets = HttpContext.Request.Form[mtFormKey + "IgnoredMarkets"];
mt.AllowedMarkets = HttpContext.Request.Form[mtFormKey + "AllowedMarkets"];
- mt.IgnoreOutlier = SystemHelper.TextToInteger(HttpContext.Request.Form[mtFormKey + "IgnoreOutlier"], mt.IgnoreOutlier);
+ mt.TrendThreshold = SystemHelper.TextToInteger(HttpContext.Request.Form[mtFormKey + "TrendThreshold"], mt.TrendThreshold);
mt.DisplayGraph = HttpContext.Request.Form[mtFormKey + "DisplayGraph"].Equals("on");
mt.ExcludeMainCurrency = HttpContext.Request.Form[mtFormKey + "ExcludeMainCurrency"].Equals("on");
From 78457fe7bef068ce9237517e9cf08fd617eaa0f8 Mon Sep 17 00:00:00 2001
From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com>
Date: Mon, 1 Feb 2021 15:08:33 +0900
Subject: [PATCH 08/11] Threshold on GUI
---
Core/ProfitTrailer/StrategyHelper.cs | 4 ++--
Monitor/Pages/MarketAnalyzer.cshtml | 10 +++++++++-
Monitor/Pages/_get/DashboardBottom.cshtml | 9 +++++++++
3 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/Core/ProfitTrailer/StrategyHelper.cs b/Core/ProfitTrailer/StrategyHelper.cs
index 7294cbd..e830c38 100644
--- a/Core/ProfitTrailer/StrategyHelper.cs
+++ b/Core/ProfitTrailer/StrategyHelper.cs
@@ -19,8 +19,8 @@ namespace Core.ProfitTrailer
string strategyLetter = "";
string strategyNameOnly = strategyName;
- // PT allows for "advanced_stats" to show details of the trailing logic.
- if (result.Contains("STATS"))
+ // PT allows for "advanced_stats" to show details of the trailing logic and dynamic formulas.
+ if (result.Contains("STATS") || result.Contains("DYN"))
{
result = "";
}
diff --git a/Monitor/Pages/MarketAnalyzer.cshtml b/Monitor/Pages/MarketAnalyzer.cshtml
index 1acb5f6..c7e7e4c 100644
--- a/Monitor/Pages/MarketAnalyzer.cshtml
+++ b/Monitor/Pages/MarketAnalyzer.cshtml
@@ -162,6 +162,7 @@ else
Name |
Markets |
Timeframe |
+ Threshold % |
Change |
@@ -182,7 +183,14 @@ else
@Core.Helper.SystemHelper.SplitCamelCase(marketTrend.Name) |
@marketCountString |
- @Core.Helper.SystemHelper.GetProperDurationTime(marketTrend.TrendMinutes * 60, false) |
+ @Core.Helper.SystemHelper.GetProperDurationTime(marketTrend.TrendMinutes * 60, false) | @if (marketTrend.TrendThreshold == 0)
+ {
+ -- |
+ }
+ else
+ {
+ @marketTrend.TrendThreshold |
+ }
@trendChangeOutput% |
}
diff --git a/Monitor/Pages/_get/DashboardBottom.cshtml b/Monitor/Pages/_get/DashboardBottom.cshtml
index a00f40e..af019f5 100644
--- a/Monitor/Pages/_get/DashboardBottom.cshtml
+++ b/Monitor/Pages/_get/DashboardBottom.cshtml
@@ -74,6 +74,7 @@
Name |
Markets |
Timeframe |
+ Threshold % |
Change |
@@ -95,6 +96,14 @@
@Core.Helper.SystemHelper.SplitCamelCase(marketTrend.Name) |
@marketCountString |
@Core.Helper.SystemHelper.GetProperDurationTime(marketTrend.TrendMinutes * 60, false) |
+ @if (marketTrend.TrendThreshold == 0)
+ {
+ -- |
+ }
+ else
+ {
+ @marketTrend.TrendThreshold |
+ }
@trendChangeOutput% |
}
From c76aa347905340209c686085eb4dfa8c4cc13181 Mon Sep 17 00:00:00 2001
From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com>
Date: Mon, 1 Feb 2021 17:28:22 +0900
Subject: [PATCH 09/11] health icon
---
Monitor/Pages/_get/DashboardBottom.cshtml | 2 +-
Monitor/Pages/_get/TickerWidgets.cshtml | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Monitor/Pages/_get/DashboardBottom.cshtml b/Monitor/Pages/_get/DashboardBottom.cshtml
index af019f5..6508be7 100644
--- a/Monitor/Pages/_get/DashboardBottom.cshtml
+++ b/Monitor/Pages/_get/DashboardBottom.cshtml
@@ -74,7 +74,7 @@
Name |
Markets |
Timeframe |
- Threshold % |
+ Threshold % |
Change |
diff --git a/Monitor/Pages/_get/TickerWidgets.cshtml b/Monitor/Pages/_get/TickerWidgets.cshtml
index e7fbae8..fa948f6 100644
--- a/Monitor/Pages/_get/TickerWidgets.cshtml
+++ b/Monitor/Pages/_get/TickerWidgets.cshtml
@@ -16,17 +16,17 @@
string iconColor = "text-success";
string ptMagicHealthIcon = "fa-heartbeat";
- string ptMagicHealthTooltip = "PT Magic is alive and healthy!";
- if (elapsedSecondsSinceRuntime > (intervalSeconds + intervalSeconds)) {
+ string ptMagicHealthTooltip = "PT Magic is alive and healthy!
Time elapsed since last run:"+ lastRuntime;
+ if (elapsedSecondsSinceRuntime > (intervalSeconds * 2)) {
ptMagicHealthIcon = "fa-exclamation-triangle";
- ptMagicHealthTooltip = "PT Magic seems to have problems, check the logs!";
+ ptMagicHealthTooltip = "PT Magic seems to have problems, check the logs! Time elapsed since last run: "+ Math.Round(elapsedSecondsSinceRuntime / 60, 1) + " mins.";
iconColor = "text-danger";
}
}
- @Core.Helper.SystemHelper.SplitCamelCase(Model.Summary.CurrentGlobalSetting.SettingName)
+ @Core.Helper.SystemHelper.SplitCamelCase(Model.Summary.CurrentGlobalSetting.SettingName)
From 929fb27f3e566a2841af05211e2ba53514d2d448 Mon Sep 17 00:00:00 2001
From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com>
Date: Mon, 1 Feb 2021 18:23:31 +0900
Subject: [PATCH 10/11] Target Profit
---
Monitor/Pages/_get/DashboardTop.cshtml | 46 +++++++++++++++-----------
1 file changed, 26 insertions(+), 20 deletions(-)
diff --git a/Monitor/Pages/_get/DashboardTop.cshtml b/Monitor/Pages/_get/DashboardTop.cshtml
index 22d3ff4..1fcb076 100644
--- a/Monitor/Pages/_get/DashboardTop.cshtml
+++ b/Monitor/Pages/_get/DashboardTop.cshtml
@@ -206,28 +206,34 @@
@Html.Raw(buyStrategyText) |
@Html.Raw(sellStrategyText) |
- @if (sellStrategyText.Contains("CROSSED"))
- // if leverage, recalculate profit target
+ @if (!sellStrategyText.Contains("WATCHMODE"))
{
- string leverageText = sellStrategyText.Remove(0, sellStrategyText.IndexOf("CROSSED")+9);
- leverage = leverageText.Remove(leverageText.IndexOf(".0)"), leverageText.Length - leverageText.IndexOf(".0)"));
- leverageValue = double.Parse(leverage);
- }
- @if (sellStrategyText.Contains("ISOLATED"))
- {
- string leverageText = sellStrategyText.Remove(0, sellStrategyText.IndexOf("ISOLATED")+10);
- leverage = leverageText.Remove(leverageText.IndexOf(".0)"), leverageText.Length - leverageText.IndexOf(".0)"));
- leverageValue = double.Parse(leverage);
- }
- @if (leverageValue == 1)
- {
- @Html.Raw(dcaLogEntry.TargetGainValue.HasValue ? dcaLogEntry.TargetGainValue.Value.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%" : " ") |
- }
- else
- {
- double leverageTargetGain = leverageValue * dcaLogEntry.TargetGainValue.Value;
- @Html.Raw(dcaLogEntry.TargetGainValue.HasValue ? leverageTargetGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%" : " ") |
+ @if (sellStrategyText.Contains("CROSSED"))
+ // if leverage, recalculate profit target
+ {
+ string leverageText = sellStrategyText.Remove(0, sellStrategyText.IndexOf("CROSSED")+9);
+ leverage = leverageText.Remove(leverageText.IndexOf(".0)"), leverageText.Length - leverageText.IndexOf(".0)"));
+ leverageValue = double.Parse(leverage);
+ }
+ @if (sellStrategyText.Contains("ISOLATED"))
+ {
+ string leverageText = sellStrategyText.Remove(0, sellStrategyText.IndexOf("ISOLATED")+10);
+ leverage = leverageText.Remove(leverageText.IndexOf(".0)"), leverageText.Length - leverageText.IndexOf(".0)"));
+ leverageValue = double.Parse(leverage);
+ }
+ @if (leverageValue == 1)
+ {
+ @Html.Raw(dcaLogEntry.TargetGainValue.HasValue ? dcaLogEntry.TargetGainValue.Value.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%" : " ") |
+ }
+ else
+ {
+ double leverageTargetGain = leverageValue * dcaLogEntry.TargetGainValue.Value;
+ @Html.Raw(dcaLogEntry.TargetGainValue.HasValue ? leverageTargetGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%" : " ") |
+ }
}
+
+
+
@if (!@lostValue)
{
@dcaLogEntry.ProfitPercent.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"))% |
From 5366f3831c3e31fa985ce113d06e3a250c2ee0bf Mon Sep 17 00:00:00 2001
From: HojouFotytu <36724681+HojouFotytu@users.noreply.github.com>
Date: Mon, 1 Feb 2021 19:09:31 +0900
Subject: [PATCH 11/11] missing profit column
---
Monitor/Pages/_get/DashboardTop.cshtml | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/Monitor/Pages/_get/DashboardTop.cshtml b/Monitor/Pages/_get/DashboardTop.cshtml
index 1fcb076..2a2fb03 100644
--- a/Monitor/Pages/_get/DashboardTop.cshtml
+++ b/Monitor/Pages/_get/DashboardTop.cshtml
@@ -227,10 +227,14 @@
}
else
{
- double leverageTargetGain = leverageValue * dcaLogEntry.TargetGainValue.Value;
- @Html.Raw(dcaLogEntry.TargetGainValue.HasValue ? leverageTargetGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%" : " ") |
+ double TargetGain = leverageValue * dcaLogEntry.TargetGainValue.Value;
+ @Html.Raw(dcaLogEntry.TargetGainValue.HasValue ? TargetGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) + "%" : " ") |
}
}
+ else
+ {
+ |
+ }