Coding horizontal line at specific bar - ThinkOrSwim | futures io social day trading
futures io futures trading


Coding horizontal line at specific bar
Updated: Views / Replies:190 / 12
Created: by CodingDummy Attachments:2

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 100,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
 2  
 
Thread Tools Search this Thread
 

Coding horizontal line at specific bar

  #1 (permalink)
Sacramento, California
 
 
Posts: 9 since Sep 2019
Thanks: 6 given, 1 received

Coding horizontal line at specific bar

on Thinkorswim.

I am looking for a script to do the following:

I want a light blue colored horizontal line drawn using the closing price of the first 5 minute candle in after hours trading (the one from 16:00-16:05 EST). Wherever this candle closes, a horizontal line is drawn in light blue that shows price level name as "LIS" and shows Price on the right. No matter what time frame we move to I want this line to be permanent for the next trading day only. Each day a new line is generated and we don’t see any prior lines.

Based on SHAK today (9/9/19), that line would be generated at 102.66 from 16:05 today (9/19). i don't care how long it extends into the future as long as it covers the entire trading day that follows.

please help me, i'm a coding dummy

Reply With Quote
 
  #2 (permalink)
Lenox, Ma
 
Trading Experience: Beginner
Platform: TOS
Favorite Futures: US Equities
 
Posts: 257 since Dec 2018
Thanks: 368 given, 568 received


CodingDummy View Post
on Thinkorswim.

I am looking for a script to do the following:

I want a light blue colored horizontal line drawn using the closing price of the first 5 minute candle in after hours trading (the one from 16:00-16:05 EST). Wherever this candle closes, a horizontal line is drawn in light blue that shows price level name as "LIS" and shows Price on the right. No matter what time frame we move to I want this line to be permanent for the next trading day only. Each day a new line is generated and we don’t see any prior lines.

Based on SHAK today (9/9/19), that line would be generated at 102.66 from 16:05 today (9/19). i don't care how long it extends into the future as long as it covers the entire trading day that follows.

please help me, i'm a coding dummy

It is going to be something like:

def C = close;
plot closingprice = if secondsfromtime(1605)<=0 and secondstilltime(1605)>=0 then C else if secondsfromtime(1605)>0 then c[1];

I am not sure if that will work as I am typing away from my TOS platform. If it does not then I will fix it tomorrow at some point.

Visit my futures io Trade Journal Reply With Quote
The following 2 users say Thank You to mtzimmer1 for this post:
 
  #3 (permalink)
Market Wizard
Portland, OR
 
Trading Experience: None
 
Massive l's Avatar
 
Posts: 1,796 since Mar 2011
Thanks: 1,315 given, 3,055 received



mtzimmer1 View Post
It is going to be something like:

def C = close;
plot closingprice = if secondsfromtime(1605)<=0 and secondstilltime(1605)>=0 then C else if secondsfromtime(1605)>0 then c[1];

I am not sure if that will work as I am typing away from my TOS platform. If it does not then I will fix it tomorrow at some point.

killing to coding game @mtzimmer1

error on else if with this one

Reply With Quote
The following user says Thank You to Massive l for this post:
 
  #4 (permalink)
Lenox, Ma
 
Trading Experience: Beginner
Platform: TOS
Favorite Futures: US Equities
 
Posts: 257 since Dec 2018
Thanks: 368 given, 568 received

Coding horizontal line at specific bar


Massive l View Post
killing to coding game @mtzimmer1



error on else if with this one



Right... ya need another “else” after the “else if” in case neither of the aforementioned conditions are met. Adding an “else double.nan” at the end of the string would resolve it I think?

Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to mtzimmer1 for this post:
 
  #5 (permalink)
Sacramento, California
 
 
Posts: 9 since Sep 2019
Thanks: 6 given, 1 received

It’s like you guys are speaking Russian to me right now. Can’t tell you how much u appreciate help like this

Reply With Quote
 
  #6 (permalink)
Lenox, Ma
 
Trading Experience: Beginner
Platform: TOS
Favorite Futures: US Equities
 
Posts: 257 since Dec 2018
Thanks: 368 given, 568 received

