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

[amibroker] Re: help with code please



PureBytes Links

Trading Reference Links

goldwing01,
Here is the analytic NVI() expression.
You have to multiply each NVI() value by (100+r[i])/100, when V 
declines or leave it as is when V rises. This definition needs a 
small loop.

//The analytic NVI() formula
Plot(NVI(),"NVI",colorBlack,1);
r=ROC(C,1);
for(i=1;i<BarCount;i++)
{
myNVI[0]=100;
if(V[i]<V[i-1])
{myNVI[i]=(myNVI[i-1])*(100+r[i])/100;}
else
{myNVI[i]=myNVI[i-1];}
}
Plot(myNVI,"myNVI",colorRed,8);

Dimitris Tsokakis
--- In amibroker@xxxxxxxxxxxxxxx, "goldwing01" <GOLDWING01@xxxx> 
wrote:
> I have been trying for two days to make this work, just 
> have not made it work,so now asking for help.
> 
> (V < (ref(V,-1)) then
> NVI = I + (((C - ref(C,-1) / ref(C,-1)))
> If (V >= ref(V,-1)) then
> NVI = I
> 
> Where:
> 
> C = Today's closing price
> ref(C,-1) = Yesterday's closing price
> I = Yesterday's Negative Volume Index
> NVI = Today's Negative Volume Index
> V = Today's volume
> ref(V,-1) = Yesterday's volume
> 
> ________________________________________________________
> this is what I have done up to now.
> 
> I= Cum(IIf(V<Ref(V,-1),ROC(C,1),0));
> MA1 = NVI()<= I + (C -Ref(C,-1) / Ref(C,-1));
> MA2=NVI() <= I;
> 
> col = IIf( V < Ref( V, -1), colorGreen, colorRed );
> Col2= IIf(V > Ref(V,-1),colorGreen, colorRed );
> 
> Plot(V, "Price",Col, MA1, styleBar );
> Plot( V, "Price",Col2, MA2, styleBar );


Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

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:
 amibroker-unsubscribe@xxxxxxxxxxxxxxx

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