Good afternoon....can you help me with this. I'm trying to have the volavg start to calculate at the start of the market open at 9:30am instead of the length which is set in the script as the last 20 bars. I don't want to use the premarket info in the volavg calculation. I'm trying to have the volavg calculate based on the times used in the input begin and till time.
Below is the script I'm using: You can see currently that the plot volavg is calculate based on the Average (volume, length). Is there a way I can change it?
declare lower;
declare Hide_On_Daily;
#Inputs
input begin = 0930;
input till = 1600;
def bars = if GetDay() == GetLastDay() and SecondsFromTime(begin) >= 0 and
SecondsTillTime(till) > 0
then bars[1] + 1
else bars[1];
def todayvol = if GetDay() == GetLastDay() and
SecondsFromTime(begin) >= 0 and SecondsTillTime(till) > 0
then todayvol[1] + volume
else todayvol[1];
def O = open;
def h = high;
def l = low;
def c = close;
def V = volume;
def buying = V*(C-L)/(H-L);
def selling = V*(H-C)/(H-L);
input price = close;
input fastLength = 5;
input slowLength = 13;
input long_average = 50;
input averageType = AverageType.EXPONENTIAL;
input length = 20;
plot VolAvg = Average(volume, length);
Below is the script I'm using: You can see currently that the plot volavg is calculate based on the Average (volume, length). Is there a way I can change it?
declare lower;
declare Hide_On_Daily;
#Inputs
input begin = 0930;
input till = 1600;
def bars = if GetDay() == GetLastDay() and SecondsFromTime(begin) >= 0 and
SecondsTillTime(till) > 0
then bars[1] + 1
else bars[1];
def todayvol = if GetDay() == GetLastDay() and
SecondsFromTime(begin) >= 0 and SecondsTillTime(till) > 0
then todayvol[1] + volume
else todayvol[1];
def O = open;
def h = high;
def l = low;
def c = close;
def V = volume;
def buying = V*(C-L)/(H-L);
def selling = V*(H-C)/(H-L);
input price = close;
input fastLength = 5;
input slowLength = 13;
input long_average = 50;
input averageType = AverageType.EXPONENTIAL;
input length = 20;
plot VolAvg = Average(volume, length);