Fave This

Thursday 20 May 2010

[Komunitas AmiBroker] AFL Darvas+MACD (anti bearish)

_SECTION_BEGIN("ERO ATR BUY SELL");

ero = Param("ATR multiple", 2.5, 0.5, 10, 0.1 )*Param("ATR period", 10, 3, 50 );
ero_col=ParamColor( "Color", colorCycle );

r=HHV(H,ero);
s=LLV(L,ero);
ab=IIf(H>Ref(r,-1),1,IIf(L<Ref(s,-1),-1,0));
ac=ValueWhen(ab!=0,ab,1);
sl=IIf(ac==1,s,r);

Plot(sl, _DEFAULT_NAME(), ero_col, styleStaircase); // or styleaArea

Buy=Cross(H,sl);
Sell=Cross(sl,L);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
_SECTION_END();

_SECTION_BEGIN("FAST");
P = ParamField("Price field",-1);
Periods =Param("periods",15,2,300,1,10);
Plot(EMA(P,Periods),_DEFAULT_NAME(), colorLime, styleLine);
_SECTION_END();

_SECTION_BEGIN("SLOW");
P = ParamField("Price field",-1);
Periods = Param("periods", 30, 2, 300, 1, 10 );
Plot( EMA( P, Periods ), _DEFAULT_NAME(), colorOrange, styleLine);
_SECTION_END();

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_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();

box1=0;
box2=0;
SetBarsRequired(10000,10000);
procedure fillDarvas(start,end,swap,top, bottom )
{
for ( j = start; j < end; j++)
{
if( box1[j] == swap)
box1[j]= top ;
else
box1[j]= bottom;

if(box2[j] == swap)
box2[j]= bottom ;
else
box2[j]= top;
}
}

BoxArr1 = 0;
BoxArr2 = 0;
StateArray = 0;
DBuy = 0;
DSell = 0;
TopArray = 0;
BotArray = 0;
tick=0;

BoxTop = High[0];
BoxBot = Low[0];
swap=0;
state = 0;
BoxStart = 0;

for (i=0; i<BarCount; i++)
{
if (state==5)
{
TopArray[i]=BoxTop;
BotArray[i]=BoxBot;
if (Low[i]<(BoxBot*(1-tick/100)) || High[i]>(BoxTop*(1+tick/100)))
{
fillDarvas(BoxStart,i,swap,BoxTop,BoxBot);

state = 1;
swap = !swap;
BoxTop = High[i];
BoxStart = i;
}
}
else
{
if (High[i]<BoxTop)
{
if ((state<3) || (Low[i]>BoxBot))
{
state++;
}
else
{
state=3;
}
if (state==3)
BoxBot=Low[i];
}
else
{
state=1;
BoxTop=High[i];
}
}
StateArray[i] = state;
}

fillDarvas(BoxStart,BarCount,swap,BoxTop,BoxBot);
Buy=Cover=H>Ref(box1,-1) AND H>Ref(box2,-1) AND Ref(statearray,-1)==5;
Short=Sell=L<Ref(box1,-1) AND L<Ref(box2,-1) AND Ref(statearray,-1)==5;

Plot(C,"",colorDarkGrey,styleCandle);
PlotShapes(shapeUpArrow*(Buy),colorBlue);
PlotShapes(shapeDownArrow*(Sell),colorYellow);

Plot( box1, " RESI " , colorLime, styleLine );
Plot( box2, " SUPP" , colorRed, styleLine );
_SECTION_END();_SECTION_BEGIN("MACD CASONI");

// MACD indicator,
//MODIFIED=CASONI


