EasyTrader ES_Test 03
參考相關文章 國外知名交易系統 一目均衡表交易模型
一目均衡表實際分為兩個部分。第一部分是通過圖表本身,解讀市場的信號;第二部分,是通過計算,預測市場的方向和位置。特別是第二部分,可以說在很大程度上簡化解讀了周期理論、江恩理論和波浪理論的核心部分,有很強的適用性。
一目均衡表由每日的K線(一目均衡表中稱日日線),5條線及一個抵抗帶(俗稱雲圖)構成。通過幾者間關係的解讀,可瞭解市場的強弱,並可得出買賣信號。因為運用此表,市場的趨勢一目瞭然”,故稱“一目均衡表”。
// Public Variable
vars:MP(0),PF(0),PL(0),BuyPrice(0),ShortPrice(0),BasePF(600),BasePL(300) ;
vars:BarPass(5),HLRange(0),WinPoint(0),HBarPos(0),LBarPos(0),ExitH(0),ExitL(0),TimeOK(false),EntryExitCond(false),SelectNo(0) ;
vars:jumpPoint(0) ;
jumpPoint = MinMove/PriceScale ;
//****************** Basic Setup ****************************************
MP = MarketPosition ;
PF = 6000/BigPointValue ;
PL = 1500/BigPointValue ;
//計算盈虧點數
// ******** Long/Short win/loss point *********
vars:WinPoint_LE(0),LossPoint_LE(0),WinPoint_SE(0),LossPoint_SE(0),PF_Ref(800),SL_Ref(-800) ;
if barssinceentry > 0 then begin
if MP > 0 then begin
WinPoint_LE = HighSinceEntry_N - EntryPrice ;
LossPoint_LE = LowSinceEntry_N - EntryPrice ;
end ;
if MP < 0 then begin
WinPoint_SE = EntryPrice - LowSinceEntry_N ;
LossPoint_SE = EntryPrice - HighSinceEntry_N ;
end ;
end else begin
WinPoint_LE = 0 ;
LossPoint_LE = 0 ;
WinPoint_LE = 0 ;
LossPoint_LE = 0 ;
end ;
vars:Day5Range(0) ;
Day5Range = 五日平均振幅;
//計算布林通道參考價
// ************ BollingerBand *****************
vars:BBUP(0),BBDN(0),BBRange(0),BBLen(0),DataBase(Close),DataType(1) ;
DataBase = Highest(High,BBLen)-Lowest(Low,BBLen) ;
BBUP = BollingerBand(DataBase,BBLen,2) ;
BBDN = BollingerBand(DataBase,BBLen,-2) ;
BBRange = BBUP-BBDN ;
//計算一目均衡表參考價
// ************ Ichimoku Sanjin Syytem *****************
Vars: ShortTerm(9),MidTerm(26),LongTerm(52);
Vars: ConvertLine(0),BaseLine(0),AheadLine1(0),AheadLine2(0),BehindLine(0),HighCloud(0),LowCloud(0),Cloud(0) ;
Vars: BaseCond(false),ConvertCond(false),C_over_B(0),C_Under_B(0),H_Over_L(0),H_Under_L(0),Thick(100) ;
vars: CondL(false),CondS(false) ;
ShortTerm = LenA1 ;
if ShortTerm <= 8 then ShortTerm = 8
else if ShortTerm >= 20 then ShortTerm = 20 ;
MidTerm = ShortTerm*3 ;
LongTerm = ShortTerm*6 ;
ConvertLine = (highest(high,ShortTerm) + Lowest(Low,ShortTerm))/2 ;
BaseLine = (highest(high,MidTerm) + Lowest(Low,MidTerm))/2 ;
AheadLine1 = (ConvertLine + BaseLine)/2 ;
AheadLine2 = (highest(high,LongTerm) + Lowest(Low,LongTerm))/2 ;
BehindLine = Close ;
C_over_B = _BarsLast(ConvertLine cross over BaseLine) ;
C_Under_B = _BarsLast(ConvertLine cross under BaseLine) ;
HighCloud = AheadLine1[MidTerm] ;
LowCloud = AheadLine2[MidTerm] ;
Cloud = AbsValue(HighCloud-LowCloud) ;
H_Over_L = _BarsLast(HighCloud cross over LowCloud) ;
H_under_L = _BarsLast(HighCloud cross under LowCloud) ;
CondL = Close > HighCloud and HighCloud > LowCloud ;
CondS = Close < HighCloud and HighCloud < LowCloud ;
//計算前一日波動值
// ************ Volatility ExPansion System *****************
vars: VED(1),DBody(1) ;
VED = HighD(1)-LowD(1) ;
if absvalue(CloseD(1)-OpenD(1)) <> 0 and VED <> 0 then DBody = absvalue(CloseD(1)-OpenD(1))/VED ;
// ************* Time Set Up *************
TimeOK = (time >= 0100 or time <= 1300) ;
//***************** BuyPrice & ShortPrice Setup *****************
BuyPrice = MaxList(OpenM(0),CloseM(0))+Range ;
ShortPrice = BBDn-TrueRange ;
// ********** Main Strategy *********
// ********** Entry Method
if TimeOK then begin
//收盤價突破雲層 以K棒最高價買入做多
if MP <> 1 and Close Cross over MinList(HighCloud,LowCloud) and Close Cross over MaxList(HighCloud,LowCloud) then Buy ("LE_MoKu3T") next bar at High Stop ;
//收盤價跌破雲層 以K棒最低價賣出做空
if MP <> -1 and Close Cross under MinList(HighCloud,LowCloud) and Close Cross under MaxList(HighCloud,LowCloud) then SellShort ("SE_MoKu3T") next bar at Low Stop ;
//前一日振幅小於 150 且 K棒實體小於振幅*0.35 則收盤價突破設定價位作多
if MP <> 1 and VED < 150*jumpPoint and DBody < 0.35 and Close < BuyPrice then
Buy ("LE_VED2T") next bar at BuyPrice stop ;
//前一日振幅小於 150 且 K棒實體小於振幅*0.35 則收盤價跌破設定價位作空
if MP <> -1 and VED < 150*jumpPoint and DBody < 0.35 and Close > ShortPrice then
SellShort ("SE_VED2T") next bar at ShortPrice stop ;
end ;
//移動式停損停利
// ************* Base Exit *************
if MP > 0 then begin
Sell ("LX_PF5D_"+NumtoStr(PF+Day5RAnge,0)) next bar at EntryPrice+PF+Day5RAnge limit ;
if WinPoint_LE <= PL*1.5 then Sell ("LX_EPL"+NumtoStr(PL,0)) next bar at EntryPrice-PL stop
else if WinPoint_LE <= PF then Sell ("LX_H2PL_"+NumtoStr(PL*2,0)) next bar at HighSinceEntry_N-PL*2 stop
else if WinPoint_LE > PF then Sell ("LX_PF_"+NumtoStr(WinPoint_LE*0.5,0))
next bar at HighSinceEntry_N-WinPoint_LE*0.5 stop ;
end ;
if MP < 0 then begin
BuytoCover ("SX_PF5D_"+NumtoStr(PF+Day5RAnge,0)) next bar at EntryPrice-PF-Day5RAnge limit ;
if WinPoint_SE <= PL*1.5 then BuytoCover ("SX_EPL_"+NumtoStr(PL,0)) next bar at EntryPrice+PL stop
else if WinPoint_SE <= PF then BuytoCover ("SX_L2PL_"+NumtoStr(PL*2,0)) next bar at LowSinceEntry_N+PL*2 stop
else if WinPoint_SE > PF then BuytoCover ("SX_PF_"+NumtoStr(WinPoint_SE*0.5,0))
next bar at LowSinceEntry_N+WinPoint_SE*0.5 stop ;
end ;
小S&P500 留倉 交易週期 2018/1/1 ~ 2024/8/31 交易成本 USD 70
沒有留言:
張貼留言