回調(diào)止損點(diǎn)策略(TB版)_第1頁(yè)
回調(diào)止損點(diǎn)策略(TB版)_第2頁(yè)
回調(diào)止損點(diǎn)策略(TB版)_第3頁(yè)
回調(diào)止損點(diǎn)策略(TB版)_第4頁(yè)
回調(diào)止損點(diǎn)策略(TB版)_第5頁(yè)
已閱讀5頁(yè),還剩14頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

回調(diào)止損點(diǎn)策略(TB版)該策略實(shí)現(xiàn)了一個(gè)基于止損點(diǎn)(TakePoint)和回調(diào)點(diǎn)(retracementpoint)的交易邏輯,適用于交易時(shí)段的自動(dòng)化交易決策。以下是策略的主要思路和步驟概述:1.**參數(shù)與變量定義**:-`TakePoint0`是初始止盈止損點(diǎn)的基礎(chǔ)值。-`LossPoint`通過`TakePoint0`計(jì)算得到,作為每級(jí)盈利目標(biāo)或回調(diào)幅度的基礎(chǔ)。-定義了多個(gè)系列變量用于跟蹤價(jià)格、買賣點(diǎn)位、高低點(diǎn)等市場(chǎng)動(dòng)態(tài)。-`EndTime`根據(jù)不同的交易品種設(shè)置了市場(chǎng)收盤前的交易截止時(shí)間。2.**授權(quán)檢查**:-檢查策略的授權(quán)日期范圍,若超過授權(quán)期限則不執(zhí)行任何操作并提示授權(quán)狀態(tài)。3.**交易時(shí)段處理**:-在每個(gè)交易日的1小時(shí)周期開始時(shí)提醒周期,并在接近或超過授權(quán)期限時(shí)發(fā)出通知。-若交易時(shí)間接近收盤時(shí)間(`EndTime`)并且有持倉(cāng),則自動(dòng)平倉(cāng)。4.**止盈止損邏輯**:-根據(jù)市場(chǎng)位置(`MarketPosition`),分別對(duì)多頭和空頭倉(cāng)位設(shè)置了多個(gè)級(jí)別的止盈退出條件。-多頭(買入)情況下,當(dāng)利潤(rùn)達(dá)到一系列遞增的止盈點(diǎn)(`TakePoint1`至`TakePoint5`),并且回調(diào)不超過相應(yīng)的回調(diào)點(diǎn)(`retrdpiont0`至`retrdpiont5`),則在較高價(jià)位賣出平倉(cāng)。-空頭(賣出)情況下,當(dāng)利潤(rùn)達(dá)到相同的止盈點(diǎn)系列,并且回調(diào)不超過對(duì)應(yīng)的回調(diào)點(diǎn),則在較低價(jià)位買入平倉(cāng)以鎖定利潤(rùn)。-特別地,對(duì)于`TakePoint5`,還考慮了反向最高價(jià)與回調(diào)點(diǎn)的關(guān)系,以決定是否觸發(fā)平倉(cāng)。5.**市場(chǎng)動(dòng)態(tài)跟蹤**:-通過計(jì)算并跟蹤`HighAfterEntry`和`LowAfterEntry`來記錄進(jìn)入交易后的新高點(diǎn)和新低點(diǎn),用于動(dòng)態(tài)調(diào)整止盈止損點(diǎn)。-使用`BuyHighestPosiPro`和`SellHighestPosiPro`等變量來衡量持倉(cāng)的最大潛在盈利,以及在特定條件下可能的反轉(zhuǎn)點(diǎn)盈利。6.**圖表繪制**:-在交易日發(fā)生變化時(shí),根據(jù)收盤價(jià)與前一日基礎(chǔ)價(jià)格的比較,在圖表上繪制“漲版”或“跌版”的標(biāo)記,輔助視覺分析。綜上所述,該策略的核心在于動(dòng)態(tài)管理多空頭寸,利用逐步提升的止盈點(diǎn)和回調(diào)點(diǎn)來鎖定盈利,同時(shí)在市場(chǎng)情況不利時(shí)減少損失。通過精細(xì)的條件判斷和適時(shí)的平倉(cāng)操作,旨在實(shí)現(xiàn)持續(xù)盈利并控制風(fēng)險(xiǎn)。策略信號(hào)代碼ParamsNumericTakePoint0(62);VarsNumericLots(1);NumericLossPoint;NumericSeriestimes;NumericZSPrice;NumericSeriesBasedpriceUp;NumericSeriesBasedpricedown;NumericSeriesBasedprice;NumericHighDDPrice;NumericLowDprice;NumericSeriesDownLineK;NumericSeriesUpLineK;NumericSeriesKZhu;NumericSeriesKZhu0;NumericEndTime;NumericBarsSToday;NumericSeriesRedK;NumericSeriesGreenK;NumericSeriesYellowK;NumericSeriesBuyHighAfterEntry;NumericSeriesSellHighAfterEntry;NumericSeriesLowAfterEntry;NumericSeriesHighAfterEntry;NumericBuyHighestPosiPro;NumericSellHighestPosiPro;NumericBuyReverseHighestPosiPro;NumericSellReverseHighestPosiPro;NumericZYPrice;Numericretrdpiont0;Numericretrdpiont1;Numericretrdpiont2;Numericretrdpiont3;Numericretrdpiont4;Numericretrdpiont5;NumericTakePoint1;NumericTakePoint2;NumericTakePoint3;NumericTakePoint4;NumericTakePoint5;NumericK(3);NumericTODAYBARS;NumericDateDay(20131211);BeginTODAYBARS=BarsSinceToday+1;If(TODAYBARS==1){PlotString("周期提醒:",SymbolName+":1H");}If(TODAYBARS==1&&Date>=DateDay&&Date<=DateDay+5){PlotString("授權(quán)","授權(quán)時(shí)間即將過期",0);}If(TODAYBARS==1&&Date>DateDay+3){PlotString("授權(quán)","授權(quán)時(shí)間已經(jīng)過期",0);}If(Date>DateDay+5){Return;}If(BarType==1){If(Left(Symbol,2)=="IF"){EndTime=0.1515-0.0001*BarInterval;}Else{EndTime=0.1460-0.0001*BarInterval;}}If(Time>=EndTime&&MarketPosition<>0){BuyToCover(0,o);Sell(0,o);//PlotString("平倉(cāng)","平倉(cāng)"+Text(ExitPrice),Low,Yellow);Return;}LossPoint=TakePoint0/5;TakePoint1=TakePoint0+LossPoint;TakePoint2=TakePoint1+LossPoint;TakePoint3=TakePoint2+LossPoint;TakePoint4=TakePoint3+LossPoint;TakePoint5=TakePoint4+LossPoint;retrdpiont0=LossPoint/2;retrdpiont1=retrdpiont0+LossPoint/2;retrdpiont2=retrdpiont1+LossPoint/2;retrdpiont3=retrdpiont2+LossPoint/2;retrdpiont4=retrdpiont3+LossPoint/2;retrdpiont5=retrdpiont4+LossPoint/2;//初始化數(shù)據(jù)Basedprice=CloseD(1);HighDDPrice=HighD(0);LowDprice=LowD(0);//繪制第一根線If(Date!=Date[1]){If(Close>Basedprice&&Low>=BasedpriceDown){PlotNumeric("漲版:",Basedprice,Close,Red);RedK=RedK+1;GreenK=0;YellowK=0;Return;}If(Close<=BasedpriceUp){PlotNumeric("跌版:",Close,Basedprice,Green);GreenK=GreenK+1;RedK=0;YellowK=0;Return;}If(Close==Basedprice){UnPlot("漲版:");UnPlot("跌版:");}}//繪制第二根線If(Date!=Date[1]){times=0;YellowK=0;RedK=0;GreenK=0;BasedpriceUp=HighDDPrice;Basedpricedown=LowDprice;UpLineK=0;DownLineK=0;KZhu=0;KZhu0=1;}Else{times=times[1];UpLineK=UpLineK[1];DownLineK=DownLineK[1];KZhu=KZhu[1];KZhu0=KZhu0[1];YellowK=YellowK[1];RedK=RedK[1];GreenK=GreenK[1];}If(BarStatus>0){//記錄上漲數(shù)據(jù)If(Close[1]>BasedpriceUp){BasedpriceUp=Close[1];Basedpricedown=Low[1];UpLineK=UpLineK+1;RedK=RedK+1;GreenK=0;YellowK=0;DownLineK=0;KZhu=1;PlotNumeric("紅版:",Open[1],BasedpriceUp,Red);}//記錄下跌數(shù)據(jù)If(Close[1]<Basedpricedown[1]){BasedpriceUp=High[1];Basedpricedown=Close[1];DownLineK=DownLineK+1;GreenK=GreenK+1;YellowK=0;RedK=0;UpLineK=0;KZhu=1;PlotNumeric("綠版:",BasedpriceUp,Open[1],Green);}}If(Close[1]>Basedpricedown&&Close[1]<BasedpriceUp[1]){BasedpriceUp=BasedpriceUp[1];Basedpricedown=Basedpricedown[1];KZhu=0;PlotNumeric("平版:",Close[1],Open[1],Yellow);YellowK=YellowK+1;GreenK=0;RedK=0;}If(KZhu==1){KZhu0=1;}Else{KZhu0=0;}If(KZhu0==0&&BarsSToday>1){PlotNumeric("平版:",Close[1],Open[1],Yellow);GreenK=0;RedK=0;}if(RedK<>0){PlotString("RedK:",Text(RedK),o);}if(YellowK<>0){PlotString("YellowK:",Text(YellowK),o);}if(GreenK<>0){PlotString("GreenK:",Text(GreenK),o);}if(MarketPosition==0&&Time<0.1450){if(RedK>=K){Buy(Lots,o);times=times[1]+1;HighAfterEntry=High;LowAfterEntry=Low;Return;}if(GreenK>=K){SellShort(Lots,o);times=times[1]+1;HighAfterEntry=High;LowAfterEntry=Low;Return;}}If(MarketPosition==1&&(LastEntryPrice-Low>=LossPoint)){ZSPrice=Min(open,LastEntryPrice-LossPoint);Sell(0,ZSPrice);Return;}If(MarketPosition==-1&&(High-LastEntryPrice>=LossPoint)){ZSPrice=Max(open,LastEntryPrice+LossPoint);BuyToCover(0,ZSPrice);Return;}//止盈止損計(jì)算If(BarsSinceEntry>=1){If(High>HighAfterEntry[1]){HighAfterEntry=High;}else{HighAfterEntry=HighAfterEntry[1];}If(Low<LowAfterEntry[1]){LowAfterEntry=Low;}else{LowAfterEntry=LowAfterEntry[1];}}BuyHighestPosiPro=HighAfterEntry[1]-EntryPrice;SellHighestPosiPro=EntryPrice-LowAfterEntry[1];BuyReverseHighestPosiPro=HighAfterEntry[1]-Low;SellReverseHighestPosiPro=High-LowAfterEntry[1];If(MarketPosition==1andBarsSinceLastEntry>1){If(BuyHighestPosiPro>=TakePoint0&&SellHighestPosiPro>=retrdpiont0){ZYPrice=Min(open,HighAfterEntry[1]-retrdpiont0);SellShort(Lots,ZYPrice);//PlotString("多止贏","多止贏"+Text(ExitPrice),Low,Yellow);Return;}//If(BuyHighestPosiPro>=TakePoint1&&SellHighestPosiPro>=retrdpiont1){ZYPrice=Min(open,HighAfterEntry[1]-retrdpiont1);SellShort(Lots,ZYPrice);//PlotString("多止贏","多止贏"+Text(ExitPrice),Low,Yellow);Return;}If(BuyHighestPosiPro>=TakePoint2&&SellHighestPosiPro>=retrdpiont2){ZYPrice=Min(open,HighAfterEntry[1]-retrdpiont2);SellShort(Lots,ZYPrice);//PlotString("多止贏","多止贏"+Text(ExitPrice),Low,Yellow);Return;}If(BuyHighestPosiPro>=TakePoint3&&SellHighestPosiPro>=retrdpiont3){ZYPrice=Min(open,HighAfterEntry[1]-retrdpiont3);SellShort(Lots,ZYPrice);//PlotString("多止贏","多止贏"+Text(ExitPrice),Low,Yellow);Return;}If(BuyHighestPosiPro>=TakePoint4&&SellHighestPosiPro>=retrdpiont4){ZYPrice=Min(open,HighAfterEntry[1]-retrdpiont4);SellShort(Lots,ZYPrice);//PlotString("多止贏","多止贏"+Text(ExitPrice),Low,Yellow);Return;}If(BuyHighestPosiPro>=TakePoint5&&BuyReverseHighestPosiPro>retrdpiont5){ZYPrice=Min(open,HighAfterEntry[1]-retrdpiont5);SellShort(Lots,ZYPrice);//PlotString("多止贏","多止贏"+Text(ExitPrice),Low,Yellow);Return;}}If(MarketPosition==-1andBarsSinceLastEntry>1){If(SellHighestPosiPro>=TakePoint0&&SellHighestPosiPro>=retrdpiont0){ZYPrice=Max(open,LowAfterEntry[1]+retrdpiont0);Buy(Lots,ZYPrice);//PlotString("空止贏","空止贏"+Text(ExitPrice),High,Yellow);Return;}If(SellHighestPosiPro>=TakePoint1&&SellHighestPosiPro>=retrdpiont1){ZYPrice=Max(open,LowAfterEntry[1]+retrdpiont1);Buy(Lots,ZYPrice);//PlotString("空止贏","空止贏"+Text(ExitPrice),High,Yellow);Return;}If(SellHighestPosiPro>=TakePoint2&&SellHighestPosiPro>=retr

溫馨提示

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

最新文檔

評(píng)論

0/150

提交評(píng)論