舒潔 發表於 15-8-18 19:16

指定出場方式?

A策略:(獨立)

inputs:Strength1(4),Strength2(4);

vars:var0(false),var1(0),var2(false),var3(0),MP(0);

MP = MarketPosition ;

condition1 = SwingHigh( 1, High, Strength1, Strength1 + 1 ) <> -1 ;

if condition1 then begin

var0 = true ;

var1 = High ;

end else begin condition1 = var0 and High >= var1 + 1 point ;

if condition1 then var0 = false ;

end;

condition2 = SwingLow( 1, Low, Strength2, Strength2 + 1 ) <> -1 ;

if condition2 then begin

var2 = true ;

var3 = Low ;

end else begin

condition1 = var2 and Low <= var3 - 1 point ;

if condition1 then var2 = false ;

end;

if MP=0 and var0 then Buy ("B1") next bar at var1+1 point stop ;

if MP=0 and var2 then SellShort ("S1") next bar at var3-1 point stop ;

if MP>0 then sellshort("BL1") next bar at entryprice(0)-20 stop;

if MP<0 then buy("SL1") next bar at entryprice(0)+20 stop;

B策略:(獨立)

variables:CDP(0),AH(0),NH(0),NL(0),AL(0),MP(0);

vars:TodayHigh(high),TodayLow(low),Price1(0),Price2(0);

MP = MarketPosition ;

if time<1330 then Begin

TodayHigh = HighD(0);

TodayLow = LowD(0); end;

Price1 = TodayHigh-(TodayHigh-TodayLow)/3 ;

Price2 = TodayLow +(TodayHigh-TodayLow)/3 ;

if date<>date then begin

CDP=(highD(1)+lowD(1)+2*closeD(1))/4;

AH=CDP+(highD(1)-lowD(1));

NH=CDP*2-lowD(1); NL=CDP*2-highD(1);

AL=CDP-(highD(1)-lowD(1));

end;

if MP=0 then Buy("B2") next bar at AH stop;

if MP=0 then sellshort("S2") next bar at AL stop;

if MP>0 then sellshort("BL2") next bar at Price2 stop ;

if MP<0 then buy("SL2") next bar at Price1 stop ;

A策略和B策略同時在同一個圖表一起運作(停損後反向操作)~會發生B1進場後不以BL1出場,反而以BL2出場,或S2進場後不以SL2出場,反而以SL1出場~我想要B1進場後就以BL1出場~S2進場後就以SL2出場~要怎麼修正呢?謝謝!!

沒房子的阿捨 發表於 15-8-18 20:43

本帖最後由 沒房子的阿捨 於 15-8-18 20:45 編輯

幫你爬文了...............
http://www.coco-in.net/forum.php?mod=viewthread&tid=41301&page=1#pid661662

舒潔 發表於 15-8-19 09:56

沒房子的阿捨 發表於 15-8-18 20:43 static/image/common/back.gif
幫你爬文了...............
http://www.coco-in.net/forum.php?mod=viewthread&tid=41301&page=1#pid661662 ...

感謝你的爬文!但如果是要寫在同一個訊號檔案內要怎麼寫?
頁: [1]
查看完整版本: 指定出場方式?