Sie sind auf Seite 1von 6

/*

Bill William's Alligator System II Awesome Oscillator, modified from


williamAlligator2.
Reference Website:
==================
http://www.alpari-idc.com/en/market-analysis-guide/chaos-theory/alligator-and-
gator.html

Original by by Steve Wiser - slwiserr@erols.com


Modified by TohMz on June 9th, 2008
*/
SetChartOptions( 0, chartShowArrows|chartShowDates );

_SECTION_BEGIN("BW Alligator");
/*** The trend indicators ***/

P= ParamList("Price", "Close|(H+L)/2|(H+C+L)/3",1);

if (P=="Close")
A = C;

else
if (P=="(H+C+L)/3")
A = (H+C+L)/3;
else
A = (H+L)/2;

AlligatorJaw = Ref(Wilders(A,13),-8);
AlligatorTeeth = Ref(Wilders(A,8), -5);
AlligatorLips = Ref(Wilders(A,5), -3);

AO=MA(A,5)-MA(A,34);
AOcolor=IIf(AO>Ref(AO,-1),colorGreen,colorRed);

AC=AO-MA(AO,5);
ACcolor=IIf(AC>Ref(AC,-1),colorGreen,colorRed);

Plot(AO,"AO",AOcolor,styleHistogram|styleThick);

_SECTION_END();

_SECTION_BEGIN("BW Fractal");

UpFractal= ValueWhen(
(Ref(H,-2) > Ref(H, -4)) AND
(Ref(H,-2) > Ref(H, -3)) AND
(Ref(H,-2) > Ref(H, -1)) AND
(Ref(H,-2) > H), Ref(H,-2));

DownFractal= ValueWhen(
(Ref(L,-2) <= Ref(L, -4)) AND
(Ref(L,-2) <= Ref(L, -3)) AND
(Ref(L,-2) <= Ref(L, -1)) AND
(Ref(L,-2) <= L), Ref(L,-2));

_SECTION_END();
_SECTION_BEGIN("Exploration");

/*
Buy: Scan stocks only breakout..maxbreakout (1~30%, default) and Trend is
bullish
Sell: Scan stocks only breakout..maxbreakout (1~30%, default) and Trend is
bearish

*/
//== Price Increment Value - depend on different country
Inc = 1;

//== Set the Price Range for stock to scan


PriceFrom = Param("Price From:", 50, 1, 200000, Inc);
PriceTo = Param("Price To:", 200000, 1, 200000, Inc);
MaxBreakOut = Param("Max Breakout (%)", 5, 1, 30);
MaxBreakOut = MaxBreakOut/100;

Buy = C>UpFractal AND C<=(1+MaxBreakOut)*UpFractal AND


AlligatorTeeth>AlligatorJaw; /* AND AlligatorLips>AlligatorTeeth; */
Sell = C<DownFractal AND C>=(1-MaxBreakOut)*DownFractal AND
AlligatorTeeth<AlligatorJaw; /* AND AlligatorLips<AlligatorTeeth; */

Filter = (Buy OR Sell) AND (MA(V,3)/EMA(V,17))>1;

AddTextColumn(FullName(), "Security", 1.0, colorDefault, colorDefault, 200);


AddTextColumn( WriteIf(Buy,"Buy", WriteIf(Sell, "Sell", "")), "Trade", 1.0);
AddColumn( UpFractal, "Up Fratal");
AddColumn( DownFractal, "Down Fratal");
AddColumn( MA(V,3)/EMA(V,17), "MAV(3/17)");
AddColumn( C, "Today's Close");

SetSortColumns(-2);

_SECTION_END();

GfxSetOverlayMode(1);
GfxSelectFont("Tahoma", Status("pxheight")/6 );
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( ParamColor( "Warna", colorLightGrey ) );
GfxSetBkMode(0); // transparent
GfxTextOut( "Awesome", Status("pxwidth")/2, Status("pxheight")/2 );

--------
P= ParamList("Price", "Close|(H+L)/2|(H+C+L)/3",1);

