# how can i do 2 conditions if statement in a custom study?

#### JJJJJJ11111

##### Member
Code:
``````def HighB = high > high[1] ;
def lowB =  low < low[1];

plot scan = if highB > 0 then "H" else if lowB>0 then "L" else double.nan;``````

I wanted my watchlist column custom study to appear H if the prev day High is broken.
or display L if the prev day is broken.
the code produce error, can't complete the code.

thank u!

Solution
Code:
``````def HighB = high > high[1] ;
def lowB =  low < low[1];

plot scan = if highB > 0 then "H" else if lowB>0 then "L" else double.nan;``````

I wanted my watchlist column custom study to appear H if the prev day High is broken.
or display L if the prev day is broken.
the code produce error, can't complete the code.

thank u!

You cannot create text in a plot statement. You can within a label or bubble.

This will work in a watchlist column:

Ruby:
``````def HighB = high > high[1] ;
def lowB =  low < low[1];

AddLabel(1, if HighB > 0 then "H" else if lowB > 0 then "L" else "", if HighB then Color.GREEN else if lowB then Color.RED else Color.BLACK);``````

#### SleepyZ

##### Well-known member
VIP
Code:
``````def HighB = high > high[1] ;
def lowB =  low < low[1];

plot scan = if highB > 0 then "H" else if lowB>0 then "L" else double.nan;``````

I wanted my watchlist column custom study to appear H if the prev day High is broken.
or display L if the prev day is broken.
the code produce error, can't complete the code.

thank u!

You cannot create text in a plot statement. You can within a label or bubble.

This will work in a watchlist column:

Ruby:
``````def HighB = high > high[1] ;
def lowB =  low < low[1];

AddLabel(1, if HighB > 0 then "H" else if lowB > 0 then "L" else "", if HighB then Color.GREEN else if lowB then Color.RED else Color.BLACK);``````

i see thank u

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?