Hello. I have a number of indicators that I use on my charts to determine when to consider opening a position or closing a position. To unclutter the charts I define the variables and the condition that would render them positive or negative. Then I assign each a Score. If the condition is positive the Score is 1 else the Score is 0. A Final Score is then plotted. So far, I've been able to plot scores for 5 indicators. Assuming all conditions were positive the hypothetical plot Final Score code would look like this:
Plot FinalScore = (ScoreInd1) + (ScoreInd2) + (ScoreInd3) + (ScoreInd4) + (ScoreInd5);
The Final Score plot value would be 5
The code listed below for the variable AccDist is the one that I'm having a problem with. Would appreciate some help. Thanks!
Plot FinalScore = (ScoreInd1) + (ScoreInd2) + (ScoreInd3) + (ScoreInd4) + (ScoreInd5);
The Final Score plot value would be 5
The code listed below for the variable AccDist is the one that I'm having a problem with. Would appreciate some help. Thanks!
Code:
#
# TD Ameritrade IP Company, Inc. (c) 2009-2024
#
# MOD M 06/10/24
declare lower;
def AccDist = TotalSum(volume * CloseLocationValue());
def AccDist_average_length = 50;
def ScoreAD = if AccDist > AccDist_average_length then 1 else 0;
plot FinalScore = (ScoreAD);
FinalScore.AssignValueColor(if FinalScore > 0 then Color.Green else Color.RED);
End Script