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

[amibroker] Re: Graphing beyond the data



PureBytes Links

Trading Reference Links

Bill,

Thanks - I finally figured out how to extend a line into the future 
without changing the existing line values.  I provided examples below 
of the problem I was having along with the one that plots correctly.
Your formula shifts the line for existing data to a totally different 
position. Your feedback motivated me to take one more shot at 
figuring it out.  One question I do have about the following code is 
this - when I remove "numbars" from the code the lines no longer 
plot. I don't understand why the numbars statement is necessary.  Any 
ideas as to why this is?

Regards,

David

	numbars = LastValue(Cum(Status("barvisible")));
	pct = Param("Pivot %", 0.50, 0.10, 20, 0.001);
	lookbak = Param("Look back", 10, 1, BarCount-1);
	shift= Param("Line Shift",20,0,50,1);;
	pk=PeakBars(H,pct)==0; tr=TroughBars(L,pct)==0;
	zHi=Zig(H,pct); zLo=Zig(L,pct); HLAvg=(zHi+zLo)/2;
	zp=IIf(pk,zHi,IIf(tr,zLo,IIf(HLAvg>Ref(HLAvg,-1),H,L)));
	za=Zig(zp,pct);
	pR=Ref(za,-1)<za AND za>Ref(za,1);
	pS=Ref(za,-1)>za AND za<Ref(za,1);
