Hello Osgem, I am glad the 'Padding' helped with your chart display. I attach an AFL file that will Plot the price array for the composite
index. I have added volume into the code as you requested and also the choice
to plot either gross composite values or average symbol values using a counter
slotted into the price array field "I". For the fun of it, I have
glossed-up the background color and given you the ability to vertically scale
the volume - courtesy of Amibroker's functionality and the code sharing of the
Amibroker community. You will need to run a scan of this AFL file each time you use it and
then plot the artificial symbol "~MyIndex" from the Formula Editor
window. This code should be enough for you to fly solo from hereon in. I repeat the code below in case you don't receive emails from this
Group. Watch out for word wrap if you copy and paste. Good luck, Regards, Gordon
Sutherland // ATC AFL code to create a Price Array of Index and
incorporating volume // Created
by Gordon Sutherland 27th August 2006 for Osgem - Amibroker(at)YahooGroups.com AddToComposite( L , "~MyIndex" ,
"L" ); AddToComposite( O , "~MyIndex" , "O" ); AddToComposite( H , "~MyIndex" , "H" ); AddToComposite( C , "~MyIndex" , "C" ); AddToComposite( V/1000 , "~MyIndex" , "V" ); // Divide by 1000 to
avoid overflow AddToComposite( 1 , "~Counter" ,
"I"); // Counts the number of symbols NoSym = Foreign("~Counter","I"); Buy = 0; // Make Composite Price Array an Average of Symbols: PlotOHLC(O/NoSym,H/NoSym,L/NoSym,C/NoSym,"Close",colorDefault,ParamStyle("Style",styleCandle,maskAll)); //Plot(Close,"Close",colorDefault,ParamStyle("Style",styleCandle,maskAll));//Alternative
Gross composite values // Parametize and include Volume in Price Panes using
proportional height and color coding of volume bars Color = IIf( C > Ref(C, -1), ParamColor("Up
Color", colorGreen ), ParamColor("Down Color", colorRed ) ); //
Dan Clark's line of code Plot( Volume/NoSym, "Avg VolK" ,
Color,ParamStyle( "Style for Volume in K", styleHistogram |
styleOwnScale | styleThick , maskHistogram
), Param("1/n
Height", 8, 1, 10, 0.25 ) ); // Gloss-up the background to the Chart using
Amibroker's powerful functions: SetChartBkColor(IIf(Interval()>2160000,
colorPaleTurquoise, IIf(Interval()==432001 , colorPaleGreen, colorLightGrey)));
//TinTin's Line of Code SetChartBkGradientFill( ParamColor("BgTop",
colorWhite),ParamColor("BgBottom", colorLightGrey)); //this line
added in AB Version 4.83.0 _N(Title = Name()+" \\c29" + _DEFAULT_NAME() +
" " + Interval(format=2)
+ " "+Date() + "
{{OHLCX}}" + "\\c19 Avg Symbol Volume/1000 = " +
V/NoSym ); // ****************Code End****************** -----Original Message----- Hi Gordon, Thanks for your help, the code works fine now. Also if I wish to include volume of all the scrips in the composite what addition is needed ? Please help. Thanks Osgem Please note that this group is for discussion between users only. To get support from AmiBroker please send an e-mail directly to SUPPORT {at} amibroker.com For other support material please check also: http://www.amibroker.com/support.html
SPONSORED LINKS
YAHOO! GROUPS LINKS
__,_._,___ |
GBS Example of ATC for Price Array.afl
Description: Binary data