fix leverage calculation
This commit is contained in:
parent
09099a47cd
commit
78e3681507
|
@ -147,22 +147,22 @@
|
||||||
buyDisabled = true;
|
buyDisabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if leverage, recalculate profit target
|
|
||||||
if (buyStrategyText.Contains("CROSSED"))
|
|
||||||
{
|
|
||||||
string leverageText = buyStrategyText.Remove(0, buyStrategyText.IndexOf("CROSSED")+9);
|
|
||||||
leverage = leverageText.Remove(leverageText.IndexOf(".0)"), leverageText.Length - leverageText.IndexOf(".0)"));
|
|
||||||
leverageValue = double.Parse(leverage);
|
|
||||||
}
|
|
||||||
if (buyStrategyText.Contains("ISOLATED"))
|
|
||||||
{
|
|
||||||
string leverageText = buyStrategyText.Remove(0, buyStrategyText.IndexOf("ISOLATED")+10);
|
|
||||||
leverage = leverageText.Remove(leverageText.IndexOf(".0)"), leverageText.Length - leverageText.IndexOf(".0)"));
|
|
||||||
leverageValue = double.Parse(leverage);
|
|
||||||
}
|
|
||||||
|
|
||||||
string sellStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Model.Summary, dcaLogEntry.SellStrategies, dcaLogEntry.SellStrategy, isSellStrategyTrue, isTrailingSellActive);
|
string sellStrategyText = Core.ProfitTrailer.StrategyHelper.GetStrategyText(Model.Summary, dcaLogEntry.SellStrategies, dcaLogEntry.SellStrategy, isSellStrategyTrue, isTrailingSellActive);
|
||||||
|
|
||||||
|
// if leverage, recalculate profit target
|
||||||
|
if (sellStrategyText.Contains("CROSSED"))
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
// Check for when PT loses the value of a pair
|
// Check for when PT loses the value of a pair
|
||||||
bool lostValue = false;
|
bool lostValue = false;
|
||||||
lostValue = (dcaLogEntry.TotalCost == 0.0) || (dcaLogEntry.AverageBuyPrice == 0.0);
|
lostValue = (dcaLogEntry.TotalCost == 0.0) || (dcaLogEntry.AverageBuyPrice == 0.0);
|
||||||
|
|
Loading…
Reference in New Issue