Darvas Box
Navigate market trends with precision using the Darvas Box AFL for Amibroker. This tool, available for free download, seamlessly integrates with the Amibroker data feed to identify and visualize Darvas Boxes. Whether you’re a technical analyst or a trend follower, this AFL enhances your ability to spot consolidation and breakout patterns. Download the Darvas Box AFL to bring clarity to your trend analysis and make well-informed decisions based on the dynamic nature of market movements.
/ _SECTION_BEGIN("Darvas Box"); 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(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); Plot( box1, "" , 1 + statearray, styleThick); Plot( box2, "" , 1 + statearray , styleThick); _SECTION_END();