Click here to Login





                                                   Parse Error in Back Testing

  0

0
Stefan Kroscen
2010-07-20 21:45:57


I am getting parse errors when backtesting. I've spent the evening trying to resolve them, and at present I do not think this is my code as I have
tried commenting out some of the rules and re-adding them. At times they work, at other times they don't. It does not seem to be consistent.
Is there any way to further troubleshoot what is happening here?

Appreciate any help you can provide!

The trading rules are:


// Buy rules

Rule1 = chande_trendscore_SPY() >= 10;
Rule2 = sma(ChannelPosition(close,200),6) <= 0.2;
buy = (Rule1) && (Rule2);

// Sell rules

Rule3 = chande_trendscore_SPY() <= 0.0;
Rule4 = sma(ChannelPosition(close,200),6) >= 0.8;

sell = (Rule3) || (Rule4);


--------------------------------------------
chande_trendscore_SPY:

result = cFunctions.CompileFormula("b=GetSeries('SPY', close); a = iff(b>=Ref(b,11),1,-1)+iff(b>=Ref(b,12),1,-1)+iff(b>=Ref(b,13),1,-1)+iff(b>=Ref(b,14),1,-1)+iff(b>=Ref(b,15),1,-1)+iff(b>=Ref(b,16),1,-1)+iff(b>=Ref(b,17),1,-1)+iff(b>=Ref(b,18),1,-1)+iff(b>=Ref(b,19),1,-1)+iff(b>=Ref(b,20),1,-1);").GetVectorDouble("a");



QuantShare
2010-07-21 07:08:53

  0

Best Answer
Hi,

The problem is in the chande_trendscore_SPY. We will fix this issue in the next release.

In the meantime here is a simple fix:

VectorD vect = cFunctions.CompileFormula(.....
for(int i=0;i<result.Length;i++)
{
result[i] = vect[i];
}




Stefan Kroscen
2010-07-23 15:51:16

  0

Thanks, that works!


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
Standard Error of the Estimate of a Regression Line
Standard Error Bands
RSI + SMA(200) + Hurst v001
Price Channel Position
T-Score of a Trading System

How-to Lessons
How to debug a downloader
How to plot news on a chart?
How to import trading data from CSV files
How to create a chart with a black background
How to hide a trading indicator from a particular time frame

Related Forum Threads
Rules manager - comparing results - back testing vs rules analysi...
Back testing watch list
Accounting exact lot size of futures during back testing
Bob K. seeks back testing information.
Back testing -

Blog Posts
The Ultimate Guide to Create Trading Systems in QuantShare
Quantitative Analysis: Price Channels
Download Trading Data using the Pre-Script
Stock Market Prediction
How to search for a download item









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.