Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Pink Darvas for Amibroker (AFL)
I’m new to trading (like squeaky-shoes new) so I’m reading as much as I can to get an idea of what it’s all about before blowing investing my hard-earned cash.
I read a book by Nicholas Darvas yesterday and I wondered if there was a script to indicated where the boxes are formed, and sure enough there was. The only problem was that it was giving me a headache because it has an animated background.
I’m not a coder – not even pretending to be – but I found the animated bit at the end of the script and modified it to be a bit more soothing on the eye. It’s pink now, but there are options to add your own color scheme in if you prefer – just replace the (pink) with (turq) or (green) or (red) etc.
Similar Indicators / Formulas
Indicator / Formula
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | _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]<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( 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; // here are the color options anim= ColorHSB ( ( i + z ) % 255, 256, Param ( "Brightness" , 1, 1, 1, 1 )); black= colorBlack ; grey= colorPaleBlue ; pink= colorPink ; green= colorGreen ; red= colorRed ; yellow= colorYellow ; turq= colorPaleTurquoise ; grey40= colorGrey40 ; // and this is the bit you change to set your own preference SetChartBkColor (pink); RequestTimedRefresh (1); _SECTION_END (); |
5 comments
Leave Comment
Please login here to leave a comment.
Back
Good one.
Thanks
Viswanath
Thanks
Good one
Just changing the color to the AFL library code does not really add much.
How to interprete this Pink Darvas box ?
Scanner is very good but please check value of Z Ln 112 Col 24 (I do not have coding knowledge), error is value of Z is not initiated. awinashkale@rediffmail.com