I'm trying to make an indicator (Probably just a label output) that will give the average gain and average loss in price for a stock...
So like an average up day would be 3 points and an average down day would be 4 points, allowing you to look for strong up or down days.
This is what I have so far... except it counts the 0's in the average which greatly skews it. I'm not sure if there is something the else statement could be or if there is a way to make an average skip certain numbers, or a different way to grab gains/losses.
If this can't be done then I will probably just look for wider than average ATR, it just wont be as specific.
So like an average up day would be 3 points and an average down day would be 4 points, allowing you to look for strong up or down days.
This is what I have so far... except it counts the 0's in the average which greatly skews it. I'm not sure if there is something the else statement could be or if there is a way to make an average skip certain numbers, or a different way to grab gains/losses.
input length = 50;
input avg_type = averagetype.simple;
def gain = if close > close[1] then close - close[1] else 0;
def avggain = MovingAverage(avg_type,gain, length);
AddLabel(yes, Concat("Avg Gain: ", avggain), Color.GREEN);
If this can't be done then I will probably just look for wider than average ATR, it just wont be as specific.