Click here to Login





                                                   Unexpected results

  0

0
F Mazandarany
2010-12-19 14:22:03


I'm using the following script in the Simulator to buy ILF when its close> its sma(200)*1.035 and sell ILF when its close< its sma(200)*0.965. I want to short and cpver with ^GSPC in the opposite direction;i.e.; short ^GSPC when ILF is sold and cover when it is bought. The simulator is run from 3/1/2004 through 12/18/2010. I'm getting some strange short trades that are inconsistent with the logic of the script as I understand the logic. I expect long ILF trades followed by short ^GSPC trades, followed by long ILF trades, so on. I'm reproducing the script for you to test.
//
ilfp=ticker("ILF",close,LastDate);
brule=ilfp>sma(ilfp,200)*1.035;
srule=ilfp<sma(ilfp,200)*0.965;
//Long Rules
buy=brule and StringEqual(name(),"ilf");
sell=srule and StringEqual(name(),"ilf");
//Short Rules
short=srule and StringEqual(name(),"^GSPC");
cover=brule and StringEqual(name(),"^GSPC");

//

Your help in deciphering what is happening is appreciated.



QuantShare
2010-12-20 06:04:22

  0

The formula is working; here are my results: (I have used A instead of ILF)


Symbol Trade Entry Exit
A (open) Long 30/09/2010 00:00 09/12/2010 00:00
^GSPC Short 30/06/2010 00:00 29/09/2010 00:00
A Long 29/06/2009 00:00 01/07/2010 00:00
^GSPC Short 05/09/2008 00:00 26/06/2009 00:00
A Long 21/05/2008 00:00 08/09/2008 00:00
^GSPC Short 19/12/2007 00:00 20/05/2008 00:00
A Long 30/11/2007 00:00 20/12/2007 00:00
^GSPC Short 12/11/2007 00:00 29/11/2007 00:00
A Long 06/09/2007 00:00 13/11/2007 00:00
^GSPC Short 16/08/2007 00:00 05/09/2007 00:00
A Long 22/12/2006 00:00 17/08/2007 00:00


- Note that in the first line you should use "LastData" instead of "LastDate".
- In the symbols list, you should add ILF and ^GSPC.
- Please check that your trading system has no money management script that modifies the simulation logic.



F Mazandarany
2010-12-20 10:36:00

  0

Thanks. I tried it again, it worked correctly once and then it started to act strangely again with unexpected short trades as well as short trades that start one day too soon, see picture using url below. Also note 3 consecutive short trades: one on 5/10/2010, one on 5/19/2010, and the last on 5/21/2010. I have no MM script on this Simulation, and have selected ILF and ^gspc with start date as 3/1/2004.

http://img831.imageshack.us/i/qs1vd.jpg/



QuantShare
2010-12-20 12:20:46

  0

There is a small optimization we have added in the previous version that caused this problem. The problem occurs only when using the "ticker" function with the simulator. We have already fixed this and the fix should be available in the next release.

In the meantime, you can create the same strategy using the MM:

Formula:

ilfp=ticker("ILF",close,LastDate);
brule=ilfp>sma(ilfp,200)*1.035;
srule=ilfp



QuantShare
2011-01-05 05:21:59

  0

Best Answer
The fix was released 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
Unexpected Short Selling Bars
Time Under Water - Drawdown
Moving Average Trends - Market Indicator
Chande TrendScore By Symbol
Advance Stocks & Volume - Stock that advanced with a volume incre...

How-to Lessons
Difference between the watchlist and the screener tools
How to run a screen or a watchlist from a script
How to automatically arrange charts?
How to calculate the average of a time series using the money man...
How to plot the relative performance of several stocks/indices

Related Forum Threads
Watchlists results are not matching criteria
Save simulation/backtest results
Why Would the Ranking Analyzer Results Differ Here?
NbPositions, deviations in backtesting results
Export Aggregate Case Results for Optimization

Blog Posts
Create a HTML or PDF Report of your Trading System Backtesting Re...
Troubleshooting a Trading System
3 Market Indicators based on Fundamental Data
Trading System: Buy stocks with the highest Sharpe ratio
How to choose which technical indicators to use in your trading s...









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.