Blind Blake
Blind Blake

Reputation: 51

Simple script is just not working when requesting the data - the calculations arent correct

Hi I am trying to get the below script to work. It looks to be really simple however I cant seem to get it to work properly. I know the calculation could be done easier with the SMA function however dont want it to include the current bar.

plot(data, color=color.new(color.orange, 0), style=plot.style_circles) //This works as it should when on the ticker and daily timeframe however dosent pull the daily data through when on the 5 minute.

plot(request.security('AAPL','D',data))// as a result I have tried to plot it like this in order to get it to pull through however the result is different even when on the daily timeframe.

I just dont understand how they can be different. I will also want to add QQQ and Spy to this also so that I can always keep an eye on these also however I know if this issue is fixed its just a case of repeating the code with amendments

indicator(title='AAPL', overlay=true, precision=1)

data = (volume/((volume[1]+volume[2]+volume[3]+volume[4]+volume[5]+volume[6]+volume[7]+volume[8]+volume[9]+volume[10])/10))*100

plot(data, color=color.new(color.orange, 0), style=plot.style_circles) 

plot(request.security('AAPL','D',data))

Upvotes: 0

Views: 109

Answers (1)

Blind Blake
Blind Blake

Reputation: 51

I have found the answer (so obvious as always when you know) the ticker ID didn't have the broker as well this is why it didn't match up to my chart

Upvotes: 1

Related Questions