♥ 0 |
I wish to adapt this a relative volume indicator to a scan but am having trouble converting the plot of the indicator into a functional scan line. I wish to have the scan fire whenever volume in any of the first 3 bars is greater than average over the entire period in that specific bar available on 15 min scan which I believe is 20, so avg of that bar over last 19 days. Original indicator plots every bar but I only am interested in the first 3. In the simplest of terms I wish for the scan to fire whenever any of the first three 15 minute bars plot yellow on original indicator.
rec daycount = if barNumber() == 1 then 0 else if getDay() > getDay()[1] then 1 else 0; def istoday = if getLastDay() == getDay() then 1 else 0; def bar1volume = if istoday then 0 else if barcounter == 1 then volume else 0; def avgbar1 = TotalSum(bar1volume) / TotalSum(daycount); def AvgVol = if getDay() != getLastDay() then na else na; plot relavgvol=100; plot vol = ceil(volume/avgvol*100); zero.hideBubble(); I shortened the code above in order to fit post limit and for first 3 bars. Original code went up to 81 bars for each section of barxvolume, avgbarx, and barcounter Thank you very much!
Marked as spam
|
Please log in to post questions.