【程式交易俱樂部】2008年在台中發起創立 【程式交易俱樂部】Facebook社團https://www.facebook.com/groups/go2trade/
2008年9月3日 星期三
SP500 & 台指期 Trading System 實戰交易系統
inputs: tim(945),timend(1050), pnt(.9), ptgt(2.3), brs(2), bepnt(15), timex(1005), rng(5), x(35), y(0);
{y input is an extra input for testing}
vars: eq(0), eqcum(0), hi(0), lo(0);
value3 = average(truerange,rng);
value4 = pnt * value3;
if date <> date[1] then begin
eq = netprofit + openpositionprofit;
hi = h;
lo = l;
end;
if h > hi then hi = h;
if l < lo then lo = l; eqcum = netprofit + openpositionprofit; condition2 = eq = eqcum; {turns on window and sets stops} if time = tim then begin value1 = h + value4{ points}; value2 = l - value4{ points}; condition1 = true; end; {close window of entry} if time = timend then begin condition1 = false; end; if condition1 = true and condition2 = true then begin if marketposition <> 1 then begin
buy at value1 stop;
end;
if marketposition <> -1 then begin
sell at value2 stop;
end;
end;
{stop at other side}
if marketposition = 1 then exitlong("lstop") at value2 stop;
if marketposition = -1 then exitshort("sstop") at value1 stop;
{one or two more bars for reversal}
if time = tim + barinterval or time = tim + (2*barinterval) then begin
if marketposition = -1 then begin
buy("revL") at value1 stop;
end;
if marketposition = 1 then begin
sell("revS") at value2 stop;
end;
end;
if marketposition = 1 then exitlong("ptgtL") at entryprice + (ptgt * value3) {ptgt points} limit;
if marketposition = -1 then exitshort("ptgtS") at entryprice - (ptgt * value3){ ptgt points} limit;
{bag trade after certain amount of time}
if time >= timex and barssinceentry > brs then begin
if marketposition = 1 then exitlong("belong") at entryprice + bepnt points limit;
if marketposition = -1 then exitshort("beshort") at entryprice - bepnt points limit;
end;
{new hi/lo exit}
if marketposition = 1 then sell("hiloXL") at lo - x points stop;
if marketposition = -1 then buy("hiloXS") at hi + x points stop;
訂閱:
張貼留言 (Atom)
1 則留言:
請問這個策略有名字嗎?
可否稍微解釋一下
張貼留言