Click here to Login








Backtest different Segments in your Trading System

by QuantShare, 1175 days ago
Share |






This function allows you to enter several criteria (segments) and an index. It then calculates the result of the segment referenced by the index.

Let us say that for example, you want to create two segments:
Overbought Stocks
Oversold Stocks

The formula for each segment is:
rsi(14) > 70
rsi(14) < 30

Here is how to use this function:
a = segment("rsi(14) > 70;rsi(14) < 30", -1);
b = segment("rsi(14) > 70;rsi(14) < 30", 0);
c = segment("rsi(14) > 70;rsi(14) < 30", 1);

The variable "a" will get the number of segments, which is "2" in this case. This is a special case: by specifying a negative index, the "segment" function returns the number of segments.
The variable "b" will calculate the first segment and return the result of the following function: rsi(14) > 70
The variable "c" will calculate the second segment and return the result of the following function: rsi(14) < 30


How could it be useful?

This trading indicator can be really useful if you want to optimize for example a trading system by testing several rules/segments.

Optimize("a", 0, 1, 1);
rule1 = segment("rsi(14) > 70;rsi(14) < 30", a);

buy = close > close[1] and rule1;


By optimizing the above trading system, QuantShare will backtest two trading systems:
1/ Price is higher than yesterday's price and stock is overbought
2/ Price is higher than yesterday's price and stock is oversold

You can of course add as many segments as you want. And you can also combine segments by creating several calls to the "segment" function.

Another example:

Optimize("a", 0, 1, 1);
Optimize("b", 0, 2, 1);
rule1 = segment("rsi(14) > 70;rsi(14) < 30", a);
rule2 = segment("close > 2;close > 10;close > 20", b);

buy = close > close[1] and rule1 and rule2;

// The above trading system will create 6 combinations


Share This ->
Share |


You have to log in to bookmark this object
What is this?
Additional Information




Type: Trading Indicator

Object ID: 1369


Country:
All

Market: All

Style:
Technical Analysis

Reviews
You must log in first

Join now
and get instant access for free to the trading software, the Sharing server and the Social network website.
Click here


Related objects

Empty

Number of reviews
Click to add a review
Average rate
Click to rate this item
Number of times this object was downloaded
Number of rates the current object received
Report an object
if you can't run it for example or if it contains errors
Click to report this object

Technical Analysis


Fundamental Analysis



Random Blog Posts

Backtesting Your Trading Systems: Symbol Segmentation

Update Chart Layout based on Active Time Frame

Presentation of QuantShare's new Real Time Version

Charting, Backtesting and Trading using Fundamental Data

Different Ticker Symbols for Each Data Source

How to Automatically Import Local Data Into QuantShare

How to Switch On/Off Trading Rules in Your Stock Trading System

Backtesting a Strategy Based on Bond and Stock Index ETFs

Show All

Number of reviews
Click to add a review
Average rate
Click to rate this item
Number of times this object was downloaded
Number of rates the current object received
Report an object
if you can't run it for example or if it contains errors
Click to report this object






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 2017 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.