Click here to Login





                                                   Get current simulation date

  0

0
SergejSuperstock
2016-04-22 15:58:42


Dear Quantshare,

as I am using quite complex custom indicators, my screens take quite a long time to calculate. I then found out, that by modifying my indicator I can get a massive speedup: In the indicator, instead of calculating the values for the whole "result-array", I just calculate the value for the current bar (same as the bar that my screener is looking at).

To be able to screen at past bars, I calcultate the current bars difference from the total of bars. This number is then transfered from the screener to the indicator as a static parameter.

currentbar = TotalBars() - Count() - 1;
AddColumn('CurrentBar', currentbar); // Screening on a past date, currentbar returns 30 in the screener
AddColumn('myIndicator', myIndicator(30)); // Indicator is just calculating result[cFunctions.Close.Length - 30]

So far so good. Now I want to use this method in the simulator. So I need to change my static indicator-parameter to a dynamic one, containing the date or bar number the simulator is currently looking at. Is this possible?



QuantShare
2016-04-23 05:41:55

  0

The simulator does not run the indicator once per bar. It calculates it once and then use the result to generate signals.
So this screening optimization would not work with the simulator since all indicators bar values are needed by the simuator.



SergejSuperstock
2016-04-25 12:59:28

  0

Ok, thanks for the info!


No more messages
0




Reply:

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"










QuantShare

Trading Items
Vary the Start Date of a Trading System Simulation
BSE historical data by date
Year to Date Change Indicator
Number of Days to a Specific Date
Equity and Date Export To Excel

How-to Lessons
How to get fundamental data for U.S. Stocks
How to add a metric in the trading system simulation report
How to create a Monte Carlo simulation
How to get trading orders from a portfolio programmatically
How to get stocks for a particular index using the global script

Related Forum Threads
How do I get the date of the current bar in a custom function?
code to get todays date
How do you sort simulations by the date that the simulation was r...
How to read date and get quote of next day.
How to get the last day of the month in C#

Blog Posts
True portfolio simulation applied to trading systems
How to use date components in your trading rules
4 Links to Download Free Historical Stock Prices Data by Date
Step by step on how to get free realtime/delayed data for stocks,...
3 Items To Get and Trade the News In QuantShare Platform









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
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.