Hello Osgem, I am using the latest AB Version 4.85.0 beta.
The submitted AFL code runs fine on my machine and so I suspect you are using an earlier version of AB before the recently introduced SetChartBkGradientFill(). Suggest you upgrade and then it should run OK especially if you use the attachment AFL file rather than risk word wrap syntax errors using copy and paste from the body of the email. Regards, Gordon Sutherland -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of osgem_2006 Sent: Tuesday, 29 August 2006 2:12 a.m. To: [email protected] Subject: [amibroker] Re: AddToComposite Hello Gordon, Thanks for helping me with the code.I tried to run your code by scanning a group of stocks but it gives me following error, SetChartBkColor(IIf(Interval()>2160000, colorPaleTurquoise, IIf (Interval()==432001 , colorPaleGreen, colorLightGrey))); //TinTin's Line of Code SetChartBkGradientFill( ----------------------^ Error 30. Syntax error Please help me with the code. Regards Osgem --- In [email protected], "Gordon Sutherland" <[EMAIL PROTECTED]> wrote: > > 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 10th October 2005 > 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----- > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of osgem_2006 > Sent: Saturday, 26 August 2006 6:09 p.m. > To: [email protected] > Subject: [amibroker] Re: AddToComposite > > 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 Yahoo! Groups Links 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 Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/amibroker/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
