NexusFi: Find Your Edge


Home Menu

 





Plot line from X day high from X days ago?


Discussion in ThinkOrSwim

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




 
Search this Thread
  #1 (permalink)
KenAdams
New Orleans
 
Posts: 2 since May 2020
Thanks Given: 0
Thanks Received: 0

Hey,

Need some help, even more is I would love to learn, how to find a value/condition in the past, and draw a horizontal line from it. I understand how to plot a line from a high bar but haven't figured out how to in relation to time. What I want to do is based off a scan from stockfetcher. Ultimately I want to make a TOS scan from it but it think the study would be useful to visualize.

https://www.stockfetcher.com/sfforums/?mid=149271

The study will find a 10 days high within 10 days and the 20 day high within 60 days and calculates the value if a line connected the two highs to today. The scan would find when price crosses above that calculated value.

So from my little knowledge of coding I have been playing around with...

highest(high[10], 100); and
getvalue to find the point
(Not the full script, just two commands that seem useful)

Am I using these right, how off is this?
My other “tries” have included tweaking the Near_high_low scan from the condition wizard.


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);;


Would appreciate an explanation of how the code should be written. Or a tutorial or other script I could use.


Teach me how to fish.


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trump Lands in Beijing on CPI Day: Iran Peace Expires To …
Prediction Markets & Event Contracts
Sundays Verdict: Lebanon Locked at 99.85% as Iran June 7 …
Prediction Markets & Event Contracts
Friday Update: Markets Now Pricing Fed Rate HIKES as Sta …
Traders Hideout
Thanks Mike. Godspeed.
The Elite Circle
El Clasico Draws $9.2M in Prediction Market Action -- Bi …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
205 thanks
Sober Journey With S&P
21 thanks
30 Sessions
20 thanks
Volume Indicators
8 thanks
Thanks Mike. Godspeed.
7 thanks
  #2 (permalink)
 Vacationer 
Sarasota, Florida
 
Experience: Intermediate
Platform: TOS, IB, TS
Broker: TD Ameritrade, IB, TS
Trading: ES, NQ, YM, RTY
Posts: 27 since Jan 2018
Thanks Given: 38
Thanks Received: 13

Hi Ken,

I think the main issue here is the trend line coding if I understand that correctly.

I used TOS and think script in the past, but I found it to be a bit limited. I just looked at the paltform again under thinkscript and I could not find any think that is related to trend line where it could be a start for coding a line. So this would be a big stopper here.

A scan by itself does not do anything with trend lines either.

So unless you can find some where in thinkscript an example of how to draw a line, that would be difficult to do. May be i didn't look deep enough to find it.

There is a programmer out there who did some good things with TOS, and he programs for a fee. He has some free tutorials and Q&A on his site that might point you in the write direction, or give you a clear answer if it is possible or not possible to code that trend line in TOS. His site is : https://www.hahn-tech.com/.

Hope that helps in any way.

Vacationer


Reply With Quote




Last Updated on May 21, 2020


© 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