Click here to Login





                                                   How do you sort simulations by the date that the simulation was run?

  0

0
Chaim6
2014-09-11 20:23:01


Is it possible to create a a simulation metric that displays the date that the simulation was run?

Thanks.



QuantShare
2014-09-12 04:41:56

  0

Best Answer
You can add a new metric and type:
Fitness = Double.Parse(DateTime.Now.ToString("MMddyyyy"));

To get something like:
09122014

If you need the data in text format then you must use the money management script.



Chaim6
2014-09-12 12:31:08

  1

Thanks that's a big help. I don't know why I didn't think of using 'DateTime.Now'.

The idea of using ToString("MMddyyyy") is good too. For example I have a different metric that I call 'End Date'. I was using:

Fitness = (Double)DailyReturn.GetDate(DailyReturn.Count-1).Year
+ (Double)DailyReturn.GetDate(DailyReturn.Count-1).Month/100
+ (Double)DailyReturn.GetDate(DailyReturn.Count-1).Day/10000;

I changed that to:

Fitness = Double.Parse(DailyReturn.GetDate(DailyReturn.Count-1).ToString("yyyy.MMdd"));

based on your idea. It's simpler :-). I put the year first to make sorting work. I also added a decimal after the year for readability. It seems like it gets rounded to three decimal places but it's good enough for my needs.

Thanks, and have a nice weekend.



QuantShare
2014-09-13 04:21:45

  0

Thanks for sharing this


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
How far are the close prices from the support line
Derivatives: Number of days until the expiration date
Stock Trading Rules - Percentage That Passed in the Last Trading ...
Long strategy created with the money management tool

How-to Lessons
How to add a metric in the trading system simulation report
How to plot a time-series that do not update the chart scale
How to perform a basic quantitative analysis using the S&P 500
How to plot the relative performance of several stocks/indices
How to display two stocks on the same chart

Related Forum Threads
how do you check if the price data is up to date?
How do you retrieve the entry and exit price for a position?
How do I change the date format?
How to get the last day of the month in C#
How do I get the date of the current bar in a custom function?

Blog Posts
How to use the new Market Regimes Feature in QuantShare Trading S...
Create a Pivot Table that displays the Relative Strength Index - ...
How to create market indicators using the composite function - Pa...
Fundamental analysis: How to track economic indicators in the For...
How to download the history of dividend payments for stocks in th...









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.