NexusFi: Find Your Edge


Home Menu

 





Help Creating Percent off High Indicator


Discussion in ThinkOrSwim

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




 
Search this Thread
  #1 (permalink)
 eclipsemf 
Manchester NH
 
Experience: Advanced
Platform: Thinkorswim
Broker: TD Ameritrade
Trading: Small Caps
Posts: 90 since Feb 2014
Thanks Given: 31
Thanks Received: 55

I'm looking to find some one that could help me convert my words to a simple program to use in TD Ameritrade's Quotes tab under MarketWatch. I'm am going to use this to aid in screening stock. I know this is more of a futures and that's what I trade but do regular stocks on the side and feel like this will help.

Here's what I have, it does what I want I'm just am not to good with ThinkScript yet.



LastPrice - 52WeekLowPrice = DollarOffLow
DollarOffLow / LastPrice = DecimalPercent
DecimalPercent * 100 = PercentOffLow


Update: I got this to show me the % off the Low off the day Im just not sure how to make it the 52 week low.


Update Number 2 Getting close some work out perfect but some others dont!!! Any one have an ideas. I have the 52 week low to plot where it should its just the % off the low doesnt seem to want to work.
input price = close;


Def atl = Lowestall(price);

def Dollarofflow = (price - atl);
def Decimal = (Dollarofflow / price);


def Percentofflow = (Decimal * 100);

plot data = Percentofflow;


Follow me on X Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
US Prop Firms Race Inside the CFTC Perimeter -- Tradeify …
Funded Trading Evaluation Firms
April FOMC Minutes: Most Divided Fed Since 1992 -- Many …
Traders Hideout
Fed Hike Odds at 57% After Warsh: England Surges 12.9%, …
Prediction Markets & Event Contracts
Iran Airspace Contract Surges to 33.5% as Project Freedo …
Prediction Markets & Event Contracts
S&P 500 Holds the Line: No Fast Track for SpaceX, Op …
Stocks and ETFs
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
15 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 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: 439

I tried something very similar years ago; don't remember the logic behind the code or the testing to make sure the numbers were right but this was the code:

 
Code
# 52 Week High and Low
# If higher from Low, Green
# If lower from High, Red
 
 
input HLaggregationPeriod = AggregationPeriod.WEEK;
input HLlength = 52;

def WeekHigh = Highest(high(period = HLaggregationPeriod), HLlength);
def WeekLow = Lowest(low(period = HLaggregationPeriod), HLlength);
 
 
# Current Price
def last = close;
 
 
# Plot 

def HighP = Round(((1 - (last / WeekHigh)) * 100), 2);
def LowP = Round((((last / WeekLow) - 1) * 100), 2);

plot dif = if HighP > LowP then HighP else LowP;


assignBackgroundColor(if HighP>LowP then Color.Dark_Red else Color.Dark_Green);
#AssignBackgroundColor(if HighP > LowP then CreateColor(51, 0, 0) else CreateColor(0, 51, 0));


Reply With Quote
Thanked by:
  #3 (permalink)
 eclipsemf 
Manchester NH
 
Experience: Advanced
Platform: Thinkorswim
Broker: TD Ameritrade
Trading: Small Caps
Posts: 90 since Feb 2014
Thanks Given: 31
Thanks Received: 55


@rmejia Thank you for that! It looks like it has a few things I was missing! I will give it a look over and testing tomorrow when I am awake and will report back with some numbers so if any one in the future is looking to do the same thing they will have the numbers to back it.


Follow me on X Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #4 (permalink)
 eclipsemf 
Manchester NH
 
Experience: Advanced
Platform: Thinkorswim
Broker: TD Ameritrade
Trading: Small Caps
Posts: 90 since Feb 2014
Thanks Given: 31
Thanks Received: 55

This is what I came up with between what I had and what rmejia had posted. I changed it a bit so it would do exactly what I wanted. But this will give you the % the stock is off its low point for the year based off of the close of the last day. I ran 10 or so stocks with different prices and they all came out perfect using different inputs. Any questions feel free to ask!

# 52 Week Low


input HLaggregationPeriod = AggregationPeriod.WEEK;
input HLlength = 52;

def WeekLow = Lowest(low(period = HLaggregationPeriod), HLlength);

# Current Price
def last = close;


# Plot

def LowP = Round((((last / weeklow) -1) * 100), 2);

Plot data = LowP;


Follow me on X Visit my NexusFi Trade Journal Started this thread Reply With Quote




Last Updated on November 4, 2015


© 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