LD3K

Previous H/Ls and Forecast H/L

Plots the previous periods High and Lows (black crosses) and forecasts the next day's High and Lows (gray crosses)
Skript med en öppen källkod

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Frånsägelse av ansvar

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Vill du använda det här skriptet i ett diagram?
//Created by Lachlan Smith 31/03/15 
// Updated to included projected high and lows
//Daily and Weekly
study(title="High and Lows", shorttitle="H&L + forecast", overlay=true) 
//Data setup
dHigh = security(tickerid, 'D', high[1]) 
dLow = security(tickerid, 'D', low[1]) 
dClose =  security(tickerid, 'D', close[1]) 
dOpen =  security(tickerid, 'D', open[1]) 

wHigh = security(tickerid, 'W', high[1]) 
wLow = security(tickerid, 'W', low[1]) 
wClose =  security(tickerid, 'W', close[1]) 
wOpen =  security(tickerid, 'W', open[1]) 

//Daily
projectedHigh = dClose < dOpen ? ((dHigh + dClose + 2*dLow)/2 - dLow) : dClose > dOpen ? ((2*dHigh + dLow + dClose)/2 - dLow) : ((dHigh + dLow + 2*dClose)/2 - dLow)
projectedLow = dClose < dOpen ? ((dHigh + dClose + 2*dLow)/2 - dHigh) : dClose > dOpen ? ((2*dHigh + dLow + dClose)/2 - dHigh) : ((dHigh + dLow + 2*dClose)/2 - dHigh)

plot(isintraday ? dHigh : na, title="Daily High",style=cross, color=black,linewidth=2) 
plot(isintraday ? dLow : na, title="Daily Low",style=cross, color=black,linewidth=2) 

plot(isintraday ? projectedHigh : na, title="Forecast High",style=cross, color=gray,linewidth=2) 
plot(isintraday ? projectedLow : na, title="Forecast Low",style=cross, color=gray,linewidth=2) 

//weekly
projectedWHigh = wClose < wClose ? ((wHigh + wClose + 2*wLow)/2 - wLow) : wClose > wClose ? ((2*wHigh + wLow + wClose)/2 - wLow) : ((wHigh + wLow + 2*wClose)/2 - wLow)
projectedWLow = wClose < wClose ? ((wHigh + wClose + 2*wLow)/2 - wHigh) : wClose > wClose ? ((2*wHigh + wLow + wClose)/2 - wHigh) : ((wHigh + wLow + 2*wClose)/2 - wHigh)

plot(isdaily ? wHigh : na, title="Weekly High",style=cross, color=black,linewidth=2) 
plot(isdaily ? wLow : na, title="Weekly Low",style=cross, color=black,linewidth=2) 

plot(isdaily ? projectedWHigh : na, title="Weekly Forecast High",style=cross, color=gray,linewidth=2) 
plot(isdaily ? projectedWLow : na, title="Weekly Forecast Low",style=cross, color=gray,linewidth=2)