策略靈感來源從以下這個影片來的,可以先看看
看完後,有點好奇績效是不是真的那麼厲害,嘗試改成XQ的交易程式碼,跑出來的績效似乎還不錯,2016/09到2021/10,獲利接近160萬,最驚人的是勝率竟然高達81.08%,整個權益曲線也算是一路向上,仔細的看了下,最大虧損交易竟然是-31萬,最大區間虧損也高達-62萬,嗯,這應該不是普通人能用的策略~~

既然上面的結果不是普通人能用的,那就只好繼續來改造下,看能否搞出個普通人能用的策略,運氣還不錯,同樣回測區間,也能獲利136萬,雖然勝率變低,但最大虧損跟最大區間虧損,大幅降低至5.8萬跟13萬,且權益曲線是一路往上,每年都是獲利的,已經算是不錯的策略了

回測設定如下,有興趣的可以調整參數或是增加其他進出場條件,應該能找到更加的組合。

檔案下載
程式碼如下
//https://www.youtube.com/watch?v=TpR7Cdy7pko
//v3 增加出場濾網,不然MDD太大
input: lostex(150,"虧損多少點出場");
input: PVIlen(15),NVIlen(40),bk1(3),bk2(12);
vars: avPVI(0), avNVI(0);
vars: trendbull(false),trendbear(false);
vars: intrabarPersist entryonce(0);
Variable: _pvi(1),_nvi(1);
if date<>date[1] then entryonce=0;
If CurrentBar = 1 then
_pvi = 100
else
begin
if Volume > Volume[1] then
_pvi = _pvi[1] + ((Close - Close[1]) / Close[1])*_pvi[1]
else
_pvi = _pvi[1];
end;
avPVI=average(_pvi,PVIlen);
If CurrentBar = 1 then
_nvi = 100
else
begin
if Volume < Volume[1] then
_nvi = _nvi[1] + ((Close - Close[1]) / Close[1])*_nvi[1]
else
_nvi = _nvi[1];
end;
avNVI=average(_nvi,NVIlen);
trendbull=_nvi>avNVI and _pvi<avPVI;
trendbear=_nvi>avNVI and _pvi>avPVI;
if position<=0 and trendbull and entryonce=0
// and close>average(getfield("close","D")[1],5) 測試用條件
and close>highest(high[1],2) then begin
setposition(1,highest(H,bk1));
entryonce=1;
end;
//if position>=0 and trendbear then //翻單
// setposition(-1,lowest(l,bk2));
if position>=0 and filled=1 and trendbear then begin
setposition(0,market);
end;
if position>=0 and filled=1 and close<filledavgprice-lostex then begin
setposition(0,market);
end;
//-----期貨換月出場
var: b_balanceDay(false);
if date<>date[1] then begin
b_balanceDay=false;
if (dayofmonth(Date)>=15 and DayofMonth(Date)<=21 and DayofWeek(Date)=3) then b_balanceDay=true;
end;
if b_balanceDay=true and position=1 and filled=1 and time>=130000 then begin
setposition(0,close);
end;

![[VIP] XQ版RS相對強弱PR指標](https://aplus.trading/wp-content/uploads/2024/11/a-captivating-illustration-of-the-relative-strengt-t0oo_72pQ6-5mpJuqSoDQ-h1cSwJr9Qv-Gwfy41ebhgw-870x570.jpeg)
![[VIP]用彼得林區邏輯 + XQ 選股中心打造成長型策略](https://aplus.trading/wp-content/uploads/2025/07/a-captivating-modern-digital-illustratio_7OaYIF8kT4aUUDGs6AJjBw_tLDjMWjvSXWPG5ycIUliAg-870x570.jpeg)

![[VIP] 短線策略7-買賣家數集中度策略](https://aplus.trading/wp-content/uploads/2025/10/a-digital-illustration-of-a-stock-chart-_xtRnCKHdQnK_7iicsxxCHA_l-Cu3wWZQSapjzKMZmrLnw-870x570.jpeg)

![[VIP] 短線策略6-董監持股趨勢向上策略](https://aplus.trading/wp-content/uploads/2025/09/a-clean-infographic-illustration-showcas_zAsziRatTbi10dd3WN4-1g_oDzFYvk2RC655L3YyHMnRA-150x150.jpeg)
![[VIP] 短線策略3-融券餘額趨勢向下策略](https://aplus.trading/wp-content/uploads/2025/07/a-futuristic-and-sophisticated-financial_iE8LGYo0TEaPNdDEf9A93A_MaNO5SCUS_iIA-2X26PZSg-150x150.jpeg)
![[VIP] XQ版RS相對強弱PR指標](https://aplus.trading/wp-content/uploads/2024/11/a-captivating-illustration-of-the-relative-strengt-t0oo_72pQ6-5mpJuqSoDQ-h1cSwJr9Qv-Gwfy41ebhgw-150x150.jpeg)

發佈留言
很抱歉,必須登入網站才能發佈留言。