Add value to custom column

E

EDDY GARCIA

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
 
T

tomsk

Well-known member
VIP
@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;
 
E

EDDY GARCIA

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

tomsk. perfect!! thank you im trying to leverage the conditional show value for the mobile and id get stuck with the add label! youre awesome!
 

Similar threads

Top