Price within X percent of high within Y days - ThinkOrSwim | futures trading

Go Back

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

Price within X percent of high within Y days
Started:April 7th, 2015 (03:26 PM) by eddieo Views / Replies:322 / 0
Last Reply:April 7th, 2015 (03:26 PM) Attachments:1

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

Price within X percent of high within Y days

Old April 7th, 2015, 03:26 PM   #1 (permalink)
Trading Apprentice
New York, NY
Futures Experience: Intermediate
Platform: Thinkorswim
Favorite Futures: Options
Posts: 4 since Feb 2015
Thanks: 1 given, 0 received

Price within X percent of high within Y days

TOS offers a "Near_High_Lows" study for its scans, image attached.

Parameters on the built in version of this are "Current price is within [X] percent of the [252] period [High/Low]"

I'm looking to customize this to add a "within n bars" parameter. Could anyone give me a thinkscript tip on how to do this?


P.S. The ThinkScript behind the default study is:

#Wizard text: The current price
##Wizard input: price
#Wizard text: is within
#Wizard input: choice1
#Wizard text: % of the
#Wizard input: period
#Wizard text: period
#Wizard input: choice

def price = close;
input period = 252;
input choice = {default High, Low};
input choice1 = 3;

def hi = high;
def lo = low;

plot scan;
switch (choice) {
case High:
scan = price >= highest(hi,period)* ((100 - choice1) /100);
case Low:
scan = price <= lowest(lo,period)* ((100 + choice1) /100);;

Attached Thumbnails
Price within X percent of high within Y days-capture.png  
Reply With Quote

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > ThinkOrSwim > Price within X percent of high within Y days

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
close of previous bar less than twenty five percent from the high or low The Gurok ThinkOrSwim 2 August 18th, 2014 04:15 PM
Price Headley's Percent R Thinkscript study ikholobayev ThinkOrSwim Programming 1 May 22nd, 2013 05:21 PM
Apple's Stock Price Is Down Nearly 10 Percent—Time to Buy? Quick Summary News and Current Events 0 October 9th, 2012 02:20 PM
I need a programmer to code previous 4 days high and low. mrphr NinjaTrader Programming 10 November 15th, 2011 02:46 PM
US poverty at new high: 16 percent, or 49.1M kbit News and Current Events 0 November 7th, 2011 02:53 PM

All times are GMT -4. The time now is 04:27 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 20 queries on phoenix via your IP