AO動能指標 (顏色自己改吧)
/* Exploration, System and Indicator */// Author: Steve Wiser
// Email address: slwiserr@erols.com
// May 5, 2001 */
/*
The Awesome Oscillator measures the immediate momentum of the last 5 price bars as
compared to the last 34 price bars.
Three types of signals are generated by the AO:
The Saucer, the Cross, and Twin Peaks
Above the Zero Line, the only signals generated are a Twin Peaks sell, a Saucer buy and
a buy Cross.
Below the Zero Line, the only signals generated are a Twin Peaks buy, Saucer sell, and a
sell Cross.
We color green any histogram bar that is higher than the previous
histogram bar, and we color red any histogram bar that is lower than the previous bar.
Saucer Signal:
1. Always read from left to right.
2. It takes a minimum of three bars to create a signal.
3. There is no limit to how many bars can be inside a saucer.
4. All bars in a Saucer must be above the zero line
5. The signal bar will be a Green Bar
6. You can not have a buy and sell at the same time.
7. After creating a signal, you MUST have a change of direction (color) before creating
another signal.
8. Once you have created a signal, go to the corresponding price bar and add/subtract 1
tick to the high/low.
THE AO CROSS BUY
buy when the histogram is "crossing" the zero line from a negative number to a positive
number.
Twin Peaks buy signal
This is the only buy signal that can be created while the AO histogram is below the zero line
a€¢ The first peak must be a larger negative number than the second peak.
a€¢ Your trigger bar will be a Green Bar and a smaller negatille number than either peak.
a€¢ If any bars cross the zero line in the Twin Peaks, the signal is invalid.
a€¢ A Saucer Sell will be created before a Twin Peaks Buy.
General Emphasis: You cannot sell on an AO signal if the current
histogram bar is green, and you cannot buy any AO signals if the current histogram bar is red.
*/
//outsidebar = Outside();
//insidebar = H <= Ref(H,-1) AND L >= Ref(L,-1);
//upbar = H > Ref(H,-1) AND L >= Ref(L, -1);
//downbar = L < Ref(L,-1) AND H <= Ref(H,-1);
//barcolor=IIf(outsidebar, 1,
// IIf(downbar, 4,
// IIf(upbar, 5,
// IIf(insidebar,6, 0 ) ) ) );
/*barcolor=
iif(outsidebar, 1, iif(downbar, 4, iif(upbar,5, 0) ) );*/
var1=MA( Avg , 34);
var2=MA( Avg,5);
diff = var2-var1;
Graph0= diff;
Graph0Name = "AO";
Graph0Style=2+4;
Graph1=Wilders(diff ,5);
Graph1Style=4+1;
UpBar = diff > Ref(diff,-1);
DownBar = diff < Ref(diff,-1);
Graph0BarColor=IIf(UpBar, colorred, colorblack);
SoucerUp = Ref(diff,-2) > Ref(diff,-1) AND Ref(diff,-1) < diff;
SoucerDown = Ref(diff,-2) < Ref(diff,-1) AND Ref(diff,-1) > diff;
SoucerBuy = SoucerUp AND (diff > 0 AND Ref(diff,-1) > 0 AND Ref(diff,-2) > 0);
SoucerSell = SoucerDown AND (diff < 0 AND Ref(diff,-1) < 0 AND Ref(diff,-2) < 0);
CrossBuy = diff > 0 AND Ref(diff,-1) < 0;
CrossSell = diff < 0 AND Ref(diff,-1) > 0;
Buy = SoucerBuy OR CrossBuy;
Sell = SoucerSell OR CrossSell;
//PlotShapes( IIf(SoucerBuy ,shapeDigit1,0) ,colorBlue, 0, 0,-12);
//PlotShapes( IIf(CrossBuy ,shapeDigit2,0) ,colorBlue, 0, 0,-12);
//PlotShapes( IIf(SoucerSell ,shapeDigit1,0) ,colorOrange, 0, 0,12);
//PlotShapes( IIf(CrossSell ,shapeDigit2,0) ,colorOrange, 0, 0,12);
LatestLowPeak = IIf(diff < 0, Ref(LowestSince(CrossSell, diff, 1), -1), 0);
TwinPeaksBuy = diff < 0 AND Ref(DownBar, -1) AND UpBar AND Ref(diff,-1) > LatestLowPeak;
//Move latest lowest peak to the new one created now:
LatestLowPeak = IIf(TwinPeaksBuy, Ref(diff,-1), LatestLowPeak);
//PlotShapes( IIf(TwinPeaksBuy ,shapeDigit3,0) ,colorBlue, 0, 0,12);
LatestHighPeak = IIf(diff > 0, Ref(HighestSince(CrossBuy, diff, 1), -1), 0);
TwinPeaksSell = diff > 0 AND Ref(UpBar, -1) AND downBar AND Ref(diff,-1) < LatestHighPeak ;
LatestHighPeak = IIf(TwinPeaksSell, Ref(diff,-1), LatestHighPeak );
//PlotShapes( IIf(TwinPeaksSell ,shapeDigit3,0) ,colorOrange, 0, 0,-12);
SuperAOBuy = Ref(DownBar, -3) AND Ref(UpBar, -2) AND Ref(UpBar, -1) AND UpBar;
SuperAOSell = Ref(UpBar, -3) AND Ref(DownBar, -2) AND Ref(DownBar, -1) AND DownBar;
//PlotShapes( IIf(SuperAOBuy ,shapeDigit4,0) ,colorBlue, 0, 0,12);
//PlotShapes( IIf(SuperAOSell ,shapeDigit4,0) ,colorOrange, 0, 0,-12);
/* Super AO Blue Light Special
If you have a Super AO buy signal and it is not hit and the AO does not change color,
and the next bar has a lower high then you will move your buy stop down to one tick above that high.
You will continue to do this until the signal is hit or the AO changes color
*/
//Commentary:
WriteIf(SuperAOBuy,"Place Buy Stop to buy 1 unit if price rises to " + WriteVal(H+0.01)+" or higher. (AO+ SAO Add on)",
WriteIf(SuperAOSell ,"Place Sell Stop to sell 1 unit if price falls to " + WriteVal(L-0.01)+" or lower. (AO- SAO Add on)",
WriteIf(SoucerBuy ,"Place Buy Stop to buy 1 unit if price rises to " + WriteVal(H+0.01)+" or higher. (AO+ Soucer)",
WriteIf(SoucerSell ,"Place Sell Stop to sell 1 unit if price falls to " + WriteVal(L-0.01)+" or lower. (AO- Soucer)",
WriteIf(CrossBuy ,"Place Buy Stop to buy 1 unit if price rises to " + WriteVal(H+0.01)+" or higher. (AO+ Zero Cross)",
WriteIf(CrossSell ,"Place Sell Stop to sell 1 unit if price falls to " + WriteVal(L-0.01)+" or lower. (AO- Zero Cross)",
WriteIf(TwinPeaksBuy ,"Place Buy Stop to buy 1 unit if price rises to " + WriteVal(H+0.01)+" or higher. (AO+ Twin Peaks)",
WriteIf(TwinPeaksSell ,"Place Sell Stop to sell 1 unit if price falls to " + WriteVal(L-0.01)+" or lower. (AO- Twin Peaks)",""))))))));
本帖最後由 清茶無糖 於 10-6-11 07:25 PM 編輯
alexwang7777下午分享好多清茶小弟看沒有的東東{:4_93:} 好長一串最後這個;
複製不了要自己加上
謝謝分享呢
頁:
[1]