Fully pre-expanded intraday chart with fixed x-axis from the beginning of the session (4am) in ToS that fills up with candles like a blank canvas?

Glefdar

Active member
Is it possible and has anyone tried trading like this in ThinkorSwim? What I am imagining is an intraday chart that is fully zoomed out and expanded to show 4am to 8pm before the first candle has even painted. As more candles paint, instead of ThinkorSwim's chart view auto-scrolling to the right with the expansion area likewise being displaced further right over the course of the trading day, to the contrary the application behaves like it's just filling candles into an empty space that is like a canvas of preset size and the viewing area stays fixed. I assume this type of fixed view, fully pre-expanded chart should be an available setting but haven't seen it before, and I haven't found it described or shown in Google searches.
 
Solution
Quite an interesting solution, thanks for sharing this! I'm surprised that TOS doesn't natively offer a "fill into empty chart" style of fixed view for trading. Maybe it's deceptively hard for them to implement as an option due to fundamental aspects of how charting works in TOS.
See if the chart set to today in the following picture is what you are looking to get. The chart setting for time axis is 5 and keep time zoom is check marked.

Capture.jpg
here is a rough draft, that (sometimes) draws the current days chart on the first day period on the chart.
( on a 5min 5 day chart, it draws the bars during the last day, onto the first day on the chart)
it's not perfect , but i said i would post something, so i am. it may be a couple days till i get back to this. if anyone has ideas for improvement, please do.

can choose to turn off main candles
can choose to redraw candles as cyan or green/red

try different symbols.
these work, 15min 5 day works , EA , F , MRK,

it uses addchart() to draw new candles, not just a line.

problems:
..sometimes it works, sometimes it doesn't. some symbols cause it to redraw the first day bars over themselves. probably a problem with my method of determining the new period.

..because of different quantity of bars in premarket, sometimes the 8:30 bar of the current day is not aligned with 8:30 on 1st day on the chart.


note:
it uses this to turn off the main candles
input HidePrice = YES;
HidePricePlot(HidePrice);
if there is more than 1 study loaded with HidePricePlot() , they can interfere with each other, and cause this function to not do what is expected.
if the candles won't turn off, detach a chart and remove all studies, then load this one.

Ruby:
# showonly1day_01

# https://usethinkscript.com/threads/can-i-hide-the-chart-but-keep-the-lower-indicators.4170/
# show just candles for 1 day , 4am to 8pm
# start with 4am on left.  dont scroll candles off screen
# at 4am, the screen resets, blanks, and starts over with 1 candle on the left


# hidebars01 , turn off main price candles
input HidePrice = YES;
HidePricePlot(HidePrice);

input new_bars_as_blue = yes;

def na = double.nan;
def bn = barnumber();

# ---------------------------------

def istoday = if GetLastDay() == GetDay() then 1 else 0;

def dow = GetDayofWeek(GetYYYYMMDD());

# 4am to 8pm
input start1 = 0400;
input end1 = 2000;
def daytime = if secondsfromTime(start1) >= 0 and secondstillTime(end1) > 0 then 1 else 0;

def periodchg = (daytime <> daytime[-1]);
def daychg = (dow <> dow[-1]);

# ---------------------------------

# first bar , of first day on chart
def firstbn =
 if (bn == 1 and secondsfromTime(start1) == 0) then bn
 else if bn == 1 then 0
 else if firstbn[1] > 0 then  firstbn[1]
 else if secondsfromTime(start1) >= 0 then bn
 else firstbn[1];
def newfirstbn = highestall(firstbn);


def firstdaynum =
      if bn == 1 then 0
 else if firstdaynum[1] > 0 then firstdaynum[1]
 else if firstbn > 0 then dow
 else firstdaynum[1];


def lastbn = if bn == 1 then 0
 else if lastbn[1] > 0 then  lastbn[1]
 else if (bn > firstbn) and (periodchg or daychg) then bn
 else lastbn[1];
def newlastbn = highestall(lastbn);


def day1bars = (bn >= newfirstbn and bn <= newlastbn);