PeriodFast = Param( "Fast EMA", 12, 2, 200, 1 );
PeriodSlow = Param( "Slow EMA", 26, 2, 200, 1 );
PeriodSignal = Param( "Signal EMA", 9, 2, 200, 1 );
MACDInd = MACD(PeriodFast, PeriodSlow );
SigInd = Signal(PeriodFast, PeriodSlow , PeriodSignal );
HistInd = MACDInd - SigInd ;
_N( macdStr = WriteVal( PeriodFast, 1.0 )+","+WriteVal( PeriodSlow , 1.0 ) );
_N( sigStr = macdStr + ","+WriteVal( PeriodSignal , 1.0 ) );
Plot( MACDInd, "MACD", colorBrightGreen);
Plot( SigInd , "SIGNAL", colorRed);
Buy= MACDIND > SigIND;
Sell= MACDIND < SigIND;
Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy);
PlotShapes( shapeHollowUpArrow* Buy , colorBrightGreen ,0);
PlotShapes( shapeHollowDownArrow* Sell, colorRed ,0);
Plot(0,"",colorDarkBlue,styleLine);

Filter = Buy OR Sell;
Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy);
AddTextColumn(FullName(),"Name");
AddColumn( Buy, "BUY" );
AddColumn( Sell, "SELL" );
_SECTION_END();_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, RSI(9),SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorGrey40 ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

Buy=Cross(MA( Close,5 ),MA( Close,25 )) AND RSI(9)>50;
Sell=Cross(MA( Close,25 ),MA( Close,5 )) AND RSI(9)<50;

PlotShapes(shapeUpArrow * Buy, ParamColor("Buy Arrow", colorBrightGreen),0,Low, - 20);
PlotShapes(shapeDownArrow * Sell, ParamColor("Sell Arrow", colorRed),0,High, - 20);

_SECTION_BEGIN("Show Values at H&L");

n=Param("Values back",20,1,200,1);
p=Param("zig %",5,1,100,1);
dist = 0.8*ATR(15);

for( i = 1; i < n; i++ )
{
PlotText(""+LastValue(Peak(H,p,i),True),BarCount-3-LastValue(PeakBars(H,p,i)),LastValue(dist,True)+LastValue(Peak(H,p,i),False),colorBlack,ColorRGB(225,225,225));
PlotText(""+LastValue(Trough(L,p,i),True),BarCount-3-LastValue(TroughBars(L,p,i)),LastValue(Trough(L,p,i),False)-LastValue(dist,True),colorBlack,ColorRGB(225,225,225));
}

_SECTION_END();

_SECTION_BEGIN("RSI Reversal");
// RSI Levels - appplied to Price Chart shows how far
// tomorrow's closing price has to move in order for
// the RSI to cross the 70, 50 & 30 levels.

pd = Param("Periods",13,5,144,1);
pds = 2*pd-1;// (Adjustment for Wilders MA)
aa = Close-Ref(Close,-1);
uu = EMA(Max(0,aa),pds);
dd= EMA((Max(0,0-aa)),pds);

rf = IIf(C>2,1000,10000);

c1 = Param("Upper Level",70,50,90,1);
qq1 =100/(100-c1)-1;
ff1 = qq1*dd-uu;
ff2 = ff1/qq1;
f1 = Max(ff1,ff2);
UL = Close + f1*(pds-1)/2;
UL = IIf(UL>C,floor(UL*rf),ceil(UL*rf))/rf;

c2 = Param("Equilibrium",50,50,50,0);
qq2 =100/(100-c2)-1;// [=1]
ff = dd-uu;
MM = Close + ff*(pds-1)/2;
MM = IIf(MM>C,floor(MM*rf),ceil(MM*rf))/rf;

c3 = Param("Lower Level",30,10,50,1);
qq3 =100/(100-c3)-1;
ff1 = qq3*dd-uu;
ff2 = ff1/qq3;
f3 = Min(ff1,ff2);
LL = Close + f3*(pds-1)/2;
LL = IIf(LL>C,floor(LL*rf),ceil(LL*rf))/rf;

Plot(UL,"",colorDarkGrey,1);
Plot(MM,"",colorYellow,32);
Plot(LL,"",colorDarkGrey,1);

Cbr = IIf(UL<C,27,IIf(LL>C,32,IIf(MM>C,11,8)));
PlotOHLC(O,H,L,C,"",cbr,styleCandle);

Title = Name() + " - RSI(" + WriteVal(pd,0.0) + ") - Close=" + WriteVal(Close,0.3) + " UL=" + WriteVal(UL,0.4) + " MM=" + WriteVal(MM,0.4) + " LL=" + WriteVal(LL,0.4);
_SECTION_END();

