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

[amibroker] Re: Plotting offset prices



PureBytes Links

Trading Reference Links

Here is a different way to do this.  I wanted to plot a line segment
which was a least squares fit to a quadratic equation over N bars.  I
wanted to be able to offset this plot to some arbitrary previous
position on the underlying price plot.  And also be able to change the
number of bars in the fit (the length of the line segment).

I created an empty array by :

for ( i = 0; i < BarCount; i++ ) 
{
	PlotArray = Null;  // The Null value doesn't plot;
}

Then I filled just part of PlotArray with data I wanted to plot: 

for ( i = 0; i < FastPers ; i++ )
{
	Indx = (BarCount - (FastPers - i)) - Offs;
	PlotArray[Indx] = ATERM + BTERM * X[i] + CTERM *X[i] * X[i] ;
}

Where:
Offs = the # of bars before today's bar
BarCount = total number of price bars present (system variable)
FastPers = the length of the quadratic line segment
Indx = pointer to the location in the array to put the data element.

Then I just plotted PlotArray with a regular Plot() statement

Maybe some variation of this can solve your problem.

ReefBreak


--- In amibroker@xxxxxxxxxxxxxxx, "picard_226" <picard@xxxx> wrote:
> 
> Thanks Thomas, but when I try this in a window, the second set of 
> prices  all show as odd long candlesticks, and the last price on MSFT 
> for example, is still lined up with the current ($SPX)closing prices, 
> as opposed to 15 bars back behind it...?
> 
> Rgds
> 
> Gary 
> 
> 
> 
> Hi Gary,
> 
> Graph0 = Close; 
> Graph1 = Ref(Foreign("MSFT","Close"),-15); 
> 
> Regards
> Thomas
> www.tradingbasis.com
> 
> 
> picard_226 wrote: 
> Hi,
> Does anyone know how ( and if) I can use the plotforeign function to 
> plot another symbol on the same chart , but offset it say 10 or 15
> bars behind the current symbol's close price ?
> I've had a search through the archives, but am unable to find any 
> reference to offsetting price plots, as the offset function only
> seems to apply to plotting symbols on a chart.
> Rgds
> Gary




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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 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/

<*> 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/