#addchartbubble(1, low*0.995, bn + "\n" + periodchg + "\n" + lastbn + "\n" + dow + "\n" + firstdaynum, color.cyan, no);
#addchartbubble(1, low*0.995, bn + "\nF " + firstbn + "\nL " + lastbn + "\nP " + periodchg + "\nD " + dow + "\n" + firstdaynum, color.cyan, no);
#addchartbubble(1, low*0.995, bn + "\n" + periodchg + "\n" + lastbn + "\n" + dow + "\n" + firstdaynum, color.cyan, no);
#addchartbubble(day1bars, high, "x" , color.cyan, yes);

# --------------------------------------

def newday_enable = ( bn >= newfirstbn and bn <= newlastbn);

# first bar , of current day
def currdayfirstbn = if bn == 1 then 0 else if (istoday and secondsfromTime(start1) == 0) then bn else currdayfirstbn[1];
def oldfirstbn = highestall(currdayfirstbn);

def off1 =  if newday_enable then (oldfirstbn - newfirstbn) else na;

# addchartbubble(1,low, bn + "\n" + newfirstbn + "\n" + newlastbn, color.cyan, no);

# calculate the offset
def lastBar = HighestAll(if !isNaN(close) then BarNumber() else 0);
#def offset = lastBar - firstbn;
#def offset = if (daytime and istoday) then bn else na;

def offset = off1;


def o = GetValue(open, -offset);
def c = GetValue(close, -offset);

# ----------- green
def h1;
def l1;
if (!new_bars_as_blue and c > o) then {
  h1 = GetValue(high, -offset);
  l1 = GetValue(low, -offset);
} else {
  h1 = na;
  l1 = na;
};
AddChart(high = h1, low = l1, open = o, close = c, type = ChartType.CANDLE, growcolor = color.light_green);

# --------- red
def h2;
def l2;
if (!new_bars_as_blue and c < o) then {
  h2 = GetValue(high, -offset);
  l2 = GetValue(low, -offset);
} else {
  h2 = na;
  l2 = na;
};
AddChart(high = h2, low = l2, open = o, close = c, type = ChartType.CANDLE, growcolor = color.light_red);

# --------- cyan
def h3;
def l3;
if new_bars_as_blue then {
  h3 = GetValue(high, -offset);
  l3 = GetValue(low, -offset);
} else {
  h3 = na;
  l3 = na;
};
AddChart(high = h3, low = l3, open = o, close = c, type = ChartType.CANDLE, growcolor = color.cyan);
#


EA 5min 5day
KK0G4Wr.jpg
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Quite an interesting solution, thanks for sharing this! I'm surprised that TOS doesn't natively offer a "fill into empty chart" style of fixed view for trading. Maybe it's deceptively hard for them to implement as an option due to fundamental aspects of how charting works in TOS.
 
Quite an interesting solution, thanks for sharing this! I'm surprised that TOS doesn't natively offer a "fill into empty chart" style of fixed view for trading. Maybe it's deceptively hard for them to implement as an option due to fundamental aspects of how charting works in TOS.
See if the chart set to today in the following picture is what you are looking to get. The chart setting for time axis is 5 and keep time zoom is check marked.

 
Solution
See if the chart set to today in the following picture is what you are looking to get. The chart setting for time axis is 5 and keep time zoom is check marked.

No, what I meant was like this:

YcpMcfvO_mid.png


Except imagine that there are no studies or trendlines, only candles, and instead of a day period, this was a 1min period chart, and the first candle was 9:30am and the last painted candle was something like 1:45pm, and the right-most unit of empty space where a candle could appear was 4:00pm, the last one-minute candle of the day. The chart would have this fixed view, never scrolling as the candles appeared, and would allow the space of the entire day to fill up that way.
 
No, what I meant was like this:

YcpMcfvO_mid.png


Except imagine that there are no studies or trendlines, only candles, and instead of a day period, this was a 1min period chart, and the first candle was 9:30am and the last painted candle was something like 1:45pm, and the right-most unit of empty space where a candle could appear was 4:00pm, the last one-minute candle of the day. The chart would have this fixed view, never scrolling as the candles appeared, and would allow the space of the entire day to fill up that way.
i think post #4 is what you are after.

in post#1 you said 4am to 8pm
now in post#5 you say 9:30 to 4 , ( open to close). this would have been easier
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
456 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top