• Memorial Day Sale! Claim the biggest discount of the year with $50 off VIP using code MEM50. Sign up here.

Add value to custom column


New member
Hi for a custom column that Im building is there a way to set the value after a condition is satisfied.

example, is the stock above the 50 day? so if the condition is true show the value in the column. i do not want to use the add label command and if i plot condition=true it only shows binary 0 or 1 value.

so if the stock is above its 50, how could I display the 50 day moving average in the column.

thank you


Well-known member
@EDDY GARCIA, per your request here is a watchlist column code that displays the MA50 when the stock closes above MA50. Since you did not specify your else condition, I have used 0 as a placeholder. Feel free to modify to suit your needs

def ma50 = Average(close,50);
plot value = if close > ma50 then ma50 else 0;

Similar threads