|
小弟剛入AmiBroker 找個題目練習 並分享...
原文在TradeStation討論區 由ilPir大大發表,
用法ilPir大大已分享很完整 請參考原討論串
http://coco-in.net/viewthread.php?tid=3993&extra=page%3D1
圖型解說:
上圖有2條細線 用來判斷往上往下突破之用..
圖最底下有2條顏色bar 這是LSS 振盪(LSS Oscillato) 我已將高於70用紅色表示看漲
低於30用綠色表示看跌 介於70~30用灰色表示盤整
最下面的改變 是忠於原著 用日線為數據計算(計算方式跟ilPir大大一樣)未用平滑處理
上面一點的顏色bar是採當下使用的週期的資料做計算產生的結果
下面為公式
- _SECTION_BEGIN("Price");_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); _SECTION_END();
- nPrevC1=TimeFrameGetPrice( "C", inDaily, -1);nPrevC5=TimeFrameGetPrice( "C", inDaily, -5);nPrevH1=TimeFrameGetPrice( "H", inDaily, -1);nPrevH2=TimeFrameGetPrice( "H", inDaily, -2);nPrevH3=TimeFrameGetPrice( "H", inDaily, -3);nPrevH4=TimeFrameGetPrice( "H", inDaily, -4);nPrevH5=TimeFrameGetPrice( "H", inDaily, -5);nPrevL1=TimeFrameGetPrice( "l", inDaily, -1);nPrevL2=TimeFrameGetPrice( "l", inDaily, -2);nPrevL3=TimeFrameGetPrice( "l", inDaily, -3);nPrevL4=TimeFrameGetPrice( "l", inDaily, -4);nPrevL5=TimeFrameGetPrice( "l", inDaily, -5);nPrevO1=TimeFrameGetPrice( "O", inDaily, -1);
- //Hypothetical 5-Day PeriodFiv-DaynX= (nPrevH1 + nPrevL1 + nPrevC1)/3;
- nUp = nPrevL1 + (( nPrevH1-nPrevL2)+( nPrevH2-nPrevL3)+( nPrevH3-nPrevL4))/3 ;nBuyH = nPrevH1 + (( nPrevH1-nPrevH2)+( nPrevH2-nPrevH3)+( nPrevH3-nPrevH4))/3 ;nLLSUp = 2 * nX - nPrevL1 ;nRR = (nUp + nBuyH + nPrevH1 + nLLSUp) / 4 ;
- nDn = nPrevH1 + (( nPrevH2-nPrevL1)+( nPrevH3-nPrevL2)+( nPrevH4-nPrevL3))/3 ;nBuyL = nPrevL1 - (( nPrevL2-nPrevL1)+( nPrevL3-nPrevL2)+( nPrevL4-nPrevL3))/3 ;nLLSDn = 2 * nX - nPrevH1 ;nSS = (nDn + nBuyL + nPrevL1 + nLLSDn) / 4 ;Plot( nRR, "RR", colorDarkRed, styleNoTitle );Plot( nSS, "SS", colorDarkGreen, styleNoTitle );
- // LSS Oscillator
- nMax1D=Max(nPrevH1,nPrevH2);nMax2D=Max(nPrevH3,nPrevH4);nMax3D=Max(nMax1D,nMax2D);nMaxD=Max(nMax3D,nPrevH5);
- nMin1D=Max(nPrevL1,nPrevL2);nMin2D=Max(nPrevL3,nPrevL4);nMin3D=Max(nMin1D,nMin2D);nMinD=Max(nMin3D,nPrevL5);
- nXXD = nMaxD - nPrevC5;nYYD = C - nMinD;nOscD =(nXXD+nYYD)/((nMaxD-nMinD)*2)*100;
- nMax1=Max(H,Ref(H,-1));nMax2=Max(Ref(H,-2),Ref(H,-3));nMax3=Max(nMax1,nMax2);nMax=Max(nMax3,Ref(H,-4));
- nMin1=Max(L,Ref(L,-1));nMin2=Max(Ref(L,-2),Ref(L,-3));nMin3=Max(nMin1,nMin2);nMin=Max(nMin3,Ref(L,-4));
- nXX = nMax - Ref(C,-4);nYY = C - nMin;nOsc =(nXX+nYY)/((nMax-nMin)*2)*100;
- Plot( 1, "", IIf(nOscD>70,colorDarkRed, IIf(nOscD<30, colorDarkGreen, colorLightGrey)), styleOwnScale|styleArea|styleNoLabel, -0.1, 100 );Plot( 1, "", IIf(nOsc>70,colorDarkRed, IIf(nOsc<30, colorDarkGreen, colorLightGrey)), styleOwnScale|styleArea|styleNoLabel, -0.1, 50 );
複製代碼 |
|