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

[amibroker] Re: Null seems to plot as zero



PureBytes Links

Trading Reference Links

Hi Mike

I wasn't aware of IsNan so I've learned something.

A test of xaInLongTrade using IsNan didn't indicate any dodgy data.

The following 3 lines of code generated compressed data when there 
were only Null values on the screen - but as soon as there are any 
non-Null values to be plotted, the price data looks fine.  However, 
where the data is compressed (according to the status bar), the Y 
axis is not 0 but is approx 0.2, irrespective of the security.

xaInLongTrade = Flip(Buy, Sell); 
xaPlotValue = IIf(xaPlotValue <= 0, Null, xaPlotValue);
Plot(IIf(xaInLongTrade == True, xaPlotValue, Null),	"test", 
colorGreen,	styleThick);

In the second line I've even substituted <= 0 with <= <value near 
price action> and no change in result.

Surely this has to be a coding error, but I am getting absolutely 
nowhere.

Graham

--- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> wrote:
>
> Hi,
> 
> Is it possible that your calculation for xaInLongTrade is returning 
a 
> NaN value (i.e. divide by zero)?
> 
> In such cases, your IIF would evaluate to true (i.e. NaN is non 
zero) 
> and you would be getting the value of xaPlotValue instead of the 
> expected NULL.
> 
> Mike
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Graham Johnson" <grahamj@> 
> wrote:
> >
> > Hi Tomasz
> > 
> > That works fine.
> > 
> > So, I am really baffled as to why there is a problem with my code 
> > that includes Iif.
> > 
> > Maybe I need to try an alternative approach - if I can think of 
one.
> > 
> > Graham
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@> 
> > wrote:
> > >
> > > Hello,
> > > 
> > > I don't know the rest of the code you are using, but this:
> > > Plot(IIf(MA(C,10)>C, C, Null), "label", colorGreen, 
styleThick); 
> > > 
> > > works just fine and zero is not included.
> > > 
> > > Best regards,
> > > Tomasz Janeczko
> > > amibroker.com
> > > ----- Original Message ----- 
> > > From: "Graham Johnson" <grahamj@>
> > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > Sent: Friday, December 12, 2008 1:02 AM
> > > Subject: [amibroker] Null seems to plot as zero
> > > 
> > > 
> > > > I'm trying to plot a variable that should only have positive 
> > values or 
> > > > null
> > > > 
> > > > The following line results in the Y axis including zero so 
all 
> of 
> > the 
> > > > data is compressed at the top of the chart
> > > > Plot(IIf(xaInLongTrade, xaPlotValue, Null), xPlotLabel, 
> > colorGreen,
> > > > styleThick);
> > > > 
> > > > If the Iif is removed then the result is fine - the Y axis 
> range 
> > fits 
> > > > the data
> > > > Plot(xaPlotValue, xPlotLabel, colorGreen, styleThick);
> > > > 
> > > > I've even tried setting any negatives or zeros to null prior 
to 
> > Plot 
> > > > but the results are still the same
> > > > xaPlotValue = IIf(xaPlotValue <= 0, Null, xaPlotValue);
> > > > 
> > > > The battle with this has gone on for over a week now, can 
> anyone 
> > help 
> > > > please?
> > > > 
> > > > Graham
> > > > 
> > > > 
> > > > ------------------------------------
> > > > 
> > > > **** IMPORTANT ****
> > > > This group is for the discussion between users only.
> > > > This is *NOT* technical support channel.
> > > > 
> > > > *********************
> > > > TO GET TECHNICAL 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
> > > > 
> > > > 
> > > >
> > >
> >
>



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

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL 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/