_SECTION_BEGIN("Price Break Indicator");
Title = Name()+ " Price Break Indicator." ;
//+ " Trend is " + Trend_Text + ". SEQUENCE IS " + Sequence_Text;
Plot(C,Title,colorBlack,styleCandle);

///////// Parameters ////////

nBars_To_Scan = Param("Number of bars to Scan",20, 10,480, 10); //Number of bars to include in scan
PB_Interval = Param("Number of Bars for Price Break",3,2,3,1);

///////// Use Array of Prices and Price Breaks to Look Back and Determine What Price break is for Current Bar
Seedbar = nBars_To_Scan + 1; //Need an initial value to start the PB process
if (BarCount > Seedbar) //Make sure there are enough bars available to evaluate
{

Price[0]= LastValue(Ref(C,-Seedbar)); //Seed the 0 Bar in the Array with Values
Trend[0]=1; //1 = Long, 0=Short
Sequence[0]=0; //Sequence counter - counts number of new price breaks
Price_Break[0] = LastValue(Ref(C,-Seedbar));
High_C1[0] = LastValue(Ref(C,-Seedbar)); //Highest Close 1 Ago
High_C2[0]= LastValue(Ref(C,-Seedbar)); //Highest Close 2 Ago
High_C3[0]= LastValue(Ref(C,-Seedbar)); //Highest Close 3 Ago
Low_C1[0] = LastValue(Ref(C,-Seedbar)); //Lowest Close 1 Ago
Low_C2[0] = LastValue(Ref(C,-Seedbar)); //Lowest Close 2 Ago
Low_C3[0] = LastValue(Ref(C,-Seedbar)); //Lowest Close 3 Ago

for ( i=1; i < Seedbar ; i++) //Cycle through prices filling in price array AND caculating price breaks
{
Prior = i-1; //Index for Prior entry in array. Set the current array values to
Trend[i]=Trend[Prior]; //prior values to make sure everything that isn't changed later
Price_Break[i] = Price_Break[Prior]; //gets carried forward to the next row in the array.
Low_C1[i] = Low_C1[Prior]; //Carryover current values
Low_C2[i] = Low_C2[Prior];
Low_C3[i] = Low_C3[Prior];
High_C1[i] = High_C1[Prior]; //Carryover current values
High_C2[i] = High_C2[Prior];
High_C3[i] = High_C3[Prior];
Sequence[i] = Sequence[Prior];

Price[i] = LastValue (Ref (C,-(Seedbar-i))); //Seedbar is the bar just in front of where I start the method. Works since i starts at 1

if (Price[i] >Price[Prior] AND Trend[Prior] == 1 ) // If Close is Greater than the prior Close AND the Trend is Long
{ if (Price[i] >High_C1[Prior]) //If the Close is greater than the last Highest Close
{ //Test For Price Break. The IIF is there to accomodate a 2 price OR 3 price break option
//based on the PB_Interval parameter
Price_Break[i] = IIf(PB_Interval == 3,High_C3[Prior],IIf(PB_Interval ==
2,High_C2[Prior],High_C3[Prior]));
//The 3PB method says I take the highest close 4 ago as the new price break.
Sequence[i] = Sequence[i] + 1; //Increment Sequence if Price Break
High_C3[i] = High_C2[Prior]; //Stacking the higher closes like this avoids having to go back AND iterate through the.
High_C2[i] = High_C1[Prior]; //closes to find and count the higher closes. They are just carried forward in the stack.
High_C1[i] = Price[i]; //When a higher close occurs, it is put on the top of the stack, each Close below is
} //pushed down in sequence, and the earliest (farthest back) close goes away.
}

if (Price[i] >Price[Prior] AND Trend[Prior] == 0 ) // If Close is Greater than the prior Close AND the Trend is Short
{ if (Price[i] >Price_Break[Prior]) //If Close > Price Break in trend is Short, Reverse AND go Long
{
High_C1[i] = High_C2[i] = High_C3[i] = Price[i]; //Initialize sequence of new Highs
Price_Break[i] = Price[i]; //Set new value for Price Break
Trend[i] = 1; //Set the trend Long
Sequence = 0;
}
}

if (Price[i] <Price[Prior] AND Trend[Prior] ==0) // If The Close is less than the prior Close AND the Trend is Short
{ if (Price[i] <Low_C1[Prior]) //If the Close is less than the last lowest Close
{
Price_Break[i] = IIf(PB_Interval == 3,Low_C3[Prior],IIf(PB_Interval ==
2,Low_C2[Prior],Low_C3[Prior])); //Test For Price Break
Sequence[i] = Sequence[i] + 1; //Increment Sequence if Price Break
Low_C3[i] = Low_C2[Prior]; //Update sequence of new Lows
Low_C2[i] = Low_C1[Prior];
Low_C1[i] = Price [i];
}
}

if (Price[i] <Price[Prior] AND Trend[Prior] ==1) // If The Close is less than the prior Close AND the Trend is Long
{ if (Price[i] < Price_Break[Prior]) //If Close < Price Break in Long Trend, reverse AND go Short
{
Low_C1[i] = Low_C2[i] = Low_C3[i] = Price[i]; //Initialize sequence of new Lows
Price_Break[i] = Price[i]; //Set new value for Price Break
Trend[i] = 0; //Set Trend Short
Sequence = 0;
}
}

//// Plot the Price Breaks.
Bar_x1=BarCount - (nBars_To_Scan - Prior );
Bar_x2=BarCount - ( nBars_To_Scan - i);
PB_Color = IIf(Trend[i] == 1,colorGreen, colorRed);
Plot(LineArray(Bar_x1,Price_Break[i],Bar_x2,Price_Break[i],extend=0),"",PB_Color,styleThick);
Sequence_Text = NumToStr(Sequence,format=1.0);
Trend_Text = WriteIf(Trend[i] > 0, "Long","Short");

} //Close the For Loop

} //Close the first test for sufficient bars to do the study
_SECTION_END();

