找回密码
 注册
搜索
查看: 1486|回复: 21

One DT test

[复制链接]
发表于 2008-7-31 02:10 AM | 显示全部楼层 |阅读模式


看了dahutu的神奇ATM,非常羡慕。今天晚上用td的strategy desk也设计了一个。

 

就纯粹用Stochastic。每次投入1000,没考虑手续费。其中有一个

dia DT with Stochastic 1 minutes Stochastic>20 in 1 minutes 7/30/2008 12:02:00 Buy 10 115.05 0.00 0.00 2.10
dia DT with Stochastic 1 minutes Stochastic<=80 in 1minutes 7/30/2008 13:01:00 Sell 10 114.41 -6.40 -0.56 -4.30

如果这里止损的话,daily return可以达到将近2%。

另外test了这星期一和星期二,都是正return。星期二return最多,因为这个是只做多的,那天大盘涨的最多。星期一因为是下跌日,所以return最少。不过如果加上一个大盘DIA跌0.25就止损的话,return依然超过1%。

 

还在学习中,不知道在strategy desk怎么写止损。请各位高手指教,也请大家share你们的DT strategy!

 

 

Symbol Strategy Signal Date Time Action Quantity Price Profit-Loss Profit-Loss % Cumulative P&L
dia DT with Stochastic 1 minutes Stochastic>20 in 1 minutes 7/30/2008 09:57:00 Buy 10 115.04 0.00 0.00 0.00
dia DT with Stochastic 1 minutes Stochastic<=80 in 1minutes 7/30/2008 10:07:00 Sell 10 115.08 0.40 0.03 0.40
dia DT with Stochastic 1 minutes Stochastic>20 in 1 minutes 7/30/2008 10:46:00 Buy 10 115.17 0.00 0.00 0.40
dia DT with Stochastic 1 minutes Stochastic<=80 in 1minutes 7/30/2008 10:50:00 Sell 10 115.19 0.20 0.02 0.60
dia DT with Stochastic 1 minutes Stochastic>20 in 1 minutes 7/30/2008 10:59:00 Buy 10 114.94 0.00 0.00 0.60
dia DT with Stochastic 1 minutes Stochastic<=80 in 1minutes 7/30/2008 11:08:00 Sell 10 115.09 1.50 0.13 2.10
dia DT with Stochastic 1 minutes Stochastic>20 in 1 minutes 7/30/2008 11:27:00 Buy 10 115.12 0.00 0.00 2.10
dia DT with Stochastic 1 minutes Stochastic<=80 in 1minutes 7/30/2008 11:31:00 Sell 10 115.07 -0.50 -0.04 1.60
dia DT with Stochastic 1 minutes Stochastic>20 in 1 minutes 7/30/2008 11:41:00 Buy 10 114.99 0.00 0.00 1.60
dia DT ith Stochastic 1 minutes Stochastic<=80 in 1minutes 7/30/2008 11:58:00 Sell 10 115.04 0.50 0.04 2.10
dia DT with Stochastic 1 minutes Stochastic>20 in 1 minutes 7/30/2008 12:02:00 Buy 10 115.05 0.00 0.00 2.10
dia DT with Stochastic 1 minutes Stochastic<=80 in 1minutes 7/30/2008 13:01:00 Sell 10 114.41 -6.40 -0.56 -4.30
dia DT with Stochastic 1 minutes Stochastic>20 in 1 minutes 7/30/2008 13:13:00 Buy 10 114.25 0.00 0.00 -4.30
dia DT with Stochastic 1 minutes Stochastic<=80 in 1minutes 7/30/2008 13:24:00 Sell 10 114.51 2.60 0.23 -1.70
dia DT with Stochastic 1 minutes Stochastic>20 in 1 minutes 7/30/2008 13:59:00 Buy 10 114.27 0.00 0.00 -1.70
dia DT with Stochastic 1 minutes Stochastic<=80 in 1minutes 7/30/2008 14:08:00 Sell 10 114.20 -0.70 -0.06 -2.40
dia DT with Stochastic 1 minutes Stochastic>20 in 1 minutes 7/30/2008 14:17:00 Buy 10 114.26 0.00 0.00 -2.40
dia DT with Stochastic 1 minutes Stochastic<=80 in 1minutes 7/30/2008 14:38:00 Sell 10 114.71 4.50 0.39 2.10
dia DT with Stochastic 1 minutes Stochastic>20 in 1 minutes 7/30/2008 14:52:00 Buy 10 114.73 0.00 0.00 2.10
dia DT with Stochastic 1 minutes Stochastic<=80 in 1minutes 7/30/2008 15:02:00 Sell 10 114.73 0.00 0.00 2.10
dia DT with Stochastic 1 minutes Stochastic>20 in 1 minutes 7/30/2008 15:13:00 Buy 10 114.56 0.00 0.00 2.10
dia DT with Stochastic 1 minutes Stochastic<=80 in 1minutes 7/30/2008 15:42:00 Sell 10 115.56 10.00 0.87 12.10
dia DT with Stochastic 1 minutes Stochastic>20 in 1 minutes 7/30/2008 15:56:00 Buy 10 115.48 0.00 0.00 12.10

[ 本帖最后由 liuyifei 于 2008-7-31 03:18 编辑 ]
Stochastic.JPG
发表于 2008-7-31 02:31 AM | 显示全部楼层

我明天可以backtest一下

只用Stoc吗?长度取多少?需要scale out吗?




[ 本帖最后由 Quantum 于 2008-7-31 03:32 编辑 ]
回复 鲜花 鸡蛋

使用道具 举报

 楼主| 发表于 2008-7-31 02:42 AM | 显示全部楼层

什么叫scale out?

我用的是(10,3,3)在minute图上,这个是根据我的理解和经验。要是能backtest很多天,也许能找到一个最好的组合。

 

原帖由 Quantum 于 2008-7-31 03:31 发表 只用Stoc吗?长度取多少?需要scale out吗?

回复 鲜花 鸡蛋

使用道具 举报

发表于 2008-7-31 03:58 AM | 显示全部楼层

回复 1# liuyifei 的帖子

"不知道在strategy desk怎么写止损"
in sell logic add:
OR Bar[Low,1] < EntryPrice-0.25
With stop loss: here is backtest results from 7/1/2008 to now using 1000 shares:
Symbol DIA
Strategy Stoch K
Profit-Loss -4446.33
Profit-Loss % -3.87
# Winners 141
# Losers 141
% Winners 50
Profit Factor 0.85
Avg Trade -15.77
Avg Winner 184.56
Avg Loser -216.09
Largest Winner 1011.48
Largest Loser -648.52
Buy&Hold Return 3.02
Annual Return -48.25
Max Consec. Winners 7
Max Consec. Losers 6

Without stop loss:
Strategy Stoch K
Profit-Loss -2841.09
Profit-Loss % -2.47
# Winners 104
# Losers 81
% Winners 56.22
Profit Factor 0.87
Avg Trade -15.36
Avg Winner 185.17
Avg Loser -272.83
Largest Winner 991.48
Largest Loser -1448.52
Buy&Hold Return 3.02
Annual Return -30.87
Max Consec. Winners 10
Max Consec. Losers 8 [ 本帖最后由 Dahutu 于 2008-7-31 05:03 编辑 ]
回复 鲜花 鸡蛋

使用道具 举报

发表于 2008-7-31 06:05 AM | 显示全部楼层
for the backtests above: considered commission, didn't close position at the end of the day [ 本帖最后由 Dahutu 于 2008-7-31 07:08 编辑 ]
回复 鲜花 鸡蛋

使用道具 举报

发表于 2008-7-31 10:58 AM | 显示全部楼层
加个trend indicator : MACD his. 啥的,两边都可以做!
回复 鲜花 鸡蛋

使用道具 举报

发表于 2008-7-31 12:37 PM | 显示全部楼层

scale out就是分期出货了

达到第一个target怎么样,第二个target又怎么样之类的。

你是用%k还是%D? Strategydesk help在这里。我不懂第三个参数,%K smoothing parameter是什么意思。

我没试过只用这么一个indicator的系统,估计效果不会好。我收集了不少oscillator类型的indicator,不过主要是用在daily chart上,没试过DT。

我可以backtest从2007年中到现在几百个交易日的1-min bar,然后在此基础上优化参数。


原帖由 liuyifei 于 2008-7-31 03:42 发表 什么叫scale out? 我用的是(10,3,3)在minute图上,这个是根据我的理解和经验。要是能backtest很多天,也许能找到一个最好的组合。
[ 本帖最后由 Quantum 于 2008-7-31 13:42 编辑 ]
1.PNG
回复 鲜花 鸡蛋

使用道具 举报

 楼主| 发表于 2008-7-31 03:09 PM | 显示全部楼层

谢谢大糊涂。等候你今天的record!虽然不知道你具体用什么indicator,但对我非常有启发。

 

原帖由 Dahutu 于 2008-7-31 04:58 发表 "不知道在strategy desk怎么写止损" in sell logic add: OR Bar[Low,1] < EntryPrice-0.25 With stop loss: here is backtest results from 7/1/2008 to now using 1000 shares: Symbol DIA Strategy ...

回复 鲜花 鸡蛋

使用道具 举报

 楼主| 发表于 2008-7-31 03:11 PM | 显示全部楼层

就是full stochastic

http://www.google.com/search?q=stochastic%2Cstockcharts&rls=com.microsoft:en-us:IE-SearchBox&ie=UTF-8&oe=UTF-8&sourceid=ie7&rlz=1I7GGIG

 

单单一个indicator效果肯定不好。dahutu说他基本用pattern和EMA,这些indicator只是用来warning,我觉得这个策略很好。周末我再试验一些别的。

 

原帖由 Quantum 于 2008-7-31 13:37 发表 达到第一个target怎么样,第二个target又怎么样之类的。你是用%k还是%D? Strategydesk help在这里。我不懂第三个参数,%K smoothing parameter是什么意思。我没试过只用这么一个indicator的系统,估计效果不会好。我 ...

回复 鲜花 鸡蛋

使用道具 举报

发表于 2008-8-1 01:01 AM | 显示全部楼层

Stoc Full也是可以赚钱的

1. Definition from Stockcharts:

http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:stochastic_oscillator

The Full Stochastic Oscillator takes three parameters. Just as in the Fast and Slow versions, the first parameter is the number of periods used to create the initial %K line and the last parameter is the number of periods used to create the %D (full) signal line. What's new is the additional parameter, the one in the middle. It is a "smoothing factor" for the initial %K line. The %K (full) line that gets plotted is a n-period SMA of the initial %K line (where n is equal to the middle parameter).

The Full Stochastic Oscillator is more advanced and more flexible than it's Fast and Slow cousins. You can even use it to duplicate the other versions. For example, a (14, 3) Fast Stochastic is equivalent to a (14, 1, 3) Full Stochastic and a (12, 2) Slow Stochastic is equal to a (12, 3, 2) Full Stochastic.

%K and %D Recap

  • %K (fast) = %K formula presented above using x periods
  • %D (fast) = y-day SMA of %K (fast)
  • %K (slow) = 3-day SMA of %K (fast)
  • %D (slow) = y-day SMA of %K (slow)
  • %K (full) = y-day SMA of %K (fast)
  • %D (full) = z-day SMA of %K (full)

Where x is the first parameter, y is the second parameter and (in the case of Full stochastics), z is the third parameter. In the case of Fast and Slow Stochastics, x is typically 14 and y is usually set to 3.

2. Cross above or Cross below?

First we need to determine the optimal direction of crossing, i.e., the Buy/Sell is triggered by the signal cross above the threshold or cross below. It turns out that we should

Buy when StocFull cross below Blevel, and sell when StocFull cross above Slevel

instead of the other way around:

Buy when StocFull cross above Blevel, sell when StocFull cross below Slevel

N.B. 1. Consider long only; 2. No commission; 3.

3. Optimization procedure

We have the following variables to optimize over:

1. Three periods x, y, and z in StocFull(x, y, z);

2. Two buy and sell levels;

3. Stop out points.

We begin with period optimization. Red indicates high profit.

3.1 Period optimization

z=1

z=2

z=3

z=4

z=5

z=6

z=7

z=8

The best one seems to be [ 13, 9, 3].

3.2 Level optimization

We now optimize over buying and selling levels.

The best choices are 40 and 60.

3.3 Stop point optimization

It turns out that stop out at 0.14 is the best.

4. Final report

Statistics

All trades

Long trades

Short trades

Initial capital

100000.00

100000.00

100000.00

Ending capital

120022.79

120022.79

100000.00

Net Profit

20022.79

20022.79

0.00

Net Profit %

20.02 %

20.02 %

0.00 %

Exposure %

21.94 %

21.94 %

0.00 %

Net Risk Adjusted Return %

91.25 %

91.25 %

N/A

Annual Return %

15.69 %

15.69 %

0.00 %

Risk Adjusted Return %

71.52 %

71.52 %

N/A


All trades

2835

2835 (100.00 %)

0 (0.00 %)

Avg. Profit/Loss

7.06

7.06

N/A

Avg. Profit/Loss %

0.01 %

0.01 %

N/A

Avg. Bars Held

11.61

11.61

N/A


Winners

1385 (48.85 %)

1385 (48.85 %)

0 (0.00 %)

Total Profit

172448.25

172448.25

0.00

Avg. Profit

124.51

124.51

N/A

Avg. Profit %

0.12 %

0.12 %

N/A

Avg. Bars Held

13.41

13.41

N/A

Max. Consecutive

12

12

0

Largest win

1692.00

1692.00

0.00

# bars in largest win

8

8

0


Losers

1450 (51.15 %)

1450 (51.15 %)

0 (0.00 %)

Total Loss

-152425.46

-152425.46

0.00

Avg. Loss

-105.12

-105.12

N/A

Avg. Loss %

-0.10 %

-0.10 %

N/A

Avg. Bars Held

9.89

9.89

N/A

Max. Consecutive

11

11

0

Largest loss

-958.92

-958.92

0.00

# bars in largest loss

2

2

0


Max. trade drawdown

-958.92

-958.92

0.00

Max. trade % drawdown

-0.92 %

-0.92 %

0.00 %

Max. system drawdown

-3975.36

-3975.36

0.00

Max. system % drawdown

-3.27 %

-3.27 %

0.00 %

Recovery Factor

5.04

5.04

N/A

CAR/MaxDD

4.80

4.80

N/A

RAR/MaxDD

21.87

21.87

N/A

Profit Factor

1.13

1.13

N/A

Payoff Ratio

1.18

1.18

N/A

Standard Error

1889.31

1889.31

0.00

Risk-Reward Ratio

10.03

10.03

N/A

Ulcer Index

1.04

1.04

0.00

Ulcer Performance Index

9.93

9.93

N/A

Sharpe Ratio of trades

4.43

4.43

0.00

K-Ratio

0.01

0.01

N/A

[ 本帖最后由 Quantum 于 2008-8-1 02:04 编辑 ]
回复 鲜花 鸡蛋

使用道具 举报

发表于 2008-8-1 01:03 AM | 显示全部楼层

还是看word文件吧

懒得贴图了。

StocStudy.zip

558.27 KB, 下载次数: 24

回复 鲜花 鸡蛋

使用道具 举报

发表于 2008-8-1 01:07 AM | 显示全部楼层
请问一哈,不了解strategy desk,这是一种软件吗? 哪里能找到? 谢谢
回复 鲜花 鸡蛋

使用道具 举报

发表于 2008-8-1 01:09 AM | 显示全部楼层

回复 12# coffee 的帖子

TD Ameritrade free download if you're a customer
回复 鲜花 鸡蛋

使用道具 举报

发表于 2008-8-1 01:11 AM | 显示全部楼层
如果不是TD Ameritrade的customer就不能用了吗?有没有其他类似的软件?谢谢
回复 鲜花 鸡蛋

使用道具 举报

发表于 2008-8-1 01:17 AM | 显示全部楼层

回复 14# coffee 的帖子

不行,因为你必须要login才能用。我其实主要用amibroker,StrategyDesk只偶尔用来看图的。
回复 鲜花 鸡蛋

使用道具 举报

发表于 2008-8-1 01:31 AM | 显示全部楼层

CyberCycle Oscillator

Now I will try Ehler’s CyberCycle Oscillator.

 

function CyberCycleCalc( array, alpha )

{

  Cycle=(array-2*Ref(array, -1)+Ref(array, -2))/4;

  smooth=(array+2*Ref(array, -1)+2*Ref(array, -2)+Ref(array, -3))/6;

  for(i=5; i<BarCount; i++)

  {

     Cycle=(1-0.5*alpha)*(1-0.5*alpha)*(smooth-2*smooth[i-1]+smooth[i-2]) +

                  2*(1-alpha)*Cycle[i-1]-(1-alpha)*(1-alpha)*Cycle[i-2];

  }

  return Cycle;

}

 

It is indeed a low-pass filter, and it has only one parameter to tune.

 

The best alpha is 0.27, and stop-out limit 0.14.

 

Statistics

 

 

All trades

Long trades

Short trades

Initial capital

100000.00

100000.00

100000.00

Ending capital

131427.88

131427.88

100000.00

Net Profit

31427.88

31427.88

0.00

Net Profit %

31.43 %

31.43 %

0.00 %

Exposure %

43.74 %

