NexusFi: Find Your Edge


Home Menu

 





Help Creating Percent off High Indicator


Discussion in ThinkOrSwim

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




 
Search this Thread

Help Creating Percent off High Indicator

  #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 Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
About a successful futures trader who didn´t know anyth …
Psychology and Money Management
Quant vue
Trading Reviews and Vendors
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
How to apply profiles
Traders Hideout
REcommedations for programming help
Sierra Chart
 
  #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

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 Twitter 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 Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote




Last Updated on November 4, 2015


© 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