How to draw Horizontal Lines with price label at predefined Prices ? - ThinkOrSwim Programming | futures io social day trading
futures io futures trading


How to draw Horizontal Lines with price label at predefined Prices ?
Updated: Views / Replies:2,461 / 6
Created: by jsk123 Attachments:1

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

How to draw Horizontal Lines with price label at predefined Prices ?

  #1 (permalink)
Trading for Fun
Hyderabad,India
 
Futures Experience: Advanced
Platform: ATAS
Favorite Futures: Futures
 
Posts: 69 since Oct 2013
Thanks: 33 given, 11 received

How to draw Horizontal Lines with price label at predefined Prices ?

Hi,

I have some price levels that I want to put in the code of thinkscript so that I can apply that study and immediately recognize the support and resistance levels .

I already have the price levels that I want to draw horizontal lines at. It is pretty basic thing I am trying to accomplish. But I am lost as I'm a noob to TOS.

Please give me an example of how to draw horizontal lines (with label) at predefined price levels so that I can make an indicator in TOS.

One example would suffice. Thank you very much.

Reply With Quote
 
  #2 (permalink)
Elite Member
Valdosta, GA. U.S.A
 
Futures Experience: Advanced
Platform: Sierra ,NT, TOS
Favorite Futures: 6E, 6J, CL, GC
 
Posts: 480 since Sep 2010
Thanks: 1,825 given, 466 received


jsk123 View Post
Hi,

I have some price levels that I want to put in the code of thinkscript so that I can apply that study and immediately recognize the support and resistance levels .

I already have the price levels that I want to draw horizontal lines at. It is pretty basic thing I am trying to accomplish. But I am lost as I'm a noob to TOS.

Please give me an example of how to draw horizontal lines (with label) at predefined price levels so that I can make an indicator in TOS.

One example would suffice. Thank you very much.

Above your Chart you can Select Drawing Tools...Then the Forth selection "$ Price Levels"
This is the Manual Drawing Method....you can then Edit that line to set the Price to the Exact Tick if you could Not get it Perfectly where you wanted it.
I see you are wanting to Code this....

Reply With Quote
 
  #3 (permalink)
Trading for Fun
Hyderabad,India
 
Futures Experience: Advanced
Platform: ATAS
Favorite Futures: Futures
 
Posts: 69 since Oct 2013
Thanks: 33 given, 11 received


Hi

Thanks for the reply. I have hundreds of levels that I need to put, everytime I close the software or uninstall/reinstall it, I will lose those levels if I draw using that PriceLevel tool.

So, i want to write code so that I can apply the indicator immediately if some of the levels are lost due to some reason.

Reply With Quote
 
  #4 (permalink)
1.Fibs 2.??? 3.Profit
Puerto Rico
 
Futures Experience: Intermediate
Platform: thinkorswim
Broker/Data: TD Ameritrade
Favorite Futures: ES
 
rmejia's Avatar
 
Posts: 384 since Oct 2010
Thanks: 3,597 given, 421 received

You can save those levels by saving the drawing set. Right click and at the end, Drawings, then at the end again, Save Drawing Set. You can then load it into any other chart.

Also if you save the Chart Grid (box icon in the top right), Save Grid As, it will save the grid with all indicators and drawings so if you reload that grid it loads everything.

Everything is stored in the thinkorswim servers so it will be there available until you delete the sets.

Reply With Quote
The following user says Thank You to rmejia for this post:
 
  #5 (permalink)
Elite Member
Valdosta, GA. U.S.A
 
Futures Experience: Advanced
Platform: Sierra ,NT, TOS
Favorite Futures: 6E, 6J, CL, GC
 
Posts: 480 since Sep 2010
Thanks: 1,825 given, 466 received


rmejia View Post
You can save those levels by saving the drawing set. Right click and at the end, Drawings, then at the end again, Save Drawing Set. You can then load it into any other chart.

Also if you save the Chart Grid (box icon in the top right), Save Grid As, it will save the grid with all indicators and drawings so if you reload that grid it loads everything.

