免費台指策略分享
價差策略data2為台指日K
input:bull(1);
var:pDiff(20),pdff(-40);
vars:vMP(0),vDiff(0);
var:long_switch(0),short_switch(0);
////////////////////////////////////////////////////////////////////////////////
vDiff=C - C Data2;
vMP=marketposition;
////////////////////////////////////////////////////////////////////////////////
//Original in-out
if t>0900 and t<1300
then begin
if vDiff>pDiff and vMP>=0 and entryname<>"Short-Backhand"
then sellshort("Short Trigger") bull contract next bar market;
if vDiff<pdff and vMP<=0 and entryname<>"Long-Backhand"
then buy("Long Trigger") bull contractnext bar market;
end;
////////////////////////////////////////////////////////////////////////////////
//Short-Backhand
var:Short_BH_pts(120),Short_BH_Profittarget(180),Short_BH_Stoploss(180);
if vMP<0 and entryname="Short Trigger"
then buy("Short-Backhand") bull contractnext bar entryprice+Short_BH_pts stop;
if vMP>0
then begin
sell("Profit target") bull contractfrom entry("Short-Backhand") next bar entryprice+Short_BH_Profittarget limit;
sell("Stop loss") bull contractfrom entry("Short-Backhand") next bar entryprice-Short_BH_Stoploss stop;
end;
////////////////////////////////////////////////////////////////////////////////
//Long-Backhand
var:Long_BH_pts(300),Long_BH_Profittarget(160),Long_BH_Stoploss(120);
if vMP>0 and entryname="Long Trigger"
then sellshort("Long-Backhand") bull contractnext bar entryprice-Long_BH_pts stop;
if vMP<0
then begin
buytocover("Profit target ")bull contractfrom entry("Long-Backhand") next bar entryprice-Long_BH_Profittarget limit;
buytocover("Stop loss ") bull contract from entry("Long-Backhand") next bar entryprice+Long_BH_Stoploss stop;
end;
////////////////////////////////////////////////////////////////////////////////
if _IsSettlementDay=True
then setexitonclose;
另外可分享最近團到的策略
有興趣可以+我賴 wangjei1025
頁:
[1]