Calculate Percent Change from Opening bell to current Close


Category:
0
0

Hello Pete,

I couldn’t find if this question has been answered. How do you create watchlist column that calculates percentage change from open to close?

Similar to normal percent change, If positive then text will be green, If negative then text will be red .

 

Best

Marked as spam
Posted by (Questions: 22, Answers: 63)
Asked on December 24, 2018 11:22 am
454 views
0
Private answer

You set this column to a daily time frame.

def dailyPercentChange = Round(100 * (close / open - 1), 2);
plot data = dailyPercentChange;
data.AssignValueColor(if data <> 0 then Color.BLACK else Color.WHITE);
AssignBackgroundColor(if data > 0 then Color.GREEN else if data < 0 then Color.RED else Color.CURRENT);

Marked as spam
Posted by (Questions: 37, Answers: 4117)
Answered on December 26, 2018 7:09 am
0

Is it possible to make this a chart study that calculates this value above each candle? And only shows for the current candle using the input “Draw as: Value @ High”??

I am willing to pay for this project/ solution

( at January 29, 2019 2:33 pm)
0

The painting style, “Value @ High” does not display decimal values. Only whole numbers. But here is the code for that:

def dailyPercentChange = Round(100 * (close / open – 1), 2);
plot data = if IsNaN(close[-1]) then dailyPercentChange else Double.NaN;
data.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);

( at January 29, 2019 2:55 pm)
0

testing now and dropping cash in the hat. Thanks

( at February 1, 2019 4:35 am)
0

So I tested this so far and seems like the code is not accutaly capturing the percent change from the open price of the day to the current prices close

Instead, it looks like it is captuing only for the current (candle open to close)
In order to test this, I am using ONDEMAND and the trendline tool to draw the pertcange from open. I will try this agan in a live market enviroment

I dont mind if it uses who number percenagtes only

( at February 1, 2019 4:47 am)
0

From my answer: “You set this column to a daily time frame.” So your observations are correct. This only measure from open to close of the current candle. With the intention the user will set the aggregation period to DAY.

( at February 1, 2019 10:00 am)
0

Yes, I see the mistake. It works perfect as a watchlist column that is set to today.

now, how do we get it to work on the 1-minute chart and starting counting the percent change from the first candles open price to the current candles close price ?

( at February 1, 2019 10:24 am)
0

That would be an entirely different approach, and a bit more complicated.

( at February 1, 2019 10:36 am)
0

I understand, can we take that path?

( at February 1, 2019 10:48 am)
0

Not here. In the Q&A forum we have one set of specifications per post. Adding a new set of specifications muddies the water and confuses the viewers.

( at February 2, 2019 10:09 am)
0

Should i open a new post under chart studies?

( at February 2, 2019 2:10 pm)