Hi
I’m just looking at the vwap and wanted to screen for crosses in last 10 bars say, so below I have combinations of codes commented out and a loop to check the last 10 bars shown – (been trying to see why its not working).
However the results when setting to 2 minutes dont reflect the desired outcome,
I’m assuming its to do with the VWAP calculation probably being calculated with too few candles, as the code whan on charts requires sufficient for it to start the calculation from the start of the day… I’m unable to get the platform VWAP up it only adds it to price, and preloadbars doesnt seem to be an option… So I’m limited with screeners but have functionality for many others, its just the VWAP calculation causing an issue…
Any pointers?
PRT V11 Premium
d = max(1, intradaybarindex)
VWAP = SUMMATION[d](volume*typicalprice)/SUMMATION[d](volume)
mybarcount=10
mycross=low<vwap and high>vwap //or low[1]<vwap and high[1]>vwap or low[2]<vwap and high[2]>vwap or low[3]<vwap and high[3]>vwap or low[4]<vwap and high[4]>vwap or low[5]<vwap and high[5]>vwap or low[6]<vwap and high[6]>vwap or low[7]<vwap and high[7]>vwap or low[8]<vwap and high[8]>vwap or low[9]<vwap and high[9]>vwap or low[10]<vwap and high[10]>vwap
Result1=0
For z= Mybarcount Downto 0 Do
result1=result1+(mycross[z])
Next
If result1>0 then
vwapcross=1
endif
//mycross=close crosses over vwap
//mycross2=close crosses under vwap
SCREENER(vwapcross)
Use brackets for selection:
SCREENER[vwapcross]
Parentheses are used for the sorting criterium (if any).
Ok sorted I think
Code below works at first glance.. just a logic issue so recapped and this seems to reflect a cross in last X number of bars
d = max(1, intradaybarindex)
VWAP = SUMMATION[d](volume*typicalprice)/SUMMATION[d](volume)
mybarcount=10
For z= Mybarcount Downto 0 Do
if close[z] crosses over vwap[z] or close[z] crosses under vwap[z] then
mycross=1
break
else
mycross=0
endif
Next
SCREENER[mycross]