Last active
April 24, 2021 03:15
-
-
Save arielmoraes/1350b0dea65a00e199ae999468cd3836 to your computer and use it in GitHub Desktop.
SkyStrategy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void UpdateStrategy() | |
{ | |
var newChange = (CurrentPrice - EnterPrice) / EnterPrice; | |
CurrentPercentChange = newChange * 100; | |
if (CurrentPercentChange >= MinWinPercentage) | |
{ | |
if (CurrentPercentChange > MaxWinPercentChange) | |
{ | |
MaxWinPercentChange = CurrentPercentChange; | |
Action = StrategyAction.RaisingSell; | |
} | |
else | |
{ | |
var winLossPercentage = MaxWinPercentChange * (MaxLossPercentageAfterWin / 100M); | |
var winLossDiff = MaxWinPercentChange - winLossPercentage; | |
if (CurrentPercentChange < winLossDiff) | |
{ | |
Action = StrategyAction.FallingSell; | |
} | |
else | |
{ | |
Action = StrategyAction.RaisingSell; | |
} | |
} | |
} | |
else if (CurrentPercentChange < MinWinPercentage) | |
{ | |
Action = StrategyAction.Wait; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment