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

Re: [amibroker] Re: Plotting discrete values?



PureBytes Links

Trading Reference Links

Thanks Johan! Code worked a charm. :)
cheers

----- Original Message ----- 
From: "johsun" <joh.sun@xxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, July 04, 2005 11:02 PM
Subject: [trading] [amibroker] Re: Plotting discrete values?


> I'm probably misunderstanding you, but do you meen that you want to 
> connect certain points on the chart with a straight line?
> 
> Below is a code that does that. This example connects the close of 
> every 50:th bar, just change the arguments to what you require.
> Something like 
> 
> cond = TimeNum() == 090000 or TimeNum() == 190000 or TimeNum() == 
> 030000;
> 
> 
> //   ------------------------------
> 
> SetBarsRequired( 10000, 10000 );
> 
> function ConnectTheDots( expression, array )
> {
> z = x0 = x1 = y0 = y1 = Null;
> for( i = 0; i < BarCount; i++ )
> {
> if( expression[ i ] )
>  {
>  x0 = x1; y0 = y1; x1 = i; y1 = array[ i ]; 
>  s = LineArray( x0, y0, x1, y1 );
>  for( j = x0; j <= x1; j++ ) z[ j ] = s[ j ];
>  }
> }
> return z;
> }
> 
> Cond = !BarIndex() % 50;
> 
> z = ConnectTheDots( Cond, C );
> 
> Plot( z, "", colorGreen, styleThick );
> Plot( C, "", colorDefault, styleCandle );
> 
> //   -------------------------------
> 
> 
> Johan
> 
> 
> 
> 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Steve" <avalon-ardy@xxxx> wrote:
>> Thanks Graham,
>> both your solutions work, but this causes a stair stepping effect 
> i.e. the 
>> value is held & plotted until a new value is inputted. I was 
> trying to plot 
>> single point values much like a regular line chart but with 
> irregular time 
>> interval. i.e instead of plotting the close every hour, plot the 
> close only 
>> at specific time intervals
>> Thanks again for taking the time to respond.
>> cheers
>> 
>> ----- Original Message ----- 
>> From: "Graham" <kavemanperth@xxxx>
>> To: <amibroker@xxxxxxxxxxxxxxx>
>> Sent: Monday, July 04, 2005 11:03 AM
>> Subject: [trading] Re: [amibroker] Plotting discrete values?
>> 
>> 
>> > this may, or may not, work
>> > xClosed = IIf(TimeNum() >= 090000, ValueWhen (TimeNum() ==
>> > 090000,C),IIf(TimeNum() >= 190000, ValueWhen (TimeNum() ==
>> > 190000,C),IIf(TimeNum() >= 030000, ValueWhen (TimeNum() ==
>> > 030000,C),Null)));
>> >
>> > Plot(xClosed, "",colorBlue, styleLine|styleDots);
>> >
>> > else you need to be far more specific
>> > xClosed =
>> > IIf(TimeNum() >= 090000 and TimeNum() < 190000, ValueWhen 
> (TimeNum()
>> > ==090000,C),
>> > IIf(TimeNum() >= 190000 and TimeNum() < 030000, ValueWhen 
> (TimeNum()
>> > ==190000,C),
>> > ValueWhen (TimeNum() ==030000,C)
>> > ));
>> >
>> > one thing, if you do not have a bar or value at exactly the 
> timenum
>> > you may need to write it as
>> > ValueWhen ( Cross( TimeNum(), 030000 ), C )
>> >
>> > the above is typed straight nto here, so may have type errors or
>> > missing brackets, check
>> >
>> >
>> > On 7/4/05, Steve <avalon-ardy@xxxx> wrote:
>> >> Hi,
>> >> I'm using the following to plot Close values at certain times.
>> >>
>> >> xClosed = IIf(TimeNum() == 090000, ValueWhen (TimeNum() ==
>> >> 090000,C),IIf(TimeNum() == 190000, ValueWhen (TimeNum() ==
>> >> 190000,C),IIf(TimeNum() == 030000, ValueWhen (TimeNum() ==
>> >> 030000,C),Null)));
>> >> Plot(xClosed, "",colorBlue, styleLine|styleDots);
>> >>
>> >> The chart plots the dots Ok, but doesn't plot the line 
> connecting the 
>> >> dots.
>> >> I suspect it needs a constant value instead of "Null" if the 
> condition 
>> >> isn't
>> >> true.
>> >> Any suggestions on how I can "join the dots"?
>> >> cheers
> 
> 
> 
> 
> 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
> 
> 
> 
> 
> 
> 
> 
>



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/