有關買入賣出及平倉的問題
本人最近才學習Amibroker來做backtest本人想在價格一到達(等於)保歷嘉通道的中線(20SMA)時平倉(Sell or Cover)
但我發覺自已只能在一支燭完結時(Close)才可平倉,想問各位如何設定在一支燭身形成時就可以平倉而非燭身形式後? push{:8_561:}{:8_561:}{:8_561:} sellprice=o; lwhuang 發表於 15-3-19 16:58 static/image/common/back.gif
謝謝回覆!但如果只是價格的最高價或最低價碰到中軸,而open碰不到,那應該如何設定?
返是我的code:
OpenTime = 091500;
CloseTime = 161400;
ExitTime = TimeNum() >= CloseTime; //
EntryTime = (TimeNum()>= OpenTime ) AND (TimeNum()<CloseTime);
SellPrice = O;
CoverPrice = O;
Buy = RSI( 5 ) > 20
AND Ref( RSI( 5 ) , -1 ) < 20
AND Close < MA(Close , 20 )
AND EntryTime;
Sell = Close >= MA(Close , 20 )
OR ExitTime;
Short = RSI( 5 ) < 80
AND Ref( RSI( 5 ) , -1 ) > 80
AND Close > MA(Close , 20 )
AND EntryTime;
Cover = Close <= MA(Close , 20 )
OR ExitTime;
我的意思時當現價(不是close/open)一到保歷加中軸(20SMA)時就立刻平倉
頁:
[1]