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,048 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread

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

  #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?
Exit Strategy
NinjaTrader
Deepmoney LLM
Elite Quantitative GenAI/LLM
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
Futures True Range Report
The Elite Circle
NexusFi Journal Challenge - April 2024
Feedback and Announcements
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
39 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
Battlestations: Show us your trading desks!
24 thanks
The Program
18 thanks
  #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: 441

Maybe this could work:

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

Reply With Quote




Last Updated on March 1, 2014


© 2024 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 - Privacy Policy - Downloads - Top
no new posts