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