Only Constants Expected Here


New member
I have a recursive variable that is working correctly but need to make it into a constant as a parameter for input into another function but getting "Only constants expected here". I've read something about using getvalue but no success. Any advice to get this to work?

Samus Aran

New member
Hi everyone, I keep getting this message: "Only constants expected here:" when I used the Highest() function. Could I be given insight on how to code my own Highest() function to be able to receive a dynamic length of the number of previous bars that I choose for.



New member
Curious if you ever figured out how to do this? I am trying to get the volume for the highest bar since market open... and I have the timeframe of market open and closed but not sure how to use Highest() for volume since market open.


New member
Hmm... That comes close in a way of plotting highest volume but problem I have is I am attempting to plot this every day as an individual plot so I can add AddOrder backtesting features etc... For some reason it plots great but only on the last day.


For anyone needing it BTW, here is the code to highest volume for the intraday of current day.

Any ideas on how to plot this each and every day? Seems similar to opening range code I have working but not for this plot.


input MarketBegin = 0930;
input MarketEnd = 1600;

def Range_Top = if SecondsFromTime(MarketEnd) >= 0 then Range_Top[1] else
 if SecondsFromTime(MarketBegin) == 0 then volume else
 if SecondsFromTime(MarketBegin) < 0 then Double.NaN else
 if SecondsFromTime(MarketBegin) > 0 and SecondsFromTime(MarketEnd) <= 0
 and volume > Range_Top[1] then volume else Range_Top[1];

Similar threads