Click here to Login





                                                   Output window problem

  0

0
F Mazandarany
2010-12-09 11:44:41


I'm starting a new tag to report my continuing problem with the Output window when running the Simulator. With your generous help I have a strategy using MM working properly. It has a script to send daily ROC to the output window. The problem is that the starting date in the output window has nothing to do do with the starting date selected in the strategy. I have two pictures(SPY and SPY-1) using the same strategy withe two entirely different starting dates as you can see from the trades on the corresponding Simulator reports( 1/1/2000, and 1/1/2003), but the Output window starts with the same date(2/27/2006). All dates after 2/26/2006 return the correct starting dates on the Output window. This may be because the Output window can't handle more bars, or perhaps it has something to do with the short Feburary month in 2006. All selected dates prior to 2/27/2006 return the same starting date:2/27/2006 in the Output window. This obviously has nothing to do with clearing the output window prior to executing a new strtegy. I have been doing that in all cases! I'm reproducing the Strategy Script for you to test.
First, here is the picture upload URL:
http://img202.imageshack.us/i/spy1u.jpg/
http://img593.imageshack.us/i/spyu.jpg/

The script follows;

string symbolLong = "spy";
string symbolShort = "SPY";
string rule1 = "a = close > sma(200)*1.035;";
string rule2 = "a = close < sma(200)*0.965;";
TimeSeries buy = Data.ParseFormula(rule1).GetTimeSeries(symbolLong, "a");
TimeSeries sell = Data.ParseFormula(rule2).GetTimeSeries(symbolLong, "a");

if(buy[0] > 0)
{
if(!Portfolio.IsInPortfolio(symbolLong, true))
{
Functions.CloseAllPositions(0);
Portfolio.UpdateCategorySettings("short", 0, 1, null);
Portfolio.UpdateCategorySettings("long", 100, 1, null);

Functions.AddLongPosition(symbolLong, null);
}
}
else if(sell[0] > 0)
{
if(!Portfolio.IsInPortfolio(symbolShort, false))
{
Functions.CloseAllPositions(0);
Portfolio.UpdateCategorySettings("long", 0, 1, null);
Portfolio.UpdateCategorySettings("short", 100, 1, null);

Functions.AddShortPosition(symbolShort, null);
}
}
if(Variables.IsVariableExists("equity"))
{
double equity = (double)Variables.GetVariable("equity");
double roc = Math.Round(((Portfolio.Equity / equity) - 1) * 100, 4);
Global.Trace(Divers.CurrentDate.ToString() + (char)Keys.Tab + roc);
}

Variables.SetVariable("equity", Portfolio.Equity);



QuantShare
2010-12-09 14:13:46

  0

- Yes you are right, there is a limit in the number of lines the output window can display. We will increase this limit.

- Another solution is to add the following code:

if(Variables.IsVariableExists("equity"))
{
double equity = (double)Variables.GetVariable("equity");
double roc = Math.Round(((Portfolio.Equity / equity) - 1) * 100, 4);
string text = Divers.CurrentDate.ToString() + (char)Keys.Tab + roc;
Variables.SetVariable("output", Variables.GetVariable("output") + Environment.NewLine + text);
}
else
{
Variables.SetVariable("output", "");
}

Variables.SetVariable("equity", Portfolio.Equity);

- And the following line in the "OnEndSimulation" event:
System.IO.File.WriteAllText("c:\\output.txt", (string)Variables.GetVariable("output"));

This will save the data in a file: c:\output.txt

- Don't forget to remove the old code:

if(Variables.IsVariableExists("equity"))
{
double equity = (double)Variables.GetVariable("equity");
double roc = Math.Round(((Portfolio.Equity / equity) - 1) * 100, 4);
Global.Trace(Divers.CurrentDate.ToString() + (char)Keys.Tab + roc);
}

Variables.SetVariable("equity", Portfolio.Equity);




F Mazandarany
2010-12-10 11:26:14

  0

Thank you; this works well. When would you be increasing the output window look back limit? I would like to see the equivalent of at least 10 years/4000 days.Thanks again.


QuantShare
2010-12-10 11:40:59

  0

In the next release (2 weeks)



QuantShare
2011-01-05 05:35:13

  0

Best Answer
We increased the output form buffer limit in version 2.1.2



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
Average Output Per Month
Per Symbol Average Output
Output metric for each trading year
Average Output Per Year
Adaptive Asset Allocation Butler V1.3 AMM

How-to Lessons
How to debug a trading system using the money management tool
How to calculate the average of a time series using the money man...
How to print a chart
How to optimize a neural network using a genetic algorithm
How to create and trade a Neural Network model

Related Forum Threads
Clear output window
problem with nse data
Problem with "Save Trading System" in Optimizer
Add'l Fields in Rules Analyzer Output
C# Output for Validation

Blog Posts
Optimization of trading rules
How to Detect Potential Issues/Errors in Your Historical Data?
Compare stocks and securities by creating a relative performance ...
QuantShare Trading Software: New Features in the 3.4.2 Version
Backtesting All Candlestick Patterns in 10 Minutes









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.