Color column based on IsOptionable status


Category:
0
0

Hello i have created 2 column one for volume

plot x = (volume);
AddLabel (yes, + Round(x *.000001 , 1) + “M”,color.white);

and other to know if this can trade options

AddLabel(1,IsOptionable());

 

is it possible to combine both and make volume column  background color blue is the ticker can trade  options else background color black

 

RESOLVED
Marked as spam
Posted by (Questions: 12, Answers: 5)
Asked on December 20, 2022 1:54 pm
53 views
0
Private answer

The original title you selected for this question was far to vague so it has been updated to include the context of your request. Please consider this when posting questions in the future. "Custom column" is never going to be an acceptable title for any post in this forum.

While researching this I found some very odd behavior impacting the efficacy of the solution. So  I will pass along what I found to help others to understand what to expect.

  1. When set to daily time frame, the column for "IsOptionable" shows the exact opposite status.
  2. When set to intraday time frame while excluding extended hours the "IsOptionable" column again shows the exact opposite status.
  3. The only way I was able to get it to work was to set it to intraday time frame AND check the box to include extended hours.

That behavior is utterly bizarre and makes no sense whatsoever. I am testing this during the post market period so perhaps this changes during regular market hours. When you apply this as a label to a chart it works just fine no matter what time frame you select. Which means the issues are related to a glitch or a bug within the custom column itself.

So, please be aware that we have some strange things taking place using this "IsOptionable" function within a custom watchlist column. Regardless of those issues, here is a solution which is properly formatted as you requested:

AddLabel (yes, + Round(volume *.000001 , 1) + “M”);
AssignBackgroundColor(if IsOptionable() then Color.BLUE else Color.CURRENT);

Marked as spam
Posted by (Questions: 37, Answers: 4086)
Answered on December 20, 2022 3:45 pm