NexusFi: Find Your Edge


Home Menu

 





How do I find the max of the past n bars? (and see if the currnet price is above it)


Discussion in ThinkOrSwim

Updated
    1. trending_up 4,640 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
CSharpTrader
Philadelphia, Pa/United States
 
Posts: 3 since Jan 2013
Thanks Given: 1
Thanks Received: 1

Hello all... this is my 2nd post requesting thinkscript help. The first was answered immediately with fantastic coding. I'm loving this site. Hopefully someone(s) can help me with my current task.

I want to write a script to find breakouts on the daily charts.

I'm trying to get used to tos syntax. I want to code a script to run in the scan tab, to look for stocks whose current price is > the previous high, and make sure the high is at least n days ago. The 'n' might be hard- coded, might be a variable, I'm open to suggestions. Easier is usually better. So I'm interested in daily charts, but will this work when I run it intraday? In other words, will the current price during the trading day trigger the alert when run against a script based on daily data?

Many thanks in advance.


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Iran Lebanon Problem Kills Switzerland Talks, Brent at $ …
Prediction Markets & Event Contracts
Trump Media to sell instant access to market-moving soci …
Traders Hideout
Six Days to Kickoff: World Cup Prediction Markets Hit $1 …
Prediction Markets & Event Contracts
Roland Garros Final Day: $3M on Zverev at 80.5% -- Leban …
Prediction Markets & Event Contracts
Warsh Drops Easing Bias, December Hike Now Above 50% -- …
Prediction Markets & Event Contracts
 
  #2 (permalink)
 
rmejia's Avatar
 rmejia 
Puerto Rico
 
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: Options
Posts: 379 since Oct 2010
Thanks Given: 3,614
Thanks Received: 439

Maybe this could work:

 
Code
input length = 10;
plot scan = close>highest(high[1],length);


Reply With Quote




Last Updated on March 1, 2014


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts