Pine Script Translation Request: ValueWhen - ThinkOrSwim Programming | futures trading

Go Back

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > ThinkOrSwim > ThinkOrSwim Programming

Pine Script Translation Request: ValueWhen
Started:November 22nd, 2014 (04:02 PM) by compupix Views / Replies:1,045 / 0
Last Reply:November 22nd, 2014 (04:02 PM) Attachments:0

Welcome to

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

Pine Script Translation Request: ValueWhen

Old November 22nd, 2014, 04:02 PM   #1 (permalink)
Trading Apprentice
Long Beach, CA USA
Futures Experience: Intermediate
Platform: ThinkorSwim
Favorite Futures: Options
Posts: 9 since Jul 2014
Thanks: 3 given, 0 received

Pine Script Translation Request: ValueWhen

Could someone please help me translate the following Pine Script line into ThinkScript:
hlv = valuewhen(hld != 0, hld, 1)

Here's the Pine Script manual's explanation for "valuewhen":
valuewhen (Built-in function) Source series value when the condition was true on the n-th most recent occurrence. Syntax valuewhen(condition, source, occurrence) Arguments condition (series) source (series) occurrence (integer) Examples slow = sma(close, 7) fast = sma(close, 14) // get value of close on second cross occurrence valuewhen(cross(slow, fast), close, 1)
So, I think I need the value of hld for the most recent occurrence when it wasn't 0. What is the best way to code that?


Reply With Quote

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > ThinkOrSwim > ThinkOrSwim Programming > Pine Script Translation Request: ValueWhen

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

An Afternoon with FIO trader bobwest

Elite only

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy/PowerLanguage Equiv. of ValueWhen and LastValue OZ Trade MultiCharts 4 October 20th, 2013 02:13 PM
EL translation solotrader Sierra Chart 0 September 22nd, 2013 12:29 PM
Beginner script advice or request mcteague NinjaTrader Programming 3 November 12th, 2012 06:57 PM
Need English translation GridKing News and Current Events 0 February 8th, 2012 04:47 AM
Request: Script to download historical data Henrik Platforms and Indicators 2 January 4th, 2010 01:23 PM

All times are GMT -4. The time now is 02:32 PM.

Copyright © 2016 by All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts

Page generated 2016-10-21 in 0.06 seconds with 19 queries on phoenix via your IP