if (P=="Close")
A = C;

else
if (P=="(H+C+L)/3")
A = (H+C+L)/3;
else
A = (H+L)/2;

AlligatorJaw = Ref(Wilders(A,13),-8);
AlligatorTeeth = Ref(Wilders(A,8), -5);
AlligatorLips = Ref(Wilders(A,5), -3);

AO=MA(A,5)-MA(A,34);

// Supertrend Section

HalfLife = param("channel halflife", 5, 1, 20, 1);


ChanLen = param("channel length", 20 , 1, 20, 1);

shrink = 2^(-HalfLife);
shrink2 = 1 - shrink;

topChan[0] = High[0];
botChan[0] = Low[0];

HH = HHV(High, ChanLen);
LL = LLV(Low, Chanlen);

for( i = 1; i < BarCount-1; i++ ) {


topChan[i] = shrink * H[i] + shrink2 * topChan[i-1] ;
botChan[i] = shrink * L[i] + shrink2 * botChan[i-1] ;
if (HH[i] >= topChan[i]) topChan[i] = HH[i];
if (LL[i] <= botChan[i]) botChan[i] = LL[i];
}

Up=topChan;

Dn=botChan;

TrendUp=TrendDown=Null;

trend[0]=1;

changeOfTrend=0;

flag=flagh=0;

for (i = 1; i <BarCount-1; i++) {

TrendUp[i] = Null;

TrendDown[i] = Null;

trend[i]=1;
if (Close[i]>Up[i-1]) {

trend[i]=1;

if (trend[i-1] == -1) changeOfTrend = 1;

else if (Close[i]<Dn[i-1]) {

trend[i]=-1;

if (trend[i-1] == 1) changeOfTrend = 1;

else if (trend[i-1]==1) {

trend[i]=1;

changeOfTrend = 0;

else if (trend[i-1]==-1) {

trend[i]=-1;

changeOfTrend = 0;

if (trend[i]<0 && trend[i-1]>0) {

flag=1;

else {

flag=0;

if (trend[i]>0 && trend[i-1]<0) {

flagh=1;

else {

flagh=0;
}

if (trend[i]>0 && Dn[i]<Dn[i-1]){

Dn[i]=Dn[i-1];

if (trend[i]<0 && Up[i]>Up[i-1])

{ Up[i]=Up[i-1];

if (flag==1)

{ Up[i]=topchan[i];;

if (flagh==1)

{ Dn[i]=botChan[i];;

if (trend[i]==1) {

TrendUp[i]=Dn[i];

if (changeOfTrend == 1) {

TrendUp[i-1] = TrendDown[i-1];

changeOfTrend = 0;

else if (trend[i]==-1) {

TrendDown[i]=Up[i];

if (changeOfTrend == 1) {

TrendDown[i-1] = TrendUp[i-1];

changeOfTrend = 0;

}
}

supertrendUp = trend==1;

supertrendDown = trend==-1;

// Supertrend Section End


tenBarMA = MA(Close, 10) > MA(Close, 20);

Buy = (Cross(AO, 0) AND MACD() > Signal()) OR (Cross(MACD(), Signal()) AND AO > 0)
AND tenBarMA AND supertrendUp;
Sell = (Cross(0, AO) AND MACD() < Signal()) OR (Cross(Signal(), MACD()) AND AO < 0)
AND !tenBarMA AND supertrendDown;

SetSortColumns(-3);
Buy = (Cross(AO, 0) AND MACD() > Signal() AND trend == 1 AND MA(Close, 10) >
MA(Close, 20)) OR (Cross(MACD(), Signal()) AND AO > 0 AND trend == 1 AND MA(Close,
10) > MA(Close, 20));
Sell = (Cross(0, AO) AND MACD() < Signal() AND trend == -1 AND MA(Close, 10) <
MA(Close, 20)) OR (Cross(Signal(), MACD()) AND AO < 0 AND trend == -1 AND MA(Close,
10) < MA(Close, 20));

Das könnte Ihnen auch gefallen