四均線系統(tǒng)(TB版)_第1頁
四均線系統(tǒng)(TB版)_第2頁
四均線系統(tǒng)(TB版)_第3頁
四均線系統(tǒng)(TB版)_第4頁
四均線系統(tǒng)(TB版)_第5頁
已閱讀5頁,還剩12頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

四均線系統(tǒng)(TB版)主要交易思路:入場條件:利用兩組不同周期的均線組合(5和20周期均線,3和10周期均線)判斷市場趨勢。當(dāng)兩組均線均成多頭排列時,并且當(dāng)前價格高于上一根K線的最高價時入場做多。出場條件:有兩種情況會觸發(fā)平倉。一是小周期(3和10周期)的均線組合形成空頭排列時平倉;二是兩組均線分別形成空頭排列,且當(dāng)前價格低于上一根K線的最低價時平倉。(5和20周期均線),(3和10周期均線)構(gòu)成的兩組不同周期的均線組合函數(shù)Average代碼:ParamsNumericSeriesPrice(1);NumericLength(10);VarsNumericAvgValue;BeginAvgValue=Summation(Price,Length)/Length;ReturnAvgValue;End做多代碼:ParamsNumericLEFast(5);NumericLESlow(20);NumericLXFast(3);NumericLXSlow(10);NumericSEFast(5);NumericSESlow(20);NumericSXFast(3);NumericSXSlow(10);VarsNumericSeriesMALEFast;NumericSeriesMALESlow;NumericSeriesMALXFast;NumericSeriesMALXSlow;NumericSeriesMASEFast;NumericSeriesMASESlow;NumericSeriesMASXFast;NumericSeriesMASXSlow;BeginIf(!CallAuctionFilter())Return;MALEFast=Average(Close,LEFast);MALESlow=Average(Close,LESlow);MALXFast=Average(Close,LXFast);MALXSlow=Average(Close,LXSlow);MASEFast=Average(Close,SEFast);MASESlow=Average(Close,SESlow);MASXFast=Average(Close,SXFast);MASXSlow=Average(Close,SXSlow);If(Marketposition<>1andCurrentbar>=100){If(MALEFast[1]>MALESlow[1]andMALXFast[1]>MALXSlow[1]andHigh>=High[1]AndVol>0){Buy(0,Max(Open,High[1]));}}If(marketposition==1andBarsSinceEntry>0AndVol>0){If(MALXFast[1]<MALXSlow[1]){Sell(0,Open);}ElseIf(MASEFast[1]<MASESlow[1]andMASXFast[1]<MASXSlow[1]andLow<=Low[1]){Sell(0,Min(Open,Low[1]));}}End做多代碼解釋:ParamsNumericLEFast(5);//聲明數(shù)值參數(shù)LEFast,初值5,即多頭入場短均線周期參數(shù)。NumericLESlow(20);//聲明數(shù)值參數(shù)LESlow,初值20,即多頭入場長均線周期參數(shù)。NumericLXFast(3);//聲明數(shù)值參數(shù)LXFast,初值3,即多頭出場短均線周期參數(shù)。NumericLXSlow(10);//聲明數(shù)值參數(shù)LXSlow,初值10,即多頭出場長均線周期參數(shù)。NumericSEFast(5);//聲明數(shù)值參數(shù)SEFast,初值5,即空頭入場短均線周期參數(shù)。NumericSESlow(20);//聲明數(shù)值參數(shù)SESlow,初值20,即空頭入場長均線周期參數(shù)。NumericSXFast(3);//聲明數(shù)值參數(shù)SXFast,初值3,即空頭出場短均線周期參數(shù)。NumericSXSlow(10);//聲明數(shù)值參數(shù)SXSlow,初值10,即空頭出場長均線周期參數(shù)。VarsNumericSeriesMALEFast;//聲明數(shù)值序列變量MALEFast,即多頭入場短均線。NumericSeriesMALESlow;//聲明數(shù)值序列變量MALSlow,即多頭入場長均線。NumericSeriesMALXFast;//聲明數(shù)值序列變量MALXFast,即多頭出場短均線。NumericSeriesMALXSlow;//聲明數(shù)值序列變量MALXSlow,即多頭出場長均線。NumericSeriesMASEFast;//聲明數(shù)值序列變量MASEFast,即空頭入場短均線。NumericSeriesMASESlow;//聲明數(shù)值序列變量MASEFSlow,即空頭入場長均線。NumericSeriesMASXFast;//聲明數(shù)值序列變量MASXFast,即空頭出場短均線。NumericSeriesMASXSlow;//聲明數(shù)值序列變量MASXSlow,即空頭出場長均線。BeginIf(!CallAuctionFilter())Return;//集合競價和小節(jié)休息過濾。//下來這些都是關(guān)于均線的算法,即代入相應(yīng)收盤價與周期返回求值就行。MALEFast=Average(Close,LEFast);//多頭入場短均線。MALESlow=Average(Close,LESlow);//多頭入場長均線。MALXFast=Average(Close,LXFast);//多頭出場短均線。MALXSlow=Average(Close,LXSlow);//多頭出場長均線。MASEFast=Average(Close,SEFast);//空頭入場短均線。MASESlow=Average(Close,SESlow);//空頭入場長均線。MASXFast=Average(Close,SXFast);//空頭出場短均線。MASXSlow=Average(Close,SXSlow);//空頭出場長均線。//系統(tǒng)入場的條件設(shè)置。If(Marketposition<>1andCurrentbar>=100)//假如當(dāng)前沒有持多單,并且當(dāng)前k線索引值大于等于100的。{If(MALEFast[1]>MALESlow[1]andMALXFast[1]>MALXSlow[1]andHigh>=High[1]AndVol>0)//快慢兩均線對比,形成兩組均線均成多頭排列時且當(dāng)前價高于上根k線的最高價入場。{Buy(0,Max(Open,High[1]));//開多,價格為前一k線最高價與開盤價的比較取大值。}}//系統(tǒng)出場條件設(shè)置。If(marketposition==1andBarsSinceEntry>0AndVol>0)//假如當(dāng)前持有多單,并且開倉的k線數(shù)位大于0,并且成交量大于0.{If(MALXFast[1]<MALXSlow[1])//兩均線對比,形成小周期多頭均線組合成空頭排列出場。{Sell(0,Open);//以開盤價平倉。}ElseIf(MASEFast[1]<MASESlow[1]andMASXFast[1]<MASXSlow[1]andLow<=Low[1])//兩組均線分別空頭排列且低于上根k線最低價出場。{Sell(0,Min(Open,Low[1]));//開空,價格為前一k線最低價與開盤價的比較取小值。}}End做空信號代碼:ParamsNumericLEFast(5);NumericLESlow(20);NumericLXFast(3);NumericLXSlow(10);NumericSEFast(5);NumericSESlow(20);NumericSXFast(3);NumericSXSlow(10);VarsNumericSeriesMALEFast;NumericSeriesMALESlow;NumericSeriesMALXFast;NumericSeriesMALXSlow;NumericSeriesMASEFast;NumericSeriesMASESlow;NumericSeriesMASXFast;NumericSeriesMASXSlow;BeginIf(!CallAuctionFilter())Return;MALEFast=Average(Close,LEFast);MALESlow=Average(Close,LESlow);MALXFast=Average(Close,LXFast);MALXSlow=Average(Close,LXSlow);MASEFast=Average(Close,SEFast);MASESlow=Average(Close,SESlow);MASXFast=Average(Close,SXFast);MASXSlow=Average(Close,SXSlow);If(Marketposition<>-1andCurrentbar>=100){If(MASEFast[1]<MASESlow[1]andMASXFast[1]<MASXSlow[1]andLow<=Low[1]AndVol>0){SellShort(0,Min(Open,Low[1]));}}If(MarketPosition==-1andBarsSinceEntry>0AndVol>0){If(MASXFast[1]>MASXSlow[1]){BuyToCover(0,Open);}Elseif(MALEFast[1]>MALESlow[1]andMALXFast[1]>MALXSlow[1]andHigh>=High[1]){BuyToCover(0,Max(Open,High[1]));}}End做空代碼解釋:Params//定義數(shù)值型參數(shù)LEFast并初始化為5NumericLEFast(5);//定義數(shù)值型參數(shù)LESlow并初始化為20NumericLESlow(20);//定義數(shù)值型參數(shù)LXFast并初始化為3NumericLXFast(3);//定義數(shù)值型參數(shù)LXSlow并初始化為10NumericLXSlow(10);//定義數(shù)值型參數(shù)SEFast并初始化為5NumericSEFast(5);//定義數(shù)值型參數(shù)SESlow并初始化為20NumericSESlow(20);//定義數(shù)值型參數(shù)SXFast并初始化為3NumericSXFast(3);//定義數(shù)值型參數(shù)SXSlow并初始化為10NumericSXSlow(10);Vars//定義數(shù)值序列型變量MALEFastNumericSeriesMALEFast;//定義數(shù)值序列型變量MALESlowNumericSeriesMALESlow;//定義數(shù)值序列型變量MALXFastNumericSeriesMALXFast;//定義數(shù)值序列型變量MALXSlowNumericSeriesMALXSlow;//定義數(shù)值序列型變量MASEFastNumericSeriesMASEFast;//定義數(shù)值序列型變量MASESlowNumericSeriesMASESlow;//定義數(shù)值序列型變量MASXFastNumericSeriesMASXFast;//定義數(shù)值序列型變量MASXSlowNumericSeriesMASXSlow;Begin//如果不滿足集合競價過濾條件,則返回If(!CallAuctionFilter())Return;//計算收盤價的移動平均值,并將結(jié)果存儲在MALEFast中,移動平均周期為LEFastMALEFast=Average(Close,LEFast);//計算收盤價的移動平均值,并將結(jié)果存儲在MALESlow中,移動平均周期為LESlowMALESlow=Average(Close,LESlow);//計算收盤價的移動平均值,并將結(jié)果存儲在MALXFast中,移動平均周期為LXFastMALXFast=Average(Close,LXFast);//計算收盤價的移動平均值,并將結(jié)果存儲在MALXSlow中,移動平均周期為LXSlowMALXSlow=Average(Close,LXSlow);//計算收盤價的移動平均值,并將結(jié)果存儲在MASEFast中,移動平均周期為SEFastMASEFast=Average(Close,SEFast);//計算收盤價的移動平均值,并將結(jié)果存儲在MASESlow中,移動平均周期為SESlowMASESlow=Average(Close,SESlow);//計算收盤價的移動平均值,并將結(jié)果存儲在MASXFast中,移動平均周期為SXFastMASXFast=Average(Close,SXFast);//計算收盤價的移動平均值,并將結(jié)果存儲在MASXSlow中,移動平均周期為SXSlowMASXSlow=Average(Close,SXSlow);//如果當(dāng)前倉位不為空頭,且當(dāng)前柱數(shù)大于等于100If(Marketposition<>-1andCurrentbar>=100){//如果前一柱的MASEFast小于MASESlow,前一柱的MASXFast小于MASXSlow,當(dāng)前最低價小于等于前一柱的最低價且成交量大于0

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論