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 [email protected], "carlacash26" <[EMAIL PROTECTED]> 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 [email protected], "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 [email protected], 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 > > > > > >
