Previous Candle watchlist Column

T

tradeking313

Member
Hello. I was wondering if there was a way to have a column on the watchlist that reads "Previous candle red" where the assign value color is red when that candle closes red or "Previous candle green" where the assign value color is green when that candle closes green..(your chose on the time frame but preferrable 5 minute, 15 minute, and 30 minute..

Thanks..
 
P

Pensar

Active member
VIP
@tradeking313 Do you mean something like this?

Code:
#Previous Candle Watchlist Column
#choose your preferred aggregation from choices in column editor

AddLabel(1, if close[1] < open[1] then "Previous Candle Red"
else if close[1] > open[1] then "Previous Candle Green" else
"Previous Candle Neutral", color.black);
AssignBackgroundColor(if close[1] < open[1] then color.red
else if close[1] > open[1] then color.green else color.gray);
 
S

soary

Member
@Pensar I have been looking for something like this with same conditions but for the watchlist to change colors based on previous day close and RTH opening. instead of t being based on the current candles. I'm not a coder so can you post adjust and post this/ Thanks
 
P

Pensar

Active member
VIP
@soary Check if this works. Make certain you choose a daily aggregation in the watchlist.

Code:
#Previous Close vs Open Watchlist Column
#shows if the open of the current bar is greater than, less than, or equal to the previous bar close
#select a daily aggregation

AddLabel(1, if open < close[1] then "Open < Close"
else if open > close[1] then "Open > Close" else
"Open = Close", color.black);
AssignBackgroundColor(if open < close[1] then color.red
else if open > close[1] then color.green else color.gray);
 
Last edited:

Similar threads

Top