Help Plotting Price Value

MikelL

New member
I'm trying to take the previous close of a period such as 30 min, Hour, day, week, and month. and the ATR close of the period, add a percentage of the ATR value to the previous close price and plot a line over the next duration of the inputted period.

so the close price of hour 01:00:00 + 40% of the close value of the ATR of the hour = price plotted from 01:00:00-02:00:00 repeated

i hope that makes sense.

I also would like to turn off a line if i dont want it

i tried writing the code for it but im getting an error when i try and plot it

input sPeriod = {default 30 MIN, HOUR, DAY, WEEK, MONTH};
input F32 = {default “yes”, “no”};
input F40 = {default “yes”, “no”};
input length = 14;
input averageType = AverageType.WEIGHTED;

def ATR = MovingAverage(averageType, TrueRange(high, close, low), length);

def TWEN = ATR[1] * .32;
def TH1 = ATR[1] * .40;

def U32 = close[1] + TWEN;
def U40 = close[1] + TH1;

plot P32 = if !F32 then U32(period = sPeriod)[1] else Double.NaN;
plot P40 = if !F40 then U40(period = sPeriod)[1] else Double.NaN;

the error i keep getting is "no such function: U32" "no such function: U40"
If someone could help correct my code as well as help me add 30 min and 1 hour periods that would be so unbelievably helpful. THANK YOU!
 

Similar threads

Top