43.74 %

0.00 %

Net Risk Adjusted Return %

71.85 %

71.85 %

N/A

Annual Return %

24.39 %

24.39 %

0.00 %

Risk Adjusted Return %

55.77 %

55.77 %

N/A


All trades

15749 (Way too many!!)

15749 (100.00 %)

0 (0.00 %)

 Avg. Profit/Loss

2.00

2.00

N/A

 Avg. Profit/Loss %

0.00 %

0.00 %

N/A

 Avg. Bars Held

4.74

4.74

N/A


Winners

6682 (42.43 %)

6682 (42.43 %)

0 (0.00 %)

 Total Profit

543783.06

543783.06

0.00

 Avg. Profit

81.38

81.38

N/A

 Avg. Profit %

0.08 %

0.08 %

N/A

 Avg. Bars Held

5.75

5.75

N/A

 Max. Consecutive

9

9

0

 Largest win

1539.00

1539.00

0.00

 # bars in largest win

5

5

0


Losers

9067 (57.57 %)

9067 (57.57 %)

0 (0.00 %)

 Total Loss

-512355.18

-512355.18

0.00

 Avg. Loss

-56.51

-56.51

N/A

 Avg. Loss %

-0.05 %

-0.05 %

N/A

 Avg. Bars Held

3.99

3.99

N/A

 Max. Consecutive

13

13

0

 Largest loss

-1037.52

-1037.52

0.00

 # bars in largest loss

2

2

0


Max. trade drawdown

-1037.52

-1037.52

0.00

Max. trade % drawdown

-0.96 %

-0.96 %

0.00 %

Max. system drawdown

-6813.47

-6813.47

0.00

Max. system % drawdown

-5.17 %

-5.17 %

0.00 %

Recovery Factor

4.61

4.61

N/A

CAR/MaxDD

4.72

4.72

N/A

RAR/MaxDD

10.79

10.79

N/A

Profit Factor

1.06

1.06

N/A

Payoff Ratio

1.44

1.44

N/A

Standard Error

4230.54

4230.54

0.00

Risk-Reward Ratio

6.24

6.24

N/A

Ulcer Index

2.14

2.14

0.00

Ulcer Performance Index

8.89

8.89

N/A

Sharpe Ratio of trades

2.76

2.76

0.00

K-Ratio

0.01

0.01

N/A

 

回复 鲜花 鸡蛋

使用道具 举报

发表于 2008-8-2 09:25 AM | 显示全部楼层

请问amibroker里可以编程来找出回报最大的参数吗?

比如stoch k(5,3,3)里的三个参数。能给个简单例子吗?多谢

我觉得不同的股票特性不同,适合不同的参数。

 

原帖由 Quantum 于 2008-8-1 02:17 发表 不行,因为你必须要login才能用。我其实主要用amibroker,StrategyDesk只偶尔用来看图的。

回复 鲜花 鸡蛋

使用道具 举报

发表于 2008-8-2 09:48 AM | 显示全部楼层

Go read my WORD document

That's a demonstrative example on how to tune parameters in Amibroker.

原帖由 lami 于 2008-8-2 10:25 发表 请问amibroker里可以编程来找出回报最大的参数吗? 比如stoch k(5,3,3)里的三个参数。能给个简单例子吗?多谢 我觉得不同的股票特性不同,适合不同的参数。
回复 鲜花 鸡蛋

使用道具 举报

发表于 2008-8-3 12:00 AM | 显示全部楼层

多谢。我看了amibroker帮助,原来优化就是用optimize函数代替需要变化的量。挺简单,挺好用。

你的word文件中,stoch的period z从1变到8,生成8个图,然后就说最优的是stoch(13,9,3),这个是眼睛看8个图后估计的吧。能用程序自动找出来吗?

另外,我找出来的,怎么总是大概(2,6,3),第一个k period太短了。我觉得应该是(5,3,3)比较好。

 

原帖由 Quantum 于 2008-8-2 10:48 发表 That's a demonstrative example on how to tune parameters in Amibroker.

回复 鲜花 鸡蛋

使用道具 举报

发表于 2008-8-3 12:03 AM | 显示全部楼层

回复 19# lami 的帖子

是我自己随便看看的。我要找的不是profit最多的参数组合,而是最robust的。
回复 鲜花 鸡蛋

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|www.hutong9.net

GMT-5, 2024-4-19 11:57 PM , Processed in 0.151249 second(s), 17 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表