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

RE: [amibroker] Re: Any Help with Detail I Cannot See



PureBytes Links

Trading Reference Links

Many thanks for reminding me about Nz...that solved the blanks but did not
help with the Minimum values of MnGain.

I should have shared my use of ValueWhen in determining month end values.
(I realize I can consolidate these statements into one)
Mnth				=	Month();
Nmnth				=	Mnth != Ref(Mnth,-1);
Nmnth1			=	Ref(Nmnth,1);

The statement for Nmnth will catch the FIRST day of the next month, but I am
trying to calculate monthly gains from the last day of the month relative
the last day of the previous month.  Using Ref(Nmnth,1) with a positive and
not negative period will highlight end of month to end of month.
I then use the ValueWhen function to get the Price on the last day of this
month vs the last day of last month.
	Price0         =  ValueWhen(Nmnth1,Price,1);// End of month price at
the end of the month
	Price1         =  ValueWhen(Nmnth1,Price,2);// End of last month
price at the end of last month
I suspect my problem lies in this (even though the calculations for MnGain
seem to be correct (tested manually in Excel).
For some reason, something is messing up the LLV or even the function
"Lowest".
Writing 
	MnGainH        =  Highest(MnGain);
	MnGainL        =  Lowest(MnGain);
results in correct values for MnGainH, but incorrect values for MnGainL.

Still needing some ideas. . . .
Thanks,
Ken

-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of sidhartha70
Sent: Monday, June 30, 2008 1:41 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Any Help with Detail I Cannot See

First thing that comes to mind is, make sure MnGain has no Null values in
the array... this will, in my experience, cause the LLV & HHV functions to
stop working... use Nz() to remove all Nulls...


--- In amibroker@xxxxxxxxxxxxxxx, "Ken Close" <ken45140@xxx> wrote:
>
> I have the most basic statement using LLV but I get blank values in
the AA
> window.
>  
> I am checking for the max gain over a period and the minimum (or 
> lowest) gain over the same period.
>  
> I have:
> AllDates       =  DateNum();
> 
> Price0         =  ValueWhen(Nmnth1,Price,1);
> 
> Price1         =  ValueWhen(Nmnth1,Price,2);
> 
> MnGain         =  100 * (Price0 - Price1)/Price1;
> 
> Per1           =  BarsSince(AllDates == StartDate);
> 
> MnGainH        =  HHV(MnGain,Per1);
> 
> MnGainL        =  LLV(MnGain,Per1);
> 
> AddColumn(MnGain,"MnGain",1.2);
> 
> AddColumn(MnGainH,"Highest MnGain",1.2,colorDefault,  Col,  120);
> 
> AddColumn(MnGainL,"Lowest MnGain",1.2,colorDefault,   Col,  120);
> 
>  
> 
> When I run this, I get proper results in the McGainH column and
blanks in
> the McGainL column.
> 
>  
> 
> What detail am I missing in this?
> 
>  
> 
> I have tried this line substituted,
> 
> MnGainL  =  IIf(MnGain<0,LLV(MnGain,Per1),LLV(MnGain,25));
> 
>  
> 
> And I get values where MnGain is > 0 and where the Period is a fixed 
> 25 instead of the Per1, and blank values where MnGain is < 0.
> 
>  
> 
> It seems that LLV does not like the Per1 value for the period but
the HHV
> function works OK with Per1 as the Period.  Why?
> 
>  
> 
> Must be basic but can someone educate me on this simple problem?
> 
>  
> 
> Thanks,
> 
> Ken
>



------------------------------------

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




------------------------------------

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/