Custom Strat Labels and Forumla Fix

This commit is contained in:
HojouFotytu 2019-04-23 20:27:12 +09:00
parent abf42efbb7
commit 5c7de0d603
1 changed files with 57 additions and 49 deletions

View File

@ -21,12 +21,12 @@ namespace Core.ProfitTrailer
{ {
string result = strategyName; string result = strategyName;
string time = ""; string time = "";
int strategyLength = strategyName.Length-3;
string strategyLetter = strategyName.Remove(3, strategyLength);
string strategyNameOnly = strategyName.Remove(0, 3);
// strategy labels that are variable, so can't be caught by the switch statement // strategy labels that are variable, so can't be caught by the switch statement
if (result.Contains("FORMULA"))
{
result = "FORM";
}
if (result.Contains("REBUY")) if (result.Contains("REBUY"))
{ {
time = strategyName.Remove(0,14); time = strategyName.Remove(0,14);
@ -37,127 +37,127 @@ namespace Core.ProfitTrailer
result = "CHANGE"; result = "CHANGE";
} }
switch (strategyName.ToLower()) switch (strategyNameOnly.ToLower())
{ {
case "lowbb": case "lowbb":
result = "LBB"; result = String.Concat(strategyLetter, "LBB");
break; break;
case "highbb": case "highbb":
result = "HBB"; result = String.Concat(strategyLetter, "HBB");
break; break;
case "gain": case "gain":
result = "G"; result = String.Concat(strategyLetter, "GAIN");
break; break;
case "loss": case "loss":
result = "L"; result = String.Concat(strategyLetter, "LOSS");
break; break;
case "smagain": case "smagain":
result = "SG"; result = String.Concat(strategyLetter, "SG");
break; break;
case "emagain": case "emagain":
result = "EG"; result = String.Concat(strategyLetter, "EG");
break; break;
case "hmagain": case "hmagain":
result = "EG"; result = String.Concat(strategyLetter, "EG");
break; break;
case "dmagain": case "dmagain":
result = "EG"; result = String.Concat(strategyLetter, "EG");
break; break;
case "smaspread": case "smaspread":
result = "SS"; result = String.Concat(strategyLetter, "SS");
break; break;
case "emaspread": case "emaspread":
result = "ES"; result = String.Concat(strategyLetter, "ES");
break; break;
case "hmaspread": case "hmaspread":
result = "ES"; result = String.Concat(strategyLetter, "HES");
break; break;
case "dmaspread": case "dmaspread":
result = "ES"; result = String.Concat(strategyLetter, "DES");
break; break;
case "smacross": case "smacross":
result = "SC"; result = String.Concat(strategyLetter, "SC");
break; break;
case "emacross": case "emacross":
result = "EC"; result = String.Concat(strategyLetter, "EC");
break; break;
case "hmacross": case "hmacross":
result = "SC"; result = String.Concat(strategyLetter, "HSC");
break; break;
case "dmacross": case "dmacross":
result = "EC"; result = String.Concat(strategyLetter, "DEC");
break; break;
case "rsi": case "rsi":
result = "RSI"; result = String.Concat(strategyLetter, "RSI");
break; break;
case "stoch": case "stoch":
result = "STOCH"; result = String.Concat(strategyLetter, "STOCH");
break; break;
case "stochrsi": case "stochrsi":
result = "SRSI"; result = String.Concat(strategyLetter, "SRSI");
break; break;
case "stochrsik": case "stochrsik":
result = "SRSIK"; result = String.Concat(strategyLetter, "SRSIK");
break; break;
case "stochrsid": case "stochrsid":
result = "SRSID"; result = String.Concat(strategyLetter, "SRSID");
break; break;
case "stochrsicross": case "stochrsicross":
result = "SRSIC"; result = String.Concat(strategyLetter, "SRSIC");
break; break;
case "macd": case "macd":
result = "MACD"; result = String.Concat(strategyLetter, "MACD");
break; break;
case "obv": case "obv":
result = "OBV"; result = String.Concat(strategyLetter, "OBV");
break; break;
case "bbwidth": case "bbwidth":
result = "BBW"; result = String.Concat(strategyLetter, "BBW");
break; break;
case "pdhigh": case "pdhigh":
result = "PDH"; result = String.Concat(strategyLetter, "PDH");
break; break;
case "anderson": case "anderson":
result = "AND"; result = String.Concat(strategyLetter, "AND");
break; break;
case "som enabled": case "som enabled":
result = "SOM"; result = String.Concat(strategyLetter, "SOM");
break; break;
case "max buy times": case "max buy times":
result = "DCAMAX"; result = String.Concat(strategyLetter, "DCAMAX");
break; break;
case "max pairs": case "max pairs":
result = "PAIRS"; result = String.Concat(strategyLetter, "PAIRS");
break; break;
case "max spread": case "max spread":
result = "SPREAD"; result = String.Concat(strategyLetter, "SPREAD");
break; break;
case "price increase": case "price increase":
result = "PIN"; result = String.Concat(strategyLetter, "INC");
break; break;
case "min buy volume": case "min buy volume":
result = "VOL"; result = String.Concat(strategyLetter, "VOL");
break; break;
case "min buy balance": case "min buy balance":
result = "MIN"; result = String.Concat(strategyLetter, "MIN");
break; break;
case "coin age": case "coin age":
result = "AGE"; result = String.Concat(strategyLetter, "AGE");
break; break;
case "too new": case "too new":
result = "NEW"; result = String.Concat(strategyLetter, "NEW");
break; break;
case "blacklisted": case "blacklisted":
result = "BLACK"; result = String.Concat(strategyLetter, "BLACK");
break; break;
case "insufficient balance": case "insufficient balance":
result = "BAL"; result = String.Concat(strategyLetter, "BAL");
break; break;
case "max cost reached": case "max cost reached":
result = "COST"; result = String.Concat(strategyLetter, "COST");
break; break;
case "buy value below dust": case "buy value below dust":
result = "DUST"; result = String.Concat(strategyLetter, "DUST");
break; break;
default: default:
break; break;
@ -183,12 +183,13 @@ namespace Core.ProfitTrailer
{ {
bool result = false; bool result = false;
// Custom Strategy Labels in PT - add * // Strategy Labels in PT 2.3.3 -- all valid strategies are a letter followed by a colon.
if (strategyName.Contains("*")) if (strategyName.Contains(":"))
{ {
result = true; result = true;
} }
// Prior to PT 2.3.3
if (!checkForAnyInvalid) if (!checkForAnyInvalid)
{ {
switch (strategyName.ToLower()) switch (strategyName.ToLower())
@ -308,9 +309,16 @@ namespace Core.ProfitTrailer
isValidStrategy = StrategyHelper.IsValidStrategy(strategy.Name); isValidStrategy = StrategyHelper.IsValidStrategy(strategy.Name);
if (!isValidStrategy ) if (!isValidStrategy )
{
if (strategy.Name.Contains("FORMULA"))
{
strategyText += "<span class=\"label label-warning\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"AND/OR FORMULA\">FORM</span> ";
}
else
{ {
strategyText += "<span class=\"label label-warning\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"" + strategy.Name + "\">" + StrategyHelper.GetStrategyShortcut(strategy.Name, false) + "</span> "; strategyText += "<span class=\"label label-warning\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"" + strategy.Name + "\">" + StrategyHelper.GetStrategyShortcut(strategy.Name, false) + "</span> ";
} }
}
else else
{ {
strategyText += "<span class=\"label " + textClass + "\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"" + strategy.Name + "\">" + StrategyHelper.GetStrategyShortcut(strategy.Name, false) + "</span> "; strategyText += "<span class=\"label " + textClass + "\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"" + strategy.Name + "\">" + StrategyHelper.GetStrategyShortcut(strategy.Name, false) + "</span> ";