First, you should not be using reserved variables (close)
for your
"ideas" because you end up having mess.
So first step is to REFORMULATE
your idea to
actually have mathematical sense.
Let suppose that N
represents the index of last bar
and you are trying to plot values for N+1,
N+2, N+3.
Mathematically
VALUE[ N ] = LastValue( Close ); //
that is last value of close - our starting point
now you want
this:
VALUE[ N + 1 ] = 1.1 * VALUE[ N ]
VALUE[ N + 2 ] = 1.05 *
VALUE[ N + 1 ];
VALUE[ N + 3 ] = 1.025 * VALUE[ N + 2 ];
The
above can be generalized to:
VALUE[ N + futurebar ] = ( 1 + 0.2 / 2 ^
futurebar ) * VALUE[ N + futurebar - 1 ];
So next value is previous
value multiplied by ( 1 + 0.2 / 2 ^ futurebar ) factor.
Now (the key
moment) - you need to DROP thinking that given
array element is hardwired
to time. It is not. Array elements
can be used regardless of time.
This
allows us to use LAST N bars of actual existing arrays
as a placeholder for
"future".
The code below implements entire idea:
Extend =
Param("How many bars to extend", 1, 1, 50, 1 );
Value = LastValue(
Close );
Result = Null;
i = 0;
while( i <= Extend )
{
Result[ BarCount - Extend - 1 + i ] = Value;
i++;
Value = ( 1 +
0.2 / ( 2 ^ i ) ) * Value;
}
Plot( Close, "Close", colorBlack,
styleCandle );
Plot( Result, "Projected prices", colorBlue, styleLine,
Null, Null, Extend );
Best regard,
Tomasz
Janeczko
amibroker.com
----- Original Message -----
From: "Robert"
<disqplay0@xxxxxxcom>
To:
<amibroker@xxxxxxxxxps.com>
Sent:
Tuesday, January 06, 2009 1:23 PM
Subject: [amibroker] Re: Graphing beyond
the data
> ok I have been looking at all the replies to the
questions I asked
> but it is still not quite what I was looking to do
with the program
>
> so let's try this
>
> I would
like to calculate the say the closing cost for the next 5
> days beyond
the last day of data. I order to do this I want to use a
> formula that
would change the end result each successive day based on
> the
calculation performed on the previous day. So it would look
> something
like this:
>
> close = EOD
> close1 = close * .1 +
close
> close2 = close1 * .05 + close1
> close3 = close2 * .025 +
close2
>
> etc.
>
> now is this possible where the
look ahead start with the data
> obtained and then using some
mathimatical calculations forcing the
> data to look into the future?
Shift will give me the results for one
> day if I xshift 5 days it
still only returns the same value as if
> looking just one day.
>
> Disq
>
>
>
>
>
>
------------------------------------
>
> ****
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
>
>
>