What is the ValueWhen (TradingView) equivalent in ThinkScript?

MindPortal

New member
What is the ValueWhen (TradingView) equivalent in ThinkScript?
so I can get a value during a certain condition.
Say if I wanted to plot an arrow when an ema cross happens. Thank you!
 

rad14733

Well-known member
VIP
You would use conditional logic and a plot... Virtually every study serves as examples... I'm fairly certain Thinkscript will seem easier to you than Pinescript does to me...

However, TOS already has EMA studies that have crossover arrows...
 

jeriath

New member
oma = ma > ma[1] ? valuewhen(ma < ma[1], ma[1], 0) : ma < ma[1] ? valuewhen(ma > ma[1], ma[1], 0) : nz(oma[1])

I know I have to use conditionals and a plot but not sure how to translate the valuewhen and the nz function to thinkscript. The top is from pinescript in tradingview. Any help is appreciated!
 

Similar threads

Top