Everything is stored in the thinkorswim servers so it will be there available until you delete the sets.

I was just trying to find out how i had mine set...as all of my drawings are saved including Price Levels.
When i start back up the Platform they are all there.
It has to do with how you have your Platform set up to save your work space like @rmejia has mentioned.

I was curious were you trying to accomplish Price levels of Support/Resistance in this way on this Chart i attached ?

Attached Thumbnails
How to draw Horizontal Lines with price label at predefined Prices ?-cl-11-15-30-min-10_2_2015.jpg  
Reply With Quote
 
  #6 (permalink)
Trading Apprentice
Las Vegas Nevada
 
Futures Experience: None
Platform: think or swim
Favorite Futures: power companies
 
Posts: 2 since Oct 2017
Thanks: 0 given, 0 received

Draw Horizontal lines in Thinkscript

I couldn't find any examples on the 'net' for drawing a horizontal line based on the price (high, low, open, etc. ) using Thinkscript.

Kinda wierd..... it seems like it should be so easy.
anyways, below is my script.
It seems like there should be an easier way to do it.

My script lets you define the length of the line in terms of 'bars' on the first input parameter.
It will draw a line from the leftmost bar all the way to the right.
The level of the bar is based on either the leftmost bar or the rightmost bar depending on the 3rd input parameter (leftmost_bar) which is a boolean, it defaults to yes.
The 2nd input parameter lets you chose 1 of the price fundamentals, ie. low, close, open, high, etc. this is where the horizontal line will be drawn

It will add a 'price' label in the form of a bubble.

See below:

Regards,
Toby

script Horizontal_line_leftmost
{
input lineLength = 8;
input price_type = low;

#This line starts from the leftmost bar

declare once_per_bar; #recalculation done once per bar, not per tick
def current_bn = BarNumber();
def Total_bn = HighestAll(if IsNaN(close[-1]) and !IsNaN(close) then current_bn else Double.NaN);
#data_pointer, ie the bar number we use to point to historical or future data, = Total_bn (total bar numbers) - current_bn (current bar number).
def data_pointer = Total_bn - current_bn;
def x = lineLength - data_pointer -1;

plot Horizontal_line_leftmost =
if linelength - data_pointer == 15 and data_pointer < lineLength then price_type[14]
else if linelength - data_pointer == 14 and data_pointer < lineLength then price_type[13]
else if linelength - data_pointer == 13 and data_pointer < lineLength then price_type[12]
else if linelength - data_pointer == 12 and data_pointer < lineLength then price_type[11]
else if linelength - data_pointer == 11 and data_pointer < lineLength then price_type[10]
else if linelength - data_pointer == 10 and data_pointer < lineLength then price_type[9]
else if linelength - data_pointer == 9 and data_pointer < lineLength then price_type[8]
else if linelength - data_pointer == 8 and data_pointer < lineLength then price_type[7]
else if linelength - data_pointer == 7 and data_pointer < lineLength then price_type[6]
else if linelength - data_pointer == 6 and data_pointer < lineLength then price_type[5]
else if linelength - data_pointer == 5 and data_pointer < lineLength then price_type[4]
else if linelength - data_pointer == 4 and data_pointer < lineLength then price_type[3]
else if linelength - data_pointer == 3 and data_pointer < lineLength then price_type[2]
else if linelength - data_pointer == 2 and data_pointer < lineLength then price_type[1]
else if linelength - data_pointer == 1 and data_pointer < lineLength then price_type[0]
else double.nan;

#plot Horizontal_line_leftmost = yyy;
}

