Graham, Are you saying that the "compressed" data is from other Plots? That being the case, then yes, the "all Null" scenario will plot as zero thereby compressing the other Plot statements as they all compete for the same Y axis scale.
To confirm this, comment out the other Plot statements and examine your chart. You will see that when only nulls are visible, the scale drops to zero. I can think of two easy approaches that you can take to resolve your problem: 1. Employ the styleOwnScale flag for the xaPlotValue Plot; Plot(IIf(xaInLongTrade, xaPlotValue, Null), "test", colorGreen, styleThick | styleOwnScale); Else, use the left vertical axis for the xaPlotValue; Plot(IIf(xaInLongTrade, xaPlotValue, Null), "test", colorGreen, styleThick | styleLeftAxisScale); These options and more can be found here: http://amibroker.com/guide/h_indbuilder2.html Mike --- In [email protected], "Graham Johnson" <grah...@...> wrote: > > 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 [email protected], "Mike" <sfclimbers@> 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 [email protected], "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 [email protected], "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: <[email protected]> > > > > 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 > > > > > > > > > > > > > > > > > > > > > > > > >
