DC+USA
Posts: 1 since Feb 2016
Thanks Given: 0
Thanks Received: 0
|
Hi All,
I'm brand new to coding and have put together a few lines of code below. I am trying to find the slope of a line if drawn from low of day price to low of 1 bar ago. Scan will be run on 3 min charts.
I'm getting an error - "Secondary period not allowed: Day" on def X1 line. Any input will be helpful.
Thanks,
JT
def Y1 = low;
def X1 = if secondsfromTime(930)<0 or secondsFromTime(930)>23400 then double.NaN else if low == low(period = AggregationPeriod.DAY) then secondsFromTime(930) else X1[1];
def Y2 = low from 1 bar ago;
def X2 = secondsFromTime(930);
def Slope = (Y2-Y1)/(X2-X1);
plot met = if slope>=0.5 and slope <=1 then 1 else 0;
|