////////////////////
Price = ParamList("Price Array", "Close|High|Low|zHiLo", 1);
if(Price=="Close") P = Zig(C, Pct);
else if(Price=="High") P = Zig(H, Pct);
else if(Price=="Low") P = Zig(L, Pct);
else P = Zig(zp, Pct);
//////////////////////////////////////////////////////////////////
Plot(C, "", IIf(O>C, 27,IIf(O<C, 32,36)), ParamStyle("Price 
Style",styleBar,maskPrice));
Plot(P, "Zig", colorGold, styleThick|styleNoLabel);
//////////////////////////////////////////////////////////////////
pk = PeakBars(P, pct) == 0;
tr = TroughBars(P, pct) == 0;
x=BarIndex();
shift=20;
	xs0=LastValue(ValueWhen(tr,x,lookbak+1));
	ys0=LastValue(ValueWhen(tr, L,lookbak+1));
	xs1= LastValue(ValueWhen(tr,x,lookbak));
	ys1= LastValue(ValueWhen(tr,L,lookbak));

x1=LineArray(xs0,ys0,xs1,ys1,1);// Line extended to last bar
Plot(x1,"",6,1);
Plot(x1,"",3,1,Null,Null,shift);//shift changes xs0,ys0,xs1 and ys1
x2=LineArray(xs0-shift,ys0,xs1,ys1,1);//shift changes existing values
Plot(x2,"",5,1,Null,Null,shift);
x3=LineArray(xs0-shift,ys0,xs1-shift,ys1,1);//correct extension
Plot(x3,"",32,4,Null,Null,shift);
--- In amibroker@xxxxxxxxxxxxxxx, "wavemechanic" <timesarrow@xxx> 
wrote:
>
> Does this do what you want?
> 
> x = linearray(x, y, z, w, 1);
> plot(x, "", color, null, null, 10);
> 
> Bill
>   ----- Original Message ----- 
>   From: wooziwog 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Tuesday, January 06, 2009 12:10 PM
>   Subject: [amibroker] Re: Graphing beyond the data
> 
> 
>   Hello,
> 
>   It seems you are well versed with future arrays.  Could you 
provide 
>   an example of how to code a line array to simply plot into the 
future 
>   without changing x0,y0,x1, and y1 of the array for current bars?  
I 
>   have tried using the slope of the line, negative offsets for the 
>   current line that equal the shift into the future etc. but none 
of it 
>   works for me.  The problem I am having is a simple one - I do not 
>   want any of the historical graph changed (no shifting of graphed 
data 
>   that already exists).  My objective is to simply "continue" the 
line 
>   array into the future at the same slope as currently exists for 
>   existing data.
> 
>   Thanks,
> 
>   David K.
> 
>   --- In amibroker@xxxxxxxxxxxxxxx, "Ton Sieverding" 
>   <ton.sieverding@> wrote:
>   >
>   > But that's not what I am doing, Anthony. I am calculating 
something 
>   in an 'actual' array as if it is in the future. Then because I 
want 
>   to see it in the future I am shifting the array. Let's take a 
simple 
>   example. I want to simulate the SP500 in the future. Therefore I 
>   mirror the SP500 let's say over the last 20 days in a new array. 
Now 
>   I want to see the SP500 in the future. So therefore I am shifting 
the 
>   mirrored time series and get something like underneath graph :
>   > 
>   > 
>   > 
>   > The Ichimoku example Tomasz gave is exactly the same story. He 
>   calculated a future value in an 'actual' array and then shifted 
the 
>   array in the future because there you want to see the result. The 
>   fact he is doing a calculation in an 'actual' array does not mean 
>   that he is not doing future calculations ...
>   > 
>   > Regards, Ton.
>   > 
>   > PS : Please no remarks about the enclosed code. It's just an 
>   example I was using for a group that's working with AmiBroker 
here in 
>   Belgium. It does what it should do but ...
>   > 
>   >   ----- Original Message ----- 
>   >   From: Anthony Faragasso 
>   >   To: amibroker@xxxxxxxxxxxxxxx 
>   >   Sent: Tuesday, January 06, 2009 12:38 PM
>   >   Subject: Re: [amibroker] Graphing beyond the data
>   > 
>   > 
>   > 
>   >   Ton,
>   > 
>   >   I commented on Tomasz's example....I do not see where the 
example 
>   is calculating a future value, Do you ?
>   > 
>   >   If so, Please point it out to me.....
>   > 
>   >   Thanks
>   >   Anthony
>   > 
>   >   PS.  If you are calculating all sorts of future 
values....maybe 
>   you would be so kind as to post an example.
>   > 
>   >   ----- Original Message ----- 
>   >     From: Ton Sieverding 
>   >     To: amibroker@xxxxxxxxxxxxxxx 
>   >     Sent: Tuesday, January 06, 2009 4:06 AM
>   >     Subject: Re: [amibroker] Graphing beyond the data
>   > 
>   > 
>   > 
>   >     Frankly I do not see the difference Anthony. I am 
calculating 
>   all kinds of values in an array that are based upon the future. 
After 
>   having done so, I am shifting the array in the future for visual 
>   purpose. But that's just to show me the values in the graph on 
the 
>   right place. When making future calculations in the array for me 
>   there is no difference between shifting and extending. So I just 
do 
>   not get your problem ...
>   > 
>   >     Regards, Ton.
>   > 
>   >       ----- Original Message ----- 
>   >       From: Anthony Faragasso 
>   >       To: amibroker@xxxxxxxxxxxxxxx 
>   >       Sent: Monday, January 05, 2009 10:40 PM
>   >       Subject: Re: [amibroker] Graphing beyond the data
>   > 
>   > 
>   > 
>   >       Bill,
>   > 
>   >       I agree with you....even from the example that Tomasz 
>   provided...I see it as just shifting the current plot to the 
right....
>   >       not actually calculating some future values and then 
plotting 
>   them to the right of the last value....
>   > 
>   >       In the example...if you remove the 25 from the plot 
statement
>   > 
>   >       Plot( me52,"S1", IIf( Avg26_9 > 
>   me52,colorOrange,colorBlueGrey),styleCloud,Null,Null,25); 
>   > 
>   >       It will move / shift the plot back to the left...
>   > 
>   >       Anthony
>   > 
>   > 
>   >         ----- Original Message ----- 
>   >         From: wavemechanic 
>   >         To: amibroker@xxxxxxxxxxxxxxx 
>   >         Sent: Monday, January 05, 2009 4:23 PM
>   >         Subject: Re: [amibroker] Graphing beyond the data
>   > 
>   > 
>   > 
>   >         TJ,
>   > 
>   >         I don't think we are talking about the same thing 
perhaps 
>   because of our understanding of the words "shift" and "extend".  
To 
>   me "shift" means to move to the right into the blank space 
>   and "extend" means to calculate new values in the blank space.  
>   > 
>   >         The problem as I see it is shown in the screen shot 
below 
>   (bars are included for counting purposes).  Two charts of a sine 
>   curve in which one is shifted with Plot() by 10 bars into the 
blank 
>   space.  By the definitions above, if the curve is simply shifted 
the 
>   last value will remain unchanged (as shown) whereas an extended 
curve 
>   would have a last value around 1 rather than -1.  
>   > 
>   >         Based on the definitions above, I view these charts as 
>   evidence that Plot() shifts the curve and does not calculate what 
the 
>   value should be 10 bars into the future.  As far as I can tell, 
>   the "extend" parameter in LineArray() actually does extend into 
the 
>   future as do the charting tools.  
>   > 
>   >         Definitions aside, am I using Plot() correctly or is 
there 
>   a way to use Plot() in order to get what I call "extend" 
>   functionality.  The type of functionality is what is needed for a 
>   variety of studies of the type shown in the TradeStation screen 
shots.
>   > 
>   >         Bill
>   > 
>   > 
>   >           ----- Original Message ----- 
>   >           From: Tomasz Janeczko 
>   >           To: amibroker@xxxxxxxxxxxxxxx 
>   >           Sent: Monday, January 05, 2009 2:38 PM
>   >           Subject: Re: [amibroker] Graphing beyond the data
>   > 
>   > 
>   >           No I did not miss the point. 
>   > 
>   >           The supported way to EXTEND indicators is to 
calculate 
>   them as usual and
>   >           plot using XShift.  In this approach you are using 
LAST X 
>   bars of array
>   >           as "future" bars. Then to actually display these 
future 
>   bars at correct place
>   >           you use XShift.
>   > 
>   >           Best regards,
>   >           Tomasz Janeczko
>   >           amibroker.com
>   >             ----- Original Message ----- 
>   >             From: wavemechanic 
>   >             To: AmiBroker, User 
>   >             Sent: Monday, January 05, 2009 7:40 PM
>   >             Subject: Re: [amibroker] Graphing beyond the data
>   > 
>   > 
>   >             TJ, 
>   > 
>   >             I think you missed the point.  The problem is one 
of 
>   extension not shifting which Plot() cannot handle.  Extending 
>   indicators, as Robert and many of us want to do, is necessary to 
>   identify future values for a variety of studies, including Hurst 
>   channel projections, cycles, etc.  Here are TradeStation examples 
>   showing the extension of the analysis (not a shift) into the 
future.
>   > 
>   >             Bill
>   > 
>   > 
>   > 
>   > 
>   > 
>   > 
>   > 
>   > 
>   > 
>   > 
>   > 
>   >             ----- Original Message ----- 
>   >               From: Tomasz Janeczko 
>   >               To: amibroker@xxxxxxxxxxxxxxx 
>   >               Sent: Monday, January 05, 2009 10:10 AM
>   >               Subject: Re: [amibroker] Graphing beyond the data
>   > 
>   > 
>   >               Hello,
>   > 
>   >               You can do that using XShift parameter of Plot() 
>   function
>   >               http://www.amibroker.com/f?plot
>   > 
>   >               For coding example, see DispMA (displaced moving 
>   average)
>   >               that is shipped with AmiBroker
>   > 
>   >               Best regards,
>   >               Tomasz Janeczko
>   >               amibroker.com
>   >               ----- Original Message ----- 
>   >               From: "Robert" <disqplay0@>
>   >               To: <amibroker@xxxxxxxxxxxxxxx>
>   >               Sent: Monday, January 05, 2009 3:25 PM
>   >               Subject: [amibroker] Graphing beyond the data
>   > 
>   > 
>   >               >I have been working on an indicator that would 
look 
>   into the futur if 
>   >               > the trend continues or if it reverses. It will 
>   graph to the last day 
>   >               > of data but I am presently looking at a five 
day 
>   look ahead. Is there 
>   >               > a way to graph the pridicted price beyond the 
last 
>   data point? If so 
>   >               > a shove in the right direction would help. Not 
>   really sure how to do 
>   >               > this but would like to learn, thanks in advance 
for 
>   any support you 
>   >               > can give to this question.
>   >               > 
>   >               > 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
>   >               > 
>   >               > 
>   >               > 
>   > 
>   >               ------------------------------------
>   > 
>   >               **** 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
>   > 
>   > 
>   > 
>   > 
>   > 
>   > ----------------------------------------------------------------
--
>   > 
>   > 
>   > 
>   >               No virus found in this incoming message.
>   >               Checked by AVG - http://www.avg.com 
>   >               Version: 8.0.176 / Virus Database: 270.10.2/1876 -
 
>   Release Date: 1/5/2009 9:44 AM
>   > 
>   > 
>   > 
>   > ----------------------------------------------------------------
----
>   --
>   > 
>   > 
>   > 
>   >           No virus found in this incoming message.
>   >           Checked by AVG - http://www.avg.com 
>   >           Version: 8.0.176 / Virus Database: 270.10.2/1876 - 
>   Release Date: 1/5/2009 9:44 AM
>   > 
>   > 
>   > 
>   > 
>   > ----------------------------------------------------------------
----
>   ----
>   > 
>   > 
>   > 
>   >         No virus found in this incoming message.
>   >         Checked by AVG - http://www.avg.com 
>   >         Version: 8.0.176 / Virus Database: 270.10.2/1876 - 
Release 
>   Date: 1/5/2009 9:44 AM
>   > 
>   > 
>   > 
>   > 
>   > 
>   > ----------------------------------------------------------------
----
>   --------
>   > 
>   > 
>   > 
>   >     No virus found in this incoming message.
>   >     Checked by AVG - http://www.avg.com 
>   >     Version: 8.0.176 / Virus Database: 270.10.3/1877 - Release 
>   Date: 1/5/2009 7:20 PM
>   >
> 
> 
> 
>   ------------------------------------
> 
>   **** 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
> 
> 
> 
> 
> 
> --------------------------------------------------------------------
----------
> 
> 
> 
>   No virus found in this incoming message.
>   Checked by AVG - http://www.avg.com 
>   Version: 8.0.176 / Virus Database: 270.10.3/1878 - Release Date: 
1/6/2009 7:56 AM
>



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

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