script Horizontal_line_rightmost
{
input lineLength = 8;
input price_type = close;
#This line starts from the 'right-most' bar

declare once_per_bar; #recalculation done once per bar, not per tick
def current_bn = BarNumber();
def Total_bn = HighestAll(if IsNaN(close[-1]) and !IsNaN(close) then current_bn else Double.NaN);
#data_pointer, ie the bar number we use to point to historical or future data, = Total_bn (total bar numbers) - current_bn (current bar number).
def data_pointer = Total_bn - current_bn;

plot Horizontal_line_rightmost =
if data_pointer == 15 and data_pointer < lineLength then price_type[-15]
else if data_pointer == 14 and data_pointer < lineLength then price_type[-14]
else if data_pointer == 13 and data_pointer < lineLength then price_type[-13]
else if data_pointer == 12 and data_pointer < lineLength then price_type[-12]
else if data_pointer == 11 and data_pointer < lineLength then price_type[-11]
else if data_pointer == 10 and data_pointer < lineLength then price_type[-10]
else if data_pointer == 9 and data_pointer < lineLength then price_type[-9]
else if data_pointer == 8 and data_pointer < lineLength then price_type[-8]
else if data_pointer == 7 and data_pointer < lineLength then price_type[-7]
else if data_pointer == 6 and data_pointer < lineLength then price_type[-6]
else if data_pointer == 5 and data_pointer < lineLength then price_type[-5]
else if data_pointer == 4 and data_pointer < lineLength then price_type[-4]
else if data_pointer == 3 and data_pointer < lineLength then price_type[-3]
else if data_pointer == 2 and data_pointer < lineLength then price_type[-2]
else if data_pointer == 1 and data_pointer < lineLength then price_type[-1]
else if data_pointer == 0 and data_pointer < lineLength then price_type[0]
else double.nan;

#plot Horizontal_line_rightmost = price_type[lineLength];
}

input Num_of_Bars = 8;
input Type_of_Price = low;
input from_leftmost_bar = yes;

# parameters:
# param#1: number of bars
# param#2: choice of ; low, high, close, or open
# param#3: the line will be drawn from the leftmost bar at teh level of teh 'type_of_price', ie. low, high, close, open etc.; otherwise it will be drawn from the rightmost bar.

plot horiz =
if from_leftmost_bar then Horizontal_line_leftmost (Num_of_Bars, Type_of_Price)
else Horizontal_line_rightmost (Num_of_Bars, Type_of_Price);

#AddLabel(yes, Concat("test: ", Horizontal_line_leftmost()));

AddChartBubble(horiz == horiz[Num_of_Bars-1] and from_leftmost_bar, horiz, Horizontal_line_leftmost(), horiz.TakeValueColor());

AddChartBubble(horiz == horiz[Num_of_Bars-1] and !from_leftmost_bar, horiz, Horizontal_line_rightmost(), horiz.TakeValueColor());

Reply With Quote
 
  #7 (permalink)
Trading Apprentice
Las Vegas Nevada
 
Futures Experience: None
Platform: think or swim
Favorite Futures: power companies
 
Posts: 2 since Oct 2017
Thanks: 0 given, 0 received

I found a mistake in the chart bubbles, it should be:

AddChartBubble(horiz == horiz[Num_of_Bars-1] and from_leftmost_bar, horiz, Horiz[0], horiz.TakeValueColor());

AddChartBubble(horiz == horiz[Num_of_Bars-1] and !from_leftmost_bar, horiz, Horiz[0], horiz.TakeValueColor());

Reply With Quote

Reply



futures io > > > > > How to draw Horizontal Lines with price label at predefined Prices ?

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for Horizontal Line with Label on Y-axis Keupie NinjaTrader 4 May 4th, 2015 06:24 AM
Need to draw vertical and horizontal lines jsk123 NinjaTrader Programming 3 March 21st, 2015 02:28 AM
Lower Indicator Horizontal Lines bbelliveau ThinkOrSwim 0 December 17th, 2014 06:56 PM
draw a descriptive label for each row of dots in my indicator panel nunoonline EasyLanguage Programming 1 October 28th, 2012 06:13 PM
Simple Draw Tool to Manually Label A-B-Cs and 5 Wave Patterns - Does it Exist? forker NinjaTrader 20 September 1st, 2011 08:58 PM


All times are GMT -4. The time now is 02:16 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-12 in 0.12 seconds with 20 queries on phoenix via your IP 54.163.209.109