// 350 Swing Indicator

_SECTION_BEGIN("Advanced support resistence and trendlines");
///////////////////////////////////////////////////////////////////////////////////////////
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} ,{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot(C, "", IIf(O>=C, colorOrange, colorGreen),styleCandle);

SetChartBkGradientFill( ParamColor("Inner panel upper",colorBlack),ParamColor("Inner panel lower",colorBlack));
_N(Title = EncodeColor(colorWhite)+StrFormat(" {{NAME}} - {{INTERVAL}} {{DATE}} Open:%g, Close:%g ,{{VALUES}}",O,C ));

/////////////////////////////////////////////////////////////////////////////////////////////

Plot(EMA(C,13),"",colorYellow);
/////////////////////////////////////////////////////////////

per1=Param ("per1", 0.325,0.1,50,0.10);

per=per1;
x = Cum(1);
s1=L;
s11=H;
pS = TroughBars( s1, per, 1 ) == 0;
endt= SelectedValue(ValueWhen( pS, x, 1 ));
startt=SelectedValue(ValueWhen( pS, x, 2 ));
dtS =endt-startt;
endS = SelectedValue(ValueWhen( pS, s1, 1 ) );
startS = SelectedValue( ValueWhen( pS, s1, 1 ));
aS = (endS-startS)/dtS;
bS = endS;
trendlineS = aS * ( x -endt ) + bS;
g3= IIf(x>startt-10,trendlineS,-1e10);
Plot(g3,"",colorRed,styleDashed);

pR = PeakBars( s11, per, 1 ) == 0;
endt1= SelectedValue(ValueWhen( pR, x, 1 ));
startt1=SelectedValue(ValueWhen( pR, x, 2 ));
dtR =endt1-startt1;
endR = SelectedValue(ValueWhen( pR, s11, 1 ) );
startR = SelectedValue( ValueWhen( pR, s11, 1 ));
aR = (endR-startR)/dtR;
bR = endR;
trendlineR = aR * ( x -endt1 ) + bR;
g4= IIf(x>startT1-10,trendlineR,-1e10);
Plot(g4,"",colorGreen,styleDashed);
//////////////////////////////////////////////////////////////////////////////////////////////////
perc=per1;
x=BarIndex();xx=SelectedValue(x);
t1=SelectedValue(ValueWhen(PeakBars(C,perc)==0,x)) ;
H1=SelectedValue(ValueWhen(PeakBars(C,perc)==0,C)) ;
t11=SelectedValue(ValueWhen(TroughBars(C,perc)==0, x));
H11=SelectedValue(ValueWhen(TroughBars(C,perc)==0, C));
g=t1>t11;
shape=IIf(g,shapeDownArrow*(x==t1),shapeUpArrow*(x ==t11));
Color=IIf(g,colorRed,colorGreen);
PlotShapes(shape,color);
/////////////////////////////////////////////////////////////////////////////////////////////////

per=per1;

x = Cum(1);
s1=C;
s11=C;
pS = TroughBars( s1, per, 1 ) == 0;
endt= SelectedValue(ValueWhen( pS, x, 1 ));
startt=SelectedValue(ValueWhen( pS, x, 2 ));
dtS =endt-startt;
endS = SelectedValue(ValueWhen( pS, s1, 1 ) );
startS = SelectedValue( ValueWhen( pS, s1, 2 ));
aS = (endS-startS)/dtS;
bS = endS;
trendlineS = aS * ( x -endt ) + bS;
g3= IIf(x>startt-10,trendlineS,-1e10);
Plot(g3,"",colorRed,styleThick);

pR = PeakBars( s11, per, 1 ) == 0;
endt1= SelectedValue(ValueWhen( pR, x, 1 ));
startt1=SelectedValue(ValueWhen( pR, x, 2 ));
dtR =endt1-startt1;
endR = SelectedValue(ValueWhen( pR, s11, 1 ) );
startR = SelectedValue( ValueWhen( pR, s11, 2 ));
aR = (endR-startR)/dtR;
bR = endR;
trendlineR = aR * ( x -endt1 ) + bR;
g4= IIf(x>startT1-10,trendlineR,-1e10);
Plot(g4,"",colorGreen,styleThick);
//////////////////////////////////////////////////////////////////////////////
_SECTION_END();

_SECTION_BEGIN("Elliot Fractals");

/*
The basic definition of an 'up' fractal is a bar high that is both higher than the two bars immediately preceding it
and higher than the two bars immediately following it.
The lows of the bars are NOT considered in determining the up fractal progression.

If two bars in the progression have equal highs followed by two consecutive bars with lower highs,
then a total of six bars rather than the usual five bars will make up the progression.
The first High becomes the counting fractal. Reverse for 'down' fractals.

The 5 bar formation works best on Daily or longer time frame charts.For intraday data charts we often use 9 bar, 13 bar and 21 bar formations for fractal counting
*/
Up5BarFractal = Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) < H AND Ref(H,2) < H;
Up6BarFractal = Ref(H,-2) < H AND Ref(H,-1) < H AND (H == Ref(H,1)) AND Ref(H,2) < H AND Ref(H,3) < H;
Down5BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) > L AND Ref(L,2) > L;
Down6BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND (L == Ref(L,1)) AND Ref(L,2) > L AND Ref(L,3) > L;

