if Barssinceentry(0)=0 and MarketPosition !=0 then
Value1 = Value1 + 1
end if
if 你自己的交易條件 adn Value1<=2 then
buy…
sell…
end if
if time[1]=134500 then
Value1=0
end if
2010年1月29日 星期五
2010年1月25日 星期一
停損在 this bar
有個指令可以讓你使用停損在 this bar,那就是 BarsSinceEntry,
0為進場點,進場點為第一根,大於零表示從進場後第二根起算。
例子:
IF Close < EntryPrice(0)-10 AND BarsSinceEntry(0) > 0 THEN
ExitLong this bar at market
END IF
正確的停損(HTS版)
If marketposition = 1 then
exitlong at XXX stop
end if
if marketposition = -1 then
exitshort at XXX stop
end if
2010年1月24日 星期日
2010年1月18日 星期一
當沖留意
轉貼:
寫當沖程式要處理的事情比留倉程式要多很很多,這裡提出一些我的心得,有疏漏之處還請高人補足
1.平常的日子何時出場,何時開始進場
2.每日收盤前多久宜出不宜進
3.結算日何時出場(不處理的話,期商也會在結算前自動結算掉,但你的回測紀錄會失真)
4.漲跌停何時出場
5.靠近漲跌停何處宜出不宜進
//---------------------------------------------------------每日出場
Condition0=dayofweek(date)=3 and dayofmonth(date)>14 and 22>dayofmonth(date) and Time=133000-Barinterval*100
if time< time[1] then
Close_1=C[1]
end if
ExitLong ("出漲停") this bar Close_1*1.07-10 limit //沖漲停
ExitShort("出跌停") this bar Close_1*0.93+10 limit //沖跌停
if time=(134500-barinterval*100) then //當沖不留倉
exitlong ("多收") next bar market
exitshort("空收") next bar market
end if
if time>=133000-barinterval*100 and Condition0 then //結算不轉倉
exitlong ("多結") next bar market
exitshort("空結") next bar market
end if
請尊重版權,轉載請註明出處
http://dkbb.freeforum.tw/read.php?tid=4642&page=1&toread=1
只要使用THIS BAR在條件的判斷上絕對不要使用正在發生的K線的資料去作為判斷的依據 --- 阿政
Close of 1 Bar Ago 表示前一天的收盤價。
ExitShort this bar on close 現在bar當中,在收盤價清算賣出部位的意思
空出後,不立即再空進
//不做反手單的情況
if EntryType(0)<0 and marketposition=0 and 作多條件 then
buy ......
end if
//不做反手單的情況
if EntryType(0)>0 and marketposition=0 and 作空條件 then
Sell ......
end if
不是在出場的那根 k
if barssinceexit(0)<>0 then
2010年1月16日 星期六
趨勢
炙火強弱戰線的程式碼為下
-------------------------------------------------------
Variables:JJ(0),AA(0)
JJ=(HIGH+LOW+Close)/3
AA=SMA(JJ,33)
IF AA[1]< AA and L > AA then
Draw1(AA,"炙火強弱戰線",RED)
end if
IF AA[1]>AA and H < AA then
Draw1(AA,"炙火強弱戰線",Green)
end if
--------------------------------------------------------
- 蛇擺pendulum wave 的程式碼如下
--------------------------------------------------------
Variables:JJ(0),AA(0),B(0)
JJ=(CLOSE+HIGH+LOW)/3
AA=EMA(JJ,13)
B=AA[1]
IF AA > B THEN
DRAWBAR1(AA,B,AA,B,"蛇擺pendulum wave",Tool_Magenta ,Tool_Magenta )
END IF
IF AA < B THEN
DRAWBAR1(AA,B,AA,B,"蛇擺pendulum wave",Tool_Cyan ,Tool_Cyan )
end if
---http://tw.myblog.yahoo.com/Ronnie-16888/article?mid=2829&prev=2826&next=2828&l=f&fid=29