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);
Buyrule=H>Ref(box1,-1) AND H>Ref(box2,-1) AND Ref(statearray,-1)==5;
Sellrule=L<Ref(box1,-1) AND L<Ref(box2,-1) AND Ref(statearray,-1)==5;
_SECTION_BEGIN("Darvas box");
Plot(C,"",1,64);
Plot( box2, "" , 1 + statearray , styleLine );
Plot( box1, " Status = "+WriteVal(statearray,1.0) , 1 + statearray, styleLine );
PlotOHLC( Null,box2, box1,Null, "", colorYellow, styleCloud);
Plot(box2, "Top", ParamColor("Box Top Color", colorRed), ParamStyle("Box
Top Style"));
Plot(box1, "Bot", ParamColor("Box Bottom Color",colorBlue), ParamStyle("Box
Bottom Style"));
_SECTION_END();
Buy = Buyrule;
statopt = Optimize("statopt var", 3, 1, 5, 1 );
lossopt= Optimize("lossopt var", 5, 3, 10, 1 );
//statopt=5;
//lossopt=7;
topvalue=IIf(box1>box2,box1,box2);
Sellrule2 = (((topvalue-Close)*100/topvalue) > lossopt) AND (statearray == statopt);
Sell = Sellrule OR Sellrule2;
Short = Sell;
Cover = Buy;
setelah saya lihat di arsip milist ternyata sdh ada yang posting darvas afl dan ini saya modifikasi tambahin warna
semoga berguna tinggal dioprek biar angkanya mirip sama yang terkenal di singapore , kalau sdh berhasil upload yah biar kita semua kebagian .
supaya angka break out/break peaknya sama demikian juga break trough nya
semoga berguna
2010/5/20 tjhai lioe <tjhailioe@gmail.com>
itu dia darvas nya saya belum bisa , nunggu dari pak EKO dan teman lainnya
saya tadi cuma tambahin
PlotOHLC( Null,topbox, Botbox,Null, "", colorAqua, styleCloud);
tapi hasilnya belum bagus
kalau diterapkan di chart lain warnanya nutupin candle
tolong dong teman yang ahli .
oh iya yang di library boleh ga afl nya di muat disini soalnya afl darvas ada di library2010/5/20 rudyho <rdy_ho@yahoo.com>Pak Tjhai... Kalo boleh Afl darvasnya di share dong...
Makasih ya
Powered by BlackBerry®
------------------------------------
Yahoo! Groups Links
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.
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker-4-bei/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker-4-bei/join
(Yahoo! ID required)
<*> To change settings via email:
amibroker-4-bei-digest@yahoogroups.com
amibroker-4-bei-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
amibroker-4-bei-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
__._,_.___
No comments:
Post a Comment