It is great practice for me as a novice coder! Try this out and tell me if it takes or not.



def C = close;

plot closingprice = if secondsfromtime(1605)<=0 and secondstilltime(1605)>=0 then C else if secondsfromtime(1605)>0 then c[1]
else double.nan;

Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to mtzimmer1 for this post:
 
  #7 (permalink)
Sacramento, California
 
 
Posts: 9 since Sep 2019
Thanks: 6 given, 1 received

this didn't work. i just end up with lines on every bar. let take a screen shot of what im looking for it to dispaly

Reply With Quote
 
  #8 (permalink)
Lenox, Ma
 
Trading Experience: Beginner
Platform: TOS
Favorite Futures: US Equities
 
Posts: 257 since Dec 2018
Thanks: 368 given, 568 received

Hey I'll get the code up and working tonight after work. Should be a quick fix!

Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to mtzimmer1 for this post:
 
  #9 (permalink)
Sacramento, California
 
 
Posts: 9 since Sep 2019
Thanks: 6 given, 1 received

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


here is what the SHAK chart would look like.
the 16:00-16:05 candle closed at 102.66, so i have manually drawn the aqua line from the 16:00 mark as seen in the picture.

i change time frames, so what i want to happen is that when i go from 5m chart to 4hr or daily chart that the line does not then move to the closing price of those charts. always needs to reference that 5min closing price on the 16:00-16:05 candle.

Reply With Quote
 
  #10 (permalink)
Lenox, Ma
 
Trading Experience: Beginner
Platform: TOS
Favorite Futures: US Equities
 
Posts: 257 since Dec 2018
Thanks: 368 given, 568 received

This works but its not pretty.....


Hey man, this DOES work but it is not pretty. You need to enter periodstarttime as the first 1 minute bar that prints in the pre-market trading hours. Also the periodendtime as the periodstarttime + 0001. Sorry I was unable to create a prettier code!


declare upper;

input PeriodStartTime = 0458;
input PeriodEndTime = 0459;


def Range_Top = if SecondsFromTime(1606) >= 0 then Range_Top[1] else
if SecondsFromTime(1605) == 0 then close else
if SecondsFromTime(1605) < 0 then Double.NaN else
if SecondsFromTime(1605) > 0 and SecondsFromTime(1606) <= 0
and close > Range_Top[1] then close else Range_Top[1];

plot line = Range_Top;


def line_Top = if SecondsFromTime(periodendtime) >= 0 then line_Top[1] else
if SecondsFromTime(PeriodStartTime) == 0 then line[1] else
if SecondsFromTime(PeriodStartTime) < 0 then Double.NaN else
if SecondsFromTime(PeriodStartTime) > 0 and SecondsFromTime(PeriodEndTime) <= 0
and line[1] > line_Top[1] then line[1] else line_Top[1];

plot line2 = line_top;

Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to mtzimmer1 for this post:

Reply



futures io > > > > Coding horizontal line at specific bar




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

futures io is celebrating 10-years w/ over $18,000 in prizes!

Right now
 

$250 Amazon Gift Cards with our "Thanks Contest" challenge!

Right now
 

Show us your trading desks and win over $5,000 in prizes w/Jigsaw Trading

September
 

Webinar: The Best Entries and Exits in trading & in life w/Agustin Lebron

Elite only
 

Webinar: NinjaTrader 8 Newest Features Release Sneak Peek

Sep 26
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for a horizontal priceline indicator that can start a specific time markus3500 The Elite Circle 3 February 14th, 2018 09:08 AM
Range of Bar Indicator with Horizontal Line Added ceramictilepro NinjaTrader 2 January 17th, 2014 11:15 AM
How to step forward bar by bar (F12) with full bar not half bar? mercyman MetaTrader 1 October 23rd, 2012 04:49 PM
Bar back adjusting line coding, is it possible? hector24 NinjaTrader 6 June 24th, 2011 06:40 PM
Horizontal line with text vast NinjaTrader Programming 2 February 4th, 2010 03:46 PM


All times are GMT -4. The time now is 03:00 AM. (this page content is cached, log in for real-time version)

Copyright © 2019 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