Reputation: 1
sir, I wants to convert my idea in pine script (strategy). For this I need some data which I am unable to fetch...
plz suggest the pine script coding for getting this data.
Upvotes: 0
Views: 4973
Reputation: 2310
I will assume that you will have extended data turned on as you are referencing premarket in your question. Please note this requires this to be the case or it requires different code.
//@version=5
indicator("My Script", overlay=true)
var lastHigh = 0.0
var lastLow = 0.0
var newHigh = 0.0
var newLow = 0.0
if session.ismarket[1] and not session.ismarket
lastHigh := high[1]
lastLow := low[1]
if session.ismarket and not session.ismarket[1]
newHigh := high
newLow := low
plot(lastHigh, color=color.red)
plot(lastLow , color=color.red)
plot(newHigh , color=color.yellow)
plot(newLow , color=color.yellow)
Cheers my friend and take care
Upvotes: 1