Code Amibroker Indicators

Biểu đồ Hộp Darvas cho Amibroker (AFL)

by admin 2 min read 0 comments

Key Takeaways

  • Market conditions and their impact on trading decisions
  • Key levels and price action analysis
  • Risk management strategies for this setup

Hộp davas biểu đồ cho amibroker

\"\"

_SECTION_BEGIN(\”Darvas Box\”);
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat(\”{{NAME}} – {{INTERVAL}} {{DATE}} Open= %g High= %g Low= %g Close= %g (%.1f%%) Volume= \” + WriteVal( V/1, 1.0 ) +
\”\\n\”+\”{{VALUES}}\”, O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, \”Close\”, ParamColor(\”Color\”, colorPaleTurquoise ), styleNoTitle | ParamStyle(\”Style\”) | GetPriceStyle() );
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]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( box1, \” RESI \” , colorLime, styleLine );
//Plot( box2, \” SUPP\” , colorOrange, styleLine );
Plot( box1,\”\\n\”+ \”RESI \” , colorLime, styleDots );
Plot( box2, \” SUPP\” , colorOrange, styleDots );
GfxSetOverlayMode(1);
GfxSelectFont(\”Aparajita\”, Status(\”pxheight\”)/10 );
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( ColorHSB( 75, 75, 75 ) );
GfxSetBkMode(0); // transparent
GfxTextOut( Name(), Status(\”pxwidth\”)/2, Status(\”pxheight\”)/30 );
GfxSelectFont(\”Aparajita\”, Status(\”pxheight\”)/20 );
GfxTextOut( IndustryID(1), Status(\”pxwidth\”)/2, Status(\”pxheight\”)/7.5 );
GfxSelectFont(\”Aparajita\”, Status(\”pxheight\”)/25 );
GfxTextOut( FullName(), Status(\”pxwidth\”)/2, Status(\”pxheight\”)/1.09 );
for( i = 1; i < BarCount; i++ )
z = (GetPerformanceCounter()/100)%256;
anim=ColorHSB( ( i + z ) % 256, 255, Param(\”Brightness\”, 75, 0, 255, 1 ));
SetChartBkColor(anim);
RequestTimedRefresh(1);
_SECTION_END();

Trading Data Snapshot

Always verify current market conditions before executing any trade. Past performance does not guarantee future results.

A
admin
Trading analyst and market commentator with expertise in technical analysis, price action, and risk management. Dedicated to helping traders make informed decisions.

Leave a Reply

Your email address will not be published. Required fields are marked *