Help with a think script problem - ThinkOrSwim | futures trading

Go Back

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

Help with a think script problem
Started:November 29th, 2015 (05:53 AM) by johnzhou20 Views / Replies:184 / 0
Last Reply:November 29th, 2015 (05:53 AM) 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

Help with a think script problem

Old November 29th, 2015, 05:53 AM   #1 (permalink)
Trading Apprentice
vancouver, canada
Futures Experience: None
Platform: Thinkorswim
Favorite Futures: ES
Posts: 1 since Oct 2015
Thanks: 0 given, 0 received

Help with a think script problem

Hello all,

I am trying to edit the think script code for scanning stocks based on compounded returns over a specific length but I can't seem to find a command that can simplify a sequence of time. To show you:

input price = close;
input percent = 19.8;
input Choice = {default greater, less};
input length = 10;

def z = length - 1;

def y = 100*((log(price[z]) - log(price[length])) + (log(price[z - 1]) - log(price[z])) + (log(price[z - 2]) - log(price[z - 1])) + (log(price[z - 3]) - log(price[z - 2])) + (log(price[z - 4]) - log(price[z - 3])) + (log(price[z - 5]) - log(price[z - 4])) + (log(price[z - 6]) - log(price[z - 5])) + (log(price[z - 7]) - log(price[z - 6])) + (log(price[z - 8]) - log(price[z - 7])) + (log(price[z - 9]) - log(price[z - 8])));

plot scan;

switch (Choice){
case greater:
scan = y >= percent;
case less:
scan = y <= -percent;


In essence, what is the command for this ? I would like to go out for further periods of defined lengths such as 1 year based on daily returns for example but I can't seem to find the resources for this on the Thinkscript tutorial website and I also tried to browse the web. I would greatly appreciate any help because once my lengths becomes specified for a period of 30 days or greater, then i receive an error where the command is too complex. It would make my life a lot easier if someone could help (as a side note, I would prefer to use daily cumulative returns here as opposed scaling out to larger time frames such as weekly or monthly. Having said that, knows a simplified method will also allow me to have the opportunity to scan stocks based on lower time frames.)

Thanks for reading

Reply With Quote

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > ThinkOrSwim > Help with a think script problem

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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
Can I get the script of this Indicator? khalid alshalan ThinkOrSwim 8 April 6th, 2014 02:19 PM
Option Script bobp ThinkOrSwim Programming 2 August 7th, 2012 06:42 PM
Need little help with a Ninjatrader script raindrop NinjaTrader Programming 9 April 20th, 2011 10:35 PM
Looking for this script or indicator. rh017548 NinjaTrader Programming 3 May 16th, 2010 07:00 PM
Ninja Script Import Problem jdella NinjaTrader 5 November 6th, 2009 09:57 AM

All times are GMT -4. The time now is 10:25 AM.

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-28 in 0.06 seconds with 19 queries on phoenix via your IP