今天在原文舊書中看到一個跟成交量有關的交易策略Volume-weighted strategy,有需要成交量來寫策略的人可以參考邏輯。
ps: 我自己沒測試過,只單純覺得成交量的算法簡單易懂。
Vars:
MaLen(9),
AvgVolume(0),
Turbo(0),
InvTurbo(0),
MaWeight(0),
TurboMA(0);
AvgVolume = Average(V, MaLen);
Turbo = (AvgVolume - Lowest(AvgVolume, MaLen)) / (Highest(AvgVolume, MaLen) - Lowest(AvgVolume, Malen));
InvTurbo = 1 - Turbo;
If MaLen > 2 Then MaWeight = (2 / (1 + MaLen)) Else MaWeight = 0.67;
TurboMA = TurboMA * InvTurbo + AvgPrice * Turbo;
If Date < 1000401 Then Begin
If MarketPosition = 0 and C < TurboMA and TurboMA < TurboMA [1] Then
Buy Tomorrow on Highest(High, 2) Stop;
End;
If MarketPosition = 1 and C < TurboMA Then Begin
ExitLong on Close;
ExitLong Tomorrow on EntryPrice * 0.96 Stop;
End;
If Date >= 1000401 Then Begin
If MarketPosition = 0 and C > TurboMA and TurboMA > TurboMA [1] Then
Sell Tomorrow on Lowest(Low, 2) Stop;
End;
If MarketPosition = -1 and C > TurboMA Then Begin
ExitShort on Close;
ExitShort Tomorrow on EntryPrice * 1.04 Stop;
End;
0 留言:
張貼留言
如果有私人問題想請教,請透過網站右方『與站長聯絡』之表單,謝謝!