PureBytes Links
Trading Reference Links
|
Hi Mike
The link that you provided prompted a bit of lateral thinking.
The "NoScale" options are not viable as the plots are related to
price action which is the main data on the screen.
I think that to have a plot behave differently when plotting a screen
full of nulls to when one bar has a positive value is a bug and it
has been logged #1647
My solution is rather ugly but it appears to work
Graham
xaInLongTrade = Flip(Buy, Sell);
xaPlotValue = IIf(xaInLongTrade == True, xaPlotValue, Low * 0.9);
xChartBkColour = GetChartBkColor();
xRed = (xChartBkColour & 255);
xGreen = floor((xChartBkColour / 256) & 255);
xBlue = floor(xChartBkColour / (256 * 256));
xChartBkColour = ColorRGB(xRed, xGreen, xBlue);
xaPlotColour = IIf(xaInLongTrade == True, colorGreen,
xChartBkColour);
Plot(xaPlotValue, "test", xaPlotColour, styleThick);
--- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> wrote:
>
> 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 amibroker@xxxxxxxxxxxxxxx, "Graham Johnson" <grahamj@>
> 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 amibroker@xxxxxxxxxxxxxxx, "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 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/
|