I have this strategy Flag showing total profits or losses of a strategy you test and it seems to work fine.
But what I would like to have is a similar strategy flag that shows the percentage of profits or losses for the test.
For a simple mind like mine, percentage made or lost would be better than the profit or loss number.
That way no matter what amount you start with, you will know the percentage it makes or loses over that time period?
The code for showing the amount made or loss with a strategy I have is below:
And what I would like is a flag that shows percentage made or loss.
Thanks,
#Script provided courtesy of Mbox56
#Hint: This script will display on the Chart the Profit or Loss of the Strategy being run. Select Dark or Light Theme by selecting Yes or No.
input show_label = yes;
input theme_color_dark = yes;
def FPL_val = Round(FPL(),2);
## DARK THEME
AddLabel(show_label and theme_color_dark and !IsNaN(FPL_val), "FPL: " + AsDollars(FPL_val), if FPL_val > 0.0 then Color.GREEN else
if FPL_val < 0.0 then color.RED else color.ORANGE);
## LIGHT THEME
AddLabel(show_label and !theme_color_dark and !IsNaN(FPL_val), "FPL: " + AsDollars(FPL_val), if FPL_val > 0.0 then Color.DARK_GREEN else if FPL_val < 0.0 then color.DARK_RED else color.DARK_ORANGE);
But what I would like to have is a similar strategy flag that shows the percentage of profits or losses for the test.
For a simple mind like mine, percentage made or lost would be better than the profit or loss number.
That way no matter what amount you start with, you will know the percentage it makes or loses over that time period?
The code for showing the amount made or loss with a strategy I have is below:
And what I would like is a flag that shows percentage made or loss.
Thanks,
#Script provided courtesy of Mbox56
#Hint: This script will display on the Chart the Profit or Loss of the Strategy being run. Select Dark or Light Theme by selecting Yes or No.
input show_label = yes;
input theme_color_dark = yes;
def FPL_val = Round(FPL(),2);
## DARK THEME
AddLabel(show_label and theme_color_dark and !IsNaN(FPL_val), "FPL: " + AsDollars(FPL_val), if FPL_val > 0.0 then Color.GREEN else
if FPL_val < 0.0 then color.RED else color.ORANGE);
## LIGHT THEME
AddLabel(show_label and !theme_color_dark and !IsNaN(FPL_val), "FPL: " + AsDollars(FPL_val), if FPL_val > 0.0 then Color.DARK_GREEN else if FPL_val < 0.0 then color.DARK_RED else color.DARK_ORANGE);