咨詢內容:這樣編寫程序順序合理,正確??pdd:=aq1>=1 and l>fl;pkk:=aq1>=1 and h<fh; VARIABLE: ll=0, hh=0, astop=0, bstop=0, temp_ll[]=0, temp_hh[]=0;?//交易系統?if enterbars>1 and l<astop -2*MINDIFF and holding>0 then sell(1,0,marketr);//止損止盈,實時出場? if h>valuewhen(TYPE(2),hhv(fh,10)) and holding=0 and 倉差>0 then buy(1,ss,marketr);//止損后,再次入場?if enterbars>1 and h>bstop +2*MINDIFF and holding<0 then sellshort(1,0,marketr);//止損止盈,實時出場? if l<valuewhen(TYPE(4),llv(fl,10)) and holding=0 and 倉差<0 then buyshort(1,ss,marketr);//止損后,再次入場?//開多?temp_ll:=llv(l,2);if pdd thenbegin? ?sellshort(1,0,marketr);? ?buy(holding=0 and 倉差>0,ss,marketr);? ?ll:=temp_ll;endastop:=ll;//開空temp_hh:=hhv(h,2);if pkk thenbegin? ?sell(1,0,marketr);? ?buyshort(holding=0 and 倉差<0,ss,marketr);? ?hh:=temp_hh;endbstop:=hh;
?
金字塔客服:另外這樣編寫法:pdd:=aq1>=1 and l>fl;pkk:=aq1>=1 and h<fh;//交易系統temp_ll:=llv(l,2);if pdd thenbegin? ?sellshort(1,0,marketr);? ?buy(holding=0 and 倉差>0,ss,marketr);? ?ll:=temp_ll;end?if enterbars>1 and l<ll-2*MINDIFF and holding>0 then sell(1,0,marketr);//止損止盈,實時出場?if h>valuewhen(TYPE(2),hhv(fh,10)) and holding=0 and 倉差>0 then buy(1,ss,marketr); temp_hh:=hhv(h,2);if pkk thenbegin? ?sell(1,0,marketr);? ?buyshort(holding=0 and 倉差<0,ss,marketr);? ?hh:=temp_hh;end?if enterbars>1 and h>hh+2*MINDIFF and holding<0 then sellshort(1,0,marketr);?if l<valuewhen(TYPE(4),llv(fl,10)) and holding=0 and 倉差<0 then buyshort(1,ss,marketr);