//TODO: More filtering: Show only troughs that are around atrough in trix(9).

PlotShapes( IIf(Down5BarFractal ,shapeSmallUpTriangle,0) ,colorBlack, 0, L,-12);
PlotShapes( IIf(Down6BarFractal ,shapeSmallUpTriangle,0) ,colorBlack, 0, L,-12);

PlotShapes( IIf(Up5BarFractal ,shapeSmallDownTriangle,0) ,colorBlack, 0, H,-12);
PlotShapes( IIf(Up6BarFractal ,shapeSmallDownTriangle,0) ,colorBlack, 0, H,-12);

Up = (Up5BarFractal OR Up6BarFractal);
Down = (Down5BarFractal OR Down6BarFractal);
//Removing false fractals:
DownSignal = Flip(Ref(Up,-1), Ref(Down,-1));
UpSignal = Flip(Ref(Down,-1), Ref(Up,-1));

LastHigh[0] = H[0];
LastLow[0] = L[0];

LastLowIndex = 0;
LastHighIndex = 0;
Valid = 0;
for (i=1; i < BarCount; i++)
{

LastHigh[i] = LastHigh[i-1];
LastLow[i] = LastLow[i-1];
if (Up[i])
{
Valid[i] = True;
if (DownSignal[i])
{
//Sequence of 2 Up Fractals. Validate only the higher one.
Valid[i] = H[i] >= H[LastHighIndex];
Valid[LastHighIndex] = H[LastHighIndex] > H[i];
}
LastHigh[i] = Max(H[i], H[LastHighIndex ]);
LastHighIndex = i;
}

if (Down[i])
{
Valid[i] = True;
if (UpSignal[i])
{
//Sequence of 2 Down Fractals. Validate only the lower one.
Valid[i] = L[i] <= L[LastLowIndex];
Valid[LastLowIndex] = L[LastLowIndex] < L[i];
}

LastLow[i] = Min(L[i], L[LastLowIndex]);
LastLowIndex = i;
}
}

