-2

can someone please provide a code to check for price change between previous day close (at 3:40pm) and current day's open price (at 9:05 am)enter image description here

Akash
  • 63
  • 1
  • 5

1 Answers1

0

Answering my own question (maybe helpful to some newbie on Pine script) -

pricechange = abs(close-close[1])/close[1]*100

This will check close price of current and previous candle and calculate the absolute percentage difference.

My logic was faulty when i posted the question - i was checking movement in each candle 'abs(close-open)/open*100' and referring to this value in further calculations to check for movement across two bars.

Akash
  • 63
  • 1
  • 5
  • As a suggestion to future questions, do not ask for code on Stackoverflow, it is not a code writing service. Post the code you have written, and ppl will help find the issue with that or with the underlying logic. – karatedog Jun 12 '23 at 10:41