[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: help with weighted index



PureBytes Links

Trading Reference Links

Here is a revised code, I'm trying to calculate Open, High, Low and
Close to be able to plot candles/bars for a weighted index. Hope
someone could help...

////START OF CODE

weight = 
IIf( Name() == "AA", 5,
IIf( Name() == "C", 4,
IIf( Name() == "CAT", 6,
IIf( Name() == "GE", 7,
0 ) ) ) );


AddToComposite( weight * O, "~test", "nO" );
AddToComposite( weight * H, "~test", "nH" );
AddToComposite( weight * L, "~test", "nL" );
AddToComposite( weight * C, "~test", "nC" );

Buy = 0;


nO = Foreign( "~test", "O" );///
nH = Foreign( "~test", "H" );///
nL = Foreign( "~test", "L" );///
nC = Foreign( "~test", "C" );///

// plot chart
PlotOHLC(nO, nH, nL, nC, "~test" , colorBlack, styleLine);



////END OF CODE


If i change the StyleLine to StyleBar, this code doesn't work. I was
hoping i had the O,H,L,C calculated like thi...

:(

--- In amibroker@xxxxxxxxxxxxxxx, "carlacash26" <carlacash26@xxx> wrote:
>
> If i put the code in a new pane it will plot a linechart. Is there any
> way to get th hich, low and Open values and plot candles or barcharts?
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "carlacash26" <carlacash26@> wrote:
> >
> > Waleed, I'm trying to do the same thing with weighted index.
> > 
> > Try this code, and maybe you can find what is the error, this code
> > produces some graph.(Change to you own stocks)
> > 
> > 
> > weight = 
> > IIf( Name() == "AA", 5,
> > IIf( Name() == "C", 4,
> > IIf( Name() == "CAT", 6,
> > IIf( Name() == "GE", 7,
> > 0 ) ) ) );
> > 
> > AddToComposite( weight * C, "~test", "X" );
> > 
> > Buy = 0;
> > Graph0 = Foreign( "~test", "C" )/Foreign( "~test", "I" );
> > 
> > 
> > It just plots dots, not linechart or anything. I would like to have a
> > index with OHLC but I don't know how... If anybody knows how to do
> > this, please help!
> > 
> > 
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, Waleed Khalil <waleedkhalil@> wrote:
> > >
> > > Hi all
> > > can any one please tell me what is wrong withe wight part in
this code
> > > 
> > > weight = IIf( Name() == "elsh", 5,
> > > IIf( Name() == "unit", 4,
> > > IIf( Name() == "elka", 6,
> > > IIf( Name() == "ocdi", 7,
> > > IIf( Name() == "arei", 3,
> > > IIf( Name() == "mnhd", 3,
> > > IIf( Name() == "heli", 2,
> > > 0 ) ) ) ))));
> > > 
> > > AddToComposite( Close, "~housing", "X" );
> > > AddToComposite( V , "~housing", "V" );
> > > AddToComposite( 1, "~housing", "I" );
> > > 
> > > Buy = 0;
> > > Graph0 = Foreign( "~housing", "C" )/Foreign( "~housing", "I" );
> > > 
> > > this code produces zero , but when i remove the weight part
> everything 
> > > is ok and i get my curve
> > > thanks in advance
> > > Waleed
> > >
> >
>




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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/