Click here to Login

                                                   Feature Request: LeftMostBar() or IsLeftMostBar()


Josh McCormick
2020-12-02 19:49:15

Title: LeftMostBar
Priority: Medium/High (I rarely flag one that high)

I've requested this feature before. It was turned down, but now that I'm running into more and more specific examples of where it is needed, I wanted to ask again:

I'd like a function that will return the position of the leftmost bar that is visible on-screen.

Preferred format --

integer = LeftMostBar (); ...or...
boolean = IsLeftMostBar ();

The first function would return the ID of the leftmost bar that is consistent with Count() and TotalBars().

The second function would return true if the current bar is the leftmost bar visible on-screen. Then if I want the number in a different way, I can use BarsSince(IsLeftMostBar()) or ValueWhen(IsLeftMostBar()) to turn it into some other value that I can work with.

The two most recent uses I had for this were:

1. A value I could compare against in the second parameter of PlotProfile so that I could limit the profile graph to just what is on-screen (or on-screen and beyond to the right), which is the most useful information I'd want a profile graph for.

2. A value I could compare against to highlight the on-screen gaps that have not since been filled in without polluting it with off-screen information.

Please give this feature request some further consideration. It's very useful and hopefully wouldn't be too difficult to implement.

Josh McCormick

2020-12-03 12:50:31

Hi Josh,

This is not possible as formulas are calculated once and not each time you move the chart.
The drawing tool script or the global script (Tools -> Script Editor) would be able to get visible bar's data but I understand that it may not be helpful for your use cases.

Josh McCormick
2020-12-03 13:07:03


I think I'll go ahead and pursue a custom script for myself. I'll be able to put the leftmost bar into a global variable and then pull that into my formula with GetVariable(). You make a strong point that formulas are not normally recalculated when you move the chart. That makes a great deal of sense. I'll probably have to use a SetVariable() function to set a flag to let my script know to update a chart when a formula is running that expects this behavior.

But still, you've explained this well enough. I get it now, thank you sir.

Josh McCormick

No more messages


No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"


Trading Items
Technical indicators time series
BSE Stock Exchange
Industry Weight
Historical Tick Data for U.S. Stocks
Put Call Volume Comparison Indicator

How-to Lessons
How to download new quotes when selecting a chart
How to quickly add a ticker symbol
How to install the previous version of QuantShare
How to use the Fibonacci retracement drawing tool
How to import trades into a portfolio

Related Forum Threads
PIVOT TABLES-a new feature
Excel like import feature
New Feature To Portfolio?
Live Simulation / "Bar by Bar" Feature
Cross Hair feature as in MT4

Blog Posts
How to use the new Market Regimes Feature in QuantShare Trading S...
Creating a download item: Initial Jobless Claims
Composite Indicators
Custom Shortcuts - Move a Chart to Display the Last Quotes/Data
Detect chart patterns using the auto support/resistance indicator

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2023
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Follow us on Google+
RSS Trading Items

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.