Hello and good day,

I have a trendline formula that I use as an intraday resistance
trendline, it produces a positively sloped trendline.
I would like to use this code to scan daily bars to find the lowest low
bar over a 50 day period. This lowest low bar will then produce a daily
resistance trendline as opposed to an intraday resistance trendline.  I
have not been able to figure out how to modify the start and endbars to
do this.
Any suggestions would be greatly appreciated.

Thank you,
Kind regards

Geary

here is the present code:

SetBarsRequired(99999,99999);
x = BarIndex()+1;
xx =  DateNum()!=Ref(DateNum(),-1);

startbar = LastValue(ValueWhen(xx, x, 1)-2);  // Yesterday's end bar
4:00
endBar = LastValue(ValueWhen(xx, x, 1)-1);  // todays start bar 9:30

sb=IIf(O>C,C,O);  //startbar origin the lower of the open or close
OCabsval= abs(O-C); //absolute value of the (O-C) = the rise
O = sb;  //startbar price

startOC = OCabsval [startBar];  //absolute value of the(O-C) of start
bar
startO = O [startBar];  //Open of start bar
endOC = startO [endBar]+  startOC ;  //endbar higher by absolute value
of the(O-C) of the start bar

trendLine = LineArray(startBar, startO, endBar, endOC,3);
Plot( trendline, "Trendline 1bar rise/run", colorRed, styleNoRescale |
styleDots );

Reply via email to