Click here to Login





                                                   Cycle Trading Rule

  0

0
dan
2011-08-21 23:45:32


Hello,

I have a custom database with entry and exit date fields for Long and Short positionsl , how can I create trading rules based on these dates, is it possible for QS to read date format
columns and plot B and S arrows on chart for these dates?
Can I plot Buy and Sell arrows in future bars?

Thanks in advance
.D



QuantShare
2011-08-22 09:16:59

  0

Hi,

There are several functions to reference custom database data.
For example: GetDataCount("database", "field") gets one if there is a long/short position on a particular date.

Can you give me an example so I can help you implement it?

It is not possible to plot Buy and Sell arrows in future bars.
The only way to plot something in future bars is by using Drawing tools and custom drawing tools.




dan
2011-08-23 19:00:36

  0

here is a sample of the database:

Trade Entry Date Exit Date
B 6/27/2011 7/7/2011
S 7/7/2011 7/19/2011
B 7/19/2011 7/28/2011
S 7/28/2011 8/8/2011
B 8/8/2011 8/17/2011
S 8/17/2011 8/26/2011
B 8/26/2011 9/7/2011
S 9/7/2011 9/16/2011
B 9/16/2011 9/27/2011
S 9/27/2011 10/6/2011
B 10/6/2011 10/17/2011
S 10/17/2011 10/27/2011
B 10/27/2011 11/7/2011
S 11/7/2011 11/16/2011
B 11/16/2011 11/25/2011
S 11/25/2011 12/6/2011
B 12/6/2011 12/16/2011
S 12/16/2011 12/27/2011
B 12/27/2011 1/5/2012
S 1/5/2012 1/16/2012
B 1/16/2012 1/25/2012

This sample is from database with cycle turns only. If It can be used for the purpose, great. If not I can get database with all market dates with B and S for the turns dates and blank on other dates.

Thank you again. U ROCK



QuantShare
2011-08-24 08:06:37

  0

Is this an external database or a custom database (QuantShare database) ?

If it is a QuantShare database, then please give me the exact format (Data -> Edit databases -> Custom ...)
If it is an external database (File) then did you try (Data -> ASCII Import) importing this database to QuantShare?




dan
2011-08-31 22:37:00

  0

external database, imported in QS. I've edited now having two fields: 'Trade'(B/S) and 'Date' (Turn).

B 8/17/2011
S 8/26/2011
B 9/7/2011
S 9/16/2011
B 9/27/2011
S 10/6/2011

I am using these turn dates as the start of my strategy.
thank you for co-creating it;

Always one position open (long/Short)
Reverse current position on the first bar in a 5-bar period around turn date*(date' +/- 2 bars) when all rules from a basket apply

could you please ilustrate these 3 examples?
-there is a 'B' or 'S' for the 5-bar period of turn 'Date'
-VIX has crossed the upper or lower Bolinger Bands on the past fourteen bars
-RSI crosses 70 or 30.

case any of rules doesn't apply the program holds current position.

Each usymbol will have its own turn dates file, how can I associate them?

ty .D

P.S. Is there a way to sort (ascending or descending) dates for importing?



QuantShare
2011-09-01 11:13:52

  0

Examples:
1- Example with "B". Get signal on "B" trade (valid for the last 5 trading days)
a = GetDataStringCount("Database Name", "Trade", "B");
rule1 = hhv(a, 5);
2-
What is VIX in your strategy? Index?
3-
rule3 = cross(rsi(14), 70) or cross(rsi(14), 30);

Notes:
- "GetData..." function automatically gets database date and adjusts dates.
- Dates are automatically sorted after import



dan
2011-09-01 14:16:15

  0

2-
^VIX Index (yahoo symbol)


... About exporting, can I sort?

much obliged.



QuantShare
2011-09-02 04:15:02

  0

2-
vix1 = GetSeries('^VIX', close);
a = cross(vix1, BbandsUpper(vix1, 30, 2, _MaSma));
a = hhv(a, 14);

- Dates are automatically sorted after import




dan
2011-09-02 23:21:56

  0

The simulator didnt take any positions with formula described below
My goal Is to long GLD on "B" Dates and short on "S" dates
I have added the symbol GLD to my strategy.

fiormula:
// Buy rules

Rule1 = GetDataStringCount('gld turns', 'trade', 'B');
buy = (Rule1);

// Sell rules

Rule2 = GetDataStringCount('gld turns', 'trade', 'S');
sell = (Rule2);

// Short rules

Rule3 = GetDataStringCount('gld turns', 'trade', 'S');
short = (Rule3);

// Cover rules

Rule4 = GetDataStringCount('gld turns', ,'trade,'B');
The simulator didn't take any posisions, How can I long and short on these dates?



QuantShare
2011-09-03 04:55:50

  0

Make sure that the database name is 'gld turns' and the field name is 'trade'.

You can check the formula by plotting it on a chart:

Rule1 = GetDataStringCount('gld turns', 'trade', 'B') > 0;
Plot(Rule1, "");




dan
2011-09-06 15:01:57

  0

The dababase name and field name are correct. I can see the data on 'database data' pane. I typed the formula:
Rule1 = GetDataStringCount('gld turns', 'trade', 'B') > 0;
Plot(Rule1, "");

on the chart but all I got was horizontal line at level '0'.



QuantShare
2011-09-07 04:06:37

  0

Best Answer
Make sure that you are selecting the appropriate symbol in the chart (GLD) and that the content of the database field is exactly "B" (with no extra space).

Please send me a screenshot of the chart and "database data" control to support@quantshare.com






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 Performance of a trading rule during that past N days
Strategy Indicator - Percent winning trades for a trading rule
Transform any order into a limit order selectively based on a tra...
Percentage of Bars a Trading rule Generates Buy/Sell Signals
State Change Pattern in a Trading Rule

How-to Lessons
How to create a trading system
How to get trading orders from a portfolio programmatically
How to optimize the number of positions in a trading system
How to export trading data to a CSV file
How to set order type of a trading system programmatically

Related Forum Threads
State Change Pattern in a Trading Rule
Simulator Trading System Report
Comp Function in Trading System Rules
ApplyRule example in trading system
Create a trading system

Blog Posts
Improve your trading system performance by ranking stocks
How to Switch On/Off Trading Rules in Your Stock Trading System
Create Profitable Trading Strategies with Exchange Traded Funds (...
6 techniques to improve the performance of your stock trading str...
4 indicators to create adaptive trading systems









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.