Click here to Login

                                                   Variables and their use when creating indicators?


Josh McCormick
2020-07-05 17:46:53

Is there a document which describes the most important variables to use when creating at technical indicator? What range of values need to be updated? (I'm currently updating from 0 to numBars but I'm sure that overkill causes a performance hit). I'm also seeing different variables to use if they're on an IntraDay chart? There seems to be so many things going on, I'm hoping you can point me to a quick document (or create one) which covers what variables I should be looking at and how far many bars back I should be filling in data for (if it is going to be plotted)?

Thank you,
Josh McCormick

Josh McCormick
2020-07-05 23:09:03


I figured out a few variables, but by no means all (or how much I need to update under what circumstances).

TotalBars() represents the total number of bars or ticks from beginning to end.
Count() returns the id number for the bar that you're currently hovering over

I still haven't found the variables which tell me what range of Bars is on-screen right now. If I want to re-scale just the amount of data that I have on screen (so the smallest item is "0" and the largest item is "100"), I don't know where I'm supposed to begin and end. Hopefully someone can help! :)

2020-07-06 12:34:23


Depending on the technical indicator you want to create, you will end up using different functions.
Some of the popular ones are:

All functions/indicator you create will be calculated based on all the data (not on the on-screen data).
If you use:
a = sma(14);

Then this will calculate 14-bar simple moving average based on all data. You should not both with on-screen data.

In the formula editor (right click on a chart then select "Edit formula"), click on "Add Indicator" and you will see all indicators by category with the description and the different parameters it accept.

Josh McCormick
2020-07-14 11:11:39


Are there any functions that I can use to determine the following?

1. How many bars across the pane (chart) is
2. Which bar is the first one?
3. Which bar is the last one?

As an example use, I might want to display the trading volume range that's currently on-screen. But I can't make that computation without knowing the current starting point and range of the chart.

Your thoughts?

2020-07-18 11:10:49


no, because the formula is applied once to all bars.
You can create custom drawing tool for that.

The drawing will get the appropriate information and display a text information with the volume range.

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
Market Rule based on the Crossover Between Stock Close prices and...
Percentage of Stocks that are trading between their 50 and 200-da...
Tweet Sentiment Index for the Forex and Stock Market
Bull and Bear Power
Percentage of Stocks Trading Above their Pivot Point

How-to Lessons
How to download and use U.S. stocks earnings data
How to speed up watchlist and screener plug-ins when working with...
Difference between the watchlist and the screener tools
How to use QuantShare with Metastock data
How to save and restore charts

Related Forum Threads
How do I use variables in Money Management Scripts?
Money Management Script variables and more
Use mass rule generator and mask to generate rule combinations
VectorR and use of GetCustomDatabaseRawData
Looping within a screener and how to use RemoveSameSignals

Blog Posts
Compare stocks and securities by creating a relative performance ...
Creating and managing notes for your stocks
How to Download and Use Fundamental Data
Industry Analysis - How to Compare Stocks with their Industries
Different Types of Trading Indicators: Trend, Momentum, Volatilit...

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.