NexusFi: Find Your Edge


Home Menu

 





Plotting range bars on a time chart?


Discussion in ThinkOrSwim

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




 
Search this Thread

Plotting range bars on a time chart?

  #1 (permalink)
 Captain135 
Bay Area, CA
 
Experience: Intermediate
Platform: TradeStation, TOS
Trading: Futures, Equities, Options on Futures
Posts: 48 since Feb 2017
Thanks Given: 53
Thanks Received: 30

I've been stuck for days trying to figure out how to plot range bars (with highlighting, text bubbles, or any other means) over a regular time chart in ToS. The reason I want to do this is because the built-in ToS range bars are inconsistent with their aggregation periods (they use tick data for previous 7 days, then 1 minute data for a few days, then 1 hour data etc.). I'd like to have range bar code on, for example, a 1 minute chart, so I could have it consistent throughout the chart.

For example, could anyone write code that would define and plot whenever the price moves up or down $5.00?

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
Deepmoney LLM
Elite Quantitative GenAI/LLM
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
Futures True Range Report
The Elite Circle
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
37 thanks
GFIs1 1 DAX trade per day journal
22 thanks
NexusFi site changelog and issues/problem reporting
22 thanks
The Program
20 thanks
  #2 (permalink)
 
lukeskywalker1's Avatar
 lukeskywalker1 
Los Angeles (CA)
 
Experience: Master
Platform: ThinkOrSwim
Trading: Currency Future, Stocks
Posts: 34 since Apr 2019
Thanks Given: 1
Thanks Received: 40


Captain135 View Post
I've been stuck for days trying to figure out how to plot range bars (with highlighting, text bubbles, or any other means) over a regular time chart in ToS. The reason I want to do this is because the built-in ToS range bars are inconsistent with their aggregation periods (they use tick data for previous 7 days, then 1 minute data for a few days, then 1 hour data etc.). I'd like to have range bar code on, for example, a 1 minute chart, so I could have it consistent throughout the chart.

For example, could anyone write code that would define and plot whenever the price moves up or down $5.00?

Hi mate. Try this one

An indicator signal when the stock has updated its high/low.

 
Code
input marketOpen = 930;
input marketClose = 1600;
input intraDaySpan = {Default «SameDay» , «OverNight»};
def OpenCounter = SecondsFromTime(marketOpen);
def CloseCounter = SecondsTillTime(marketClose);
def MarketHours = if OpenCounter >= 0 and CloseCounter >= 0 then 1 else 0;
def beforeMidnight = OpenCounter >= 0 and CloseCounter <= 0;
def afterMidnight = OpenCounter <= 0 and CloseCounter >= 0;
def Today ;
def hideChartBubbles ;
rec DailyHigh ;
rec DailyLow ;
switch (intraDaySpan) {
case «SameDay»:
Today = if GetDay() != GetDay()[1] then 1 else 0;
DailyHigh = if Today then high else if MarketHours then if high > DailyHigh[1] then high else DailyHigh[1] else high;
DailyLow = if Today then low else if MarketHours then if low < DailyLow[1] then low else DailyLow[1] else low;
hideChartBubbles = MarketHours;
case «OverNight»:
Today = 0;
DailyHigh = if Today then high else if beforeMidnight or afterMidnight then if high > DailyHigh[1] then high else DailyHigh[1] else high;
DailyLow = if Today then low else if beforeMidnight or afterMidnight then if low < DailyLow[1] then low else DailyLow[1] else low;
hideChartBubbles = beforeMidnight or afterMidnight;
};
AddLabel(close > 0, Concat( «Dly High: » , DailyHigh), Color.GRAY);
AddLabel(close > 0, Concat( «Dly Low: » , DailyLow), Color.GRAY);
plot TodaysHigh = DailyHigh;
plot TodaysLow = DailyLow;
TodaysHigh.SetDefaultColor(Color.GREEN);
TodaysLow.SetDefaultColor(Color.RED);
AddChartBubble(DailyHigh > DailyHigh[1] and hideChartBubbles, DailyHigh, «Hi», color.GREEN, yes);
AddChartBubble(DailyLow < DailyLow[1] and hideChartBubbles, DailyLow, «Lo», color.RED, no);
Alert(DailyHigh > DailyHigh[1] and hideChartBubbles, «New High», Alert.BAR, Sound.RING);
Alert(DailyLow < DailyLow[1] and hideChartBubbles, «New Low», Alert.BAR, Sound.RING);plot Data = close;
2017-12-05_9-55-03-300x284

Visit my NexusFi Trade Journal Reply With Quote
  #3 (permalink)
 Captain135 
Bay Area, CA
 
Experience: Intermediate
Platform: TradeStation, TOS
Trading: Futures, Equities, Options on Futures
Posts: 48 since Feb 2017
Thanks Given: 53
Thanks Received: 30


Thanks for the reply Luke! I don't see any obvious way to re-tool that code from highs/lows to range bars.

Started this thread Reply With Quote
  #4 (permalink)
stasbz
Russia
 
Posts: 10 since Nov 2013
Thanks Given: 1
Thanks Received: 0

is it possible to mark high/lows only after two and more bars not breaking high/low?

Reply With Quote




Last Updated on March 13, 2021


© 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