This my first attempt to write a code , but it seems not working . Could anyone from the expert coder help me to correct whatever is missing
@barbaros ;
what I'm trying to do a RVOL scan for first 5 mins candle to the sum of the average volume of the same candle from previous last 5 days
@barbaros ;
what I'm trying to do a RVOL scan for first 5 mins candle to the sum of the average volume of the same candle from previous last 5 days
Code:
# Define the start and end times for the time range
def startTime = 930;
def endTime = 935;
# Calculate the average volume for the first 5-minute bar after market open for the last numDays days
def numDays = 5;
DEF A= fold i = 1 to 5 with avgvol = 0 do avgvol +volume [i];
DEF AVGVOL5 = A / 5;
# Check if the current 5-minute bar volume is greater than the average volume
def condition = volume > avgVol5;
DEF RVOL = CONDITION >1;
# Plot the scan results on the chart
plot Scan = RVOL;