GUIDO MENG
New member
Hi all!
I've been able to more or less accomplish this but using the getvalue function within a fold structure. The problem is that when in regular trading hours the getvalue function can fetch the desired value regardless of how many days it needs to look back to get it, whereas in the premarket session the getvalue function can only look back to the previous 12 days.
using an alternative to the getvalue function hasn't worked for me. So far I've tried this without success:
Any help will be greatly appreciated!!
I've been able to more or less accomplish this but using the getvalue function within a fold structure. The problem is that when in regular trading hours the getvalue function can fetch the desired value regardless of how many days it needs to look back to get it, whereas in the premarket session the getvalue function can only look back to the previous 12 days.
using an alternative to the getvalue function hasn't worked for me. So far I've tried this without success:
Code:
input length = 1;
def aggregationPeriod = AggregationPeriod.DAY;
######################################################################################################################################
rec Price = if !IsNaN(close) and IsNaN(close[-1])
then close
else Price[1]; # <--- First attempt at getting only the current (intraday )price to compare to prior days' highs
#def Price = if GetLastDay() == GetDay() and GetLastYear() == GetYear()
# then close
# else Double.NaN; # <--- Second attempt at getting only the current (intraday )price to compare to prior days' highs
def prev_Peak = if high(period = aggregationPeriod)[1] > Price
then Highest(high(period = aggregationPeriod)[1], length)
else prev_Peak;
plot prev_PeakLine = prev_Peak; # compare current intraday price 1 day ago high price, 2 days ago high price, 3 days ago high price, ....
# until a previous day's high is higher than current intraday price.
Last edited by a moderator: