Click here to Login

                                                   How can I loop/iterate over a parameter list?


Aditya Jagirdar
2019-06-23 23:44:06

To a given method, say ref(close, 10), is there anyway to iterate this method over a range of values for the parameter.

For example, I would like to do something like:

for(i=0; i<20; i++) {

x = ref(close, i)

2019-06-26 09:46:38


You need to create a custom function for this. You can then develop your functions using C# (Tools -> Create Functions)
QS language is a vector-based language, any variable references a vector/array.

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
Average Year over Year Indicator
How far are the close prices from the support line
Year over Year Chart Indicator
Highest and Lowest value over a dynamic period
Number of Buy Signals Over Time in a Simulation

How-to Lessons
How to draw distances on a chart?
How to get trading orders from a portfolio programmatically
How to add a trading indicator to a chart
How to display notes/commentaries on a chart
How to create trading rules based on Put and Call volume data

Related Forum Threads
How can I set Log Scale charts?
How can I see charts with logarithmic scale on y-axis?
Can not move a square lying over a line
How can I incorporate earnings release data into my backtests scr...
How can I view signals rejected by the simulator?

Blog Posts
How to Create a Custom Real-Time Table using QS Trading Software
How to download the history of dividend payments for stocks in th...
Let me Show You How to Create Hundreds of Profitable Trading Syst...
Learn How to Create Your Own Technical Analysis Indicators
Industry Analysis - How to Compare Stocks with their Industries

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

Copyright 2020
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.