TrixN = Trix(9);
TroughLow = Ref(TrixN, -3) > TrixN AND Ref(TrixN, -2) > TrixN AND Ref(TrixN, -1) > TrixN AND Ref(TrixN, 1) > TrixN AND Ref(TrixN, 2) > TrixN AND Ref(TrixN, 3) > TrixN;
TroughHigh = Ref(TrixN, -3) < TrixN AND Ref(TrixN, -2) < TrixN AND Ref(TrixN, -1) < TrixN AND Ref(TrixN, 1) < TrixN AND Ref(TrixN, 2) < TrixN AND Ref(TrixN, 3) < TrixN;
//TroughLow = Ref(TrixN, -2) > TrixN AND Ref(TrixN, -1) > TrixN AND Ref(TrixN, 1) > TrixN AND Ref(TrixN, 2) > TrixN;
//TroughHigh = Ref(TrixN, -2) < TrixN AND Ref(TrixN, -1) < TrixN AND Ref(TrixN, 1) < TrixN AND Ref(TrixN, 2) < TrixN;
ZeroValid = Cross(TrixN, 0) OR Cross(0, TrixN) OR Ref(Cross(TrixN, 0),1) OR Ref(Cross(0, TrixN),1);
ValidLow = TroughLow OR Ref(TroughLow, 1) OR Ref(TroughLow, 2) OR Ref(TroughLow, 3) OR Ref(TroughLow, 4);// OR Ref(TroughLow, 5));
ValidHigh = TroughHigh OR Ref(TroughHigh, 1) OR Ref(TroughHigh, 2) OR Ref(TroughHigh, 3) OR Ref(TroughHigh, 4);// OR Ref(TroughHigh, 5));

//Plot(LastHigh-10 ,"LastHigh", colorBlue, styleLine);
//Plot(LastLow-10 ,"LastLow ", colorRed, styleLine);
//Plot(Valid*5 + 10 ,"LastLow ", colorGreen, styleLine | styleThick);

//PlotShapes( IIf(Down AND Valid,shapeSmallUpTriangle,0) ,colorGreen, 0, L,-12);
//PlotShapes( IIf(Up AND Valid,shapeSmallDownTriangle,0) ,colorRed, 0, H,-12);
Maxi = Up AND (ValidHigh OR ZeroValid);
Mini = Down AND (ValidLow OR ZeroValid);
PlotShapes( IIf(Down AND (ValidLow OR ZeroValid),shapeSmallUpTriangle,0) ,colorBlue, 0, L,-12);
PlotShapes( IIf(Up AND (ValidHigh OR ZeroValid),shapeSmallDownTriangle,0) ,colorOrange, 0, H,-12);
//Plot(UpSignal*3+5,"UpSignal", colorBlue, styleLine| styleThick);
//Plot(DownSignal*3 ,"DownSignal", colorRed, styleLine| styleThick);

/*
LastMaxi = 0;
LastMini = 0;
ElliotLines = 0;
State = 0;
for (i=1; i < BarCount; i++)
{
State[i] = State[i-1];
if (Maxi[i])
{
State[i] = 1;//down
}

if (Mini[i])
{
State[i] = 2;
}

}

PlotShapes(IIf(State > 0, shapeSmallCircle, 0), IIf(State == 1, colorRed, colorBlue), 0, IIf(State == 1, H, L), -5);
*/
//Line = LineArray( x0, y0, x1, y1, 1 );
//Plot( Line, "Trend line", colorBlue );

/*
Wave B
Usually 50% of Wave A
Should not exceed 75% of Wave A
Wave C
either 1 x Wave A
or 1.62 x Wave A
or 2.62 x Wave A
*/
function CorrectiveRatios(StartPrice, A, B, C, RatioDelta, Delta)
{

ALength = abs(startPrice - A); BLength = abs(A-B);
CLength = abs(B-C);

Ratio1 = BLength / CLength ;
Cond1 = Ration1 >= 0.5 - RatioDelta AND ratio1 <= 0.75 + RatioDelta;
Cond2 = abs(Clength - ALength) < Delta OR abs(Clength - 1.62 * ALength) < Delta OR abs(CLength - 2.62 * ALength) < Delta;

return Cond1 AND Cond2;
}

function ImpulseRules(StartPrice, One, Two, Three, Four, Five)
{
//Wave 2 should be beneath wave 1 start:
Cond1 = Two > StartPrice AND Two < One;
//Wave 4 - the same:
Cond2 = Four > Two AND Four < Three;
//Wave 5 should be <= wave 3
Cond3 = abs(Three-Two) >= abs(Five - Four);
//Wave 1 should be smaller than wave five, making wave 3 the biggest:
Cond4 = abs(StartPrice - One) < abs(Five - Four);
return Cond1 AND Cond2 AND Cond3 AND Cond4;
}
_SECTION_END();

Dear All,

Mengingat pengalaman tgl 5/5 lalu, dimana kejadian timing bears market ketepatannya tdk bisa diduga sebelumnya, menurut saya hanya langkah antisipasi yg kita bisa lakukan, ramuan AFL sangat membantu dlm menentukan when exit, when entry back and how to manage your money (reduce stock for cash).
sebaiknya sisakan satu sheet template utk jenis AFL spt ini pd AB software anda, semoga bisa menjadi reminder current picture agar kita tidak terpancing scr emosional utk tetap berada di market pd saat rawan resiko.
kutipan dr Howard Bandy (Quantitative Trading System) katanya, AFL gak perlu terlalu canggih atau banyak tp yg penting sangat ideal/nyaman digunakan.

Saya lampirkan AFL Darvas Box Classic, MACD FastSlow by Casoni dan Price Chart + MA + supp/resist otomatis + Bollinger colaborasi dgn RSI (sedikit racikan plot signal B/S by Elliot fractal), ini semoga bisa jd satu paket anti bearish indicator and function diwaktu mendatang.
saya lampirkan pula beberapa AFL yg agak baru lainya dan file zip AFL standard (rumayan pak bisa buat iseng2 ngoprek di weekend ini).


Jadi kalau ada yg berpendapat bahwa TA dianalisa setelah suatu kejadian ternyata gak juga ya...? semoga inisyatif saya ini utk terus berbagi mendapat dukungan dari para member dan khususnya para senior, agar kita bisa sama2 trs belajar.

Silahkan dicoba, semoga bisa sedikit membantu rekan2.



'your happiness is my success'

Salam,

Isfandi 



__._,_.___



Apabila anda membutuhkan software Amibroker, Realtime Data & pelatihan silahkan visit http://www.amibroker-4-bei.org

Berikut adalah beberapa jadwal pelatihan amibroker dalam waktu dekat:

Sabtu, 24 April 2010 : Latihan pengoperasian dasar AmiBroker berikut Technical analysis di Grand Flora Hotel Kemang - Jakarta.





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

1 comment:

  1. Really it is very useful for us..... The information that you have shared is really useful for everyone. If someone wants to know about Darvas Box Scanner. I think this is the right place for you.

    ReplyDelete