簡單的說明:源碼
//中間變量
input:NS(5,0,60,1);
Price:=AVGENTERPRICE;//持倉價(jià)位
//交易條件
開多平空條件:=CROSS(MA(c,16),MA(c,5));
開空平多條件:=CROSS(MA(c,5),MA(c,16));
//交易系統(tǒng)
SELLSHORT(開多平空條件 and HOLDING<0,1,market);
SELLSHORT(HOLDING<0,1,Stopr,Price+NS); //止損
BUY(開多平空條件 and HOLDING=0,30%,market);
SELL(開空平多條件 and HOLDING>0,1,market);
SELL(HOLDING>0,1,Stopr,Price-NS);//止損
BUYSHORT(開空平多條件 and HOLDING=0,30%,market);
//其他
資產(chǎn):asset,noaxis,colorgreen,LINETHICK0;
持從:HOLDING,LINETHICK0;
總次數(shù): TOTALTRADE,LINETHICK0;
盈刟:NUMWINTRADE,LINETHICK0;
問題:1、沒有信號就是三角符號?沒有開倉新號吧! 2、SELLSHORT(HOLDING<0,1,Stopr,Price+NS); //止損;這里價(jià)格PRICE+NS指的是哪個(gè)價(jià)格,直接使用開倉價(jià)格:enterprice+ns可以嗎?3、如果空單是開倉價(jià)+ns止損,止盈就是 開倉價(jià)-ns;麻煩給寫一下吧;多單正好與之相反;4、我上午已經(jīng)購買3年使用,今后要經(jīng)常麻煩你們了;主要是把程序搞得好點(diǎn);
5、圖中使用的源碼
( stopprice):=ma(c,20);
做多:=。。。。。
多空:。。。。。
//開多
IF ( stopprice)<做多THEN
BEGIN
SELLSHORT( HOLDING<0,HOLDING,market); //平空操作
BUY( HOLDING=0,1,market);//開多操作
maxprofit:=0;
END
//平倉
SELL((stopprice)>做空hand HOLDING>0,HOLDING,market);//平多
BUYSHORT((stopprice)>做空 and HOLDING=0,1,market); //開空操作
//多頭為例回撤K3平倉
if enterbars>=3 then begin
if c>o and holding>0 then sell(1,holding,market);
if c<o then buy(holding>0,1,market);
end
//空頭為例
if enterbars>=3 then begin
if c>o and holding<0 then sell(1,holding,market);
if c<o then buy(holding<0,1,market);
end
給試試,要求就是第3根K線的處理:比如下跌趨勢,開倉成立;第3根K線,c>o,平倉止盈;之后,繼續(xù)按原反方向開倉,直到方向翻轉(zhuǎn)為止;
//開多
IF ( stopprice)<l THEN
BEGIN
SELLSHORT( HOLDING<0,HOLDING,market); //平空操作
BUY( HOLDING=0,1,market);//開多操作
maxprofit:=0;
END
//平倉
SELL((stopprice)>h and HOLDING>0,HOLDING,market);//平多
BUYSHORT((stopprice)>hand HOLDING=0,1,market); //開空操作
//多頭為例回撤K3平倉
if enterbars>=3 then begin
if c>o and holding>0 then sell(1,holding,market);
if c<o then buy(holding>0,1,market);
end
//空頭為例
if enterbars>=3 then begin
if c>o and holding<0 then sell(1,holding,market);
if c<o then buy(holding<0,1,market);
end
1.白色三角箭頭,表示這里有信號但是因?yàn)槟阒付ǖ膬r(jià)格不能成交,所以變成不算作是信號
2.你指定的價(jià)格,PRICE是你自己定義的,是什么價(jià)格自己應(yīng)該清除。想要用什么價(jià)格根據(jù)自己的需求來沒有固定的規(guī)矩
3.所謂止損不是指你要下止損單。這個(gè)是兩個(gè)意思,直接限價(jià)下單
sellshort(holding<0,0,limitr,enterprice-ns);
sell(holding>0,0,limitr,enterprice+ns);
4.ok
5.
if enterbars>=3 then begin
if c>o and holding>0 then sell(1,holding,market);
if c<o and type(1)= 2 then buy(holding>=0,1,market);
end
//空頭為例
if enterbars>=3 then begin
if c>o and holding<0 then sellshort(1,holding,market);
if c<o and type(1)=4 then buyshort(holding<=0,1,market);
end