Hi - I was looking at that old Seasonality chart today and decided to make a
couple of improvements. New code is below. Changes ( shown in attached pic )
are
1. new title format
2. can set to foreign ticker now
2. scroll current year backward, then match dates to see "projected"
market
direction from other years
3. setting begin/end values shows color-coded performance for that period in
the title
No more changes coming so it is safe to "upgrade" if you want. 8 - )
***************************************
// Seasonality
SetBarsRequired( sbrAll, sbrAll );
SetChartOptions( 0, chartShowDates );
Ticker = ParamStr( "Ticker", "CURRENT" );
ShiftBars = Param( "Shift Bars", 0, -5200, 5200, 1 );
UpColor = ParamColor( "Up Color", colorSkyblue );
DownColor = ParamColor( "Down Color", colorBlue );
UnchColor = ParamColor( "Unch Color", colorWhite );
Style = ParamStyle( "Style", styleLine, maskAll );
NewLine = ParamToggle( "New Title Line", "No|Yes", 1 );
GraphZOrder = ParamToggle( "GraphZOrder", "0|1", 1 );
GraphXSpace = Param( "GraphXSpace", 0, 0, 100, 1);
if ( Ticker == "CURRENT" )
{
TickerPrice = Close;
TickerName = Name();
}
else
{
TickerPrice = Foreign( Ticker, "close" );
TickerName = Ticker;
}
if ( NewLine )
NewTitleLine = "\n";
else
NewTitleLine = "";
ShiftedClose = Ref( TickerPrice, -ShiftBars );
YestShiftedClose = Ref( ShiftedClose, -1 );
Color = IIf( ShiftedClose > YestShiftedClose, UpColor, IIf( ShiftedClose
<
YestShiftedClose, DownColor, UnchColor ) );
if ( ShiftBars < 0 AND SelectedValue( BarIndex() ) >= BarCount +
ShiftBars )
ChartDate = "FUTURE";
else
ChartDate = NumToStr( Ref( Year(), -ShiftBars ), 1.0 ) + "-"
+ NumToStr( Ref( Month(), -ShiftBars ), 1.0 ) + "-"
+ NumToStr( Ref( Day(), -ShiftBars ), 1.0 );
TickerPctChg = ( EndValue( ShiftedClose ) - BeginValue( ShiftedClose ) ) /
BeginValue( ShiftedClose ) * 100;
if ( BeginValue( BarIndex() ) == 0 )
{
TickerPctChgStr = "N/A";
TickerPctChgColor = colorBlack;
}
else
{
TickerPctChgStr = NumToStr( TickerPctChg, 0.1 );
TickerPctChgColor = IIf( TickerPctChg > 0, colorBrightGreen, IIf(
TickerPctChg < 0, colorRed, colorWhite ) );
}
Title = VarGetText("Title") + NewTitleLine + EncodeColor(
SelectedValue(
Color ) ) + TickerName + " Seasonality"
+ EncodeColor( colorBlack ) + " " + ChartDate + " ( " +
ShiftBars + " )"
+ EncodeColor( TickerPctChgColor ) + " ( " + TickerPctChgStr + "
) = " +
EncodeColor( SelectedValue( Color ) ) + ShiftedClose;
Plot( ShiftedClose, "Shifted Close", Color, Style );
----- Original Message -----
From: "Steve Dugas" <sjdugas@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, January 24, 2009 1:31 PM
Subject: Re: [amibroker] Re: Creating a Year over Year comparison screen
> Thank you for posting - I was getting my beauty sleep... 8 - )
>
>
> ----- Original Message -----
> From: "reinsley" <reinsley@xxxxxxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Saturday, January 24, 2009 10:35 AM
> Subject: [amibroker] Re: Creating a Year over Year comparison screen
>
>
>>
>>
>> // Seasonality
>>
>> SetChartOptions( 0, chartShowDates );
>>
>> ShiftBars = Param( "Shift Bars", 0, -5200, 5200, 1 );
>> UpColor = ParamColor( "Up Color", colorSkyblue );
>> DownColor = ParamColor( "Down Color", colorBlue );
>> UnchColor = ParamColor( "Unch Color", colorWhite );
>> Style = ParamStyle( "Style", styleLine, maskAll );
>> NewLine = ParamToggle( "New Title Line", "No|Yes",
1 );
>> GraphZOrder = ParamToggle( "GraphZOrder", "0|1", 1
);
>> GraphXSpace = Param( "GraphXSpace", 0, 0, 100, 1);
>>
>> ShiftedClose = Ref( Close, -ShiftBars );
>> YestShiftedClose = Ref( ShiftedClose, -1 );
>>
>> Color = IIf( ShiftedClose > YestShiftedClose, UpColor, IIf(
>> ShiftedClose < YestShiftedClose, DownColor, UnchColor ) );
>> if ( NewLine )
>> NewTitleLine = "\n";
>> else
>> NewTitleLine = "";
>> Title = VarGetText("Title") + NewTitleLine
>> + EncodeColor( SelectedValue( Color ) ) + "Seasonality ( " +
>> ShiftBars + " ) " + NumToStr( Ref( DateNum(), -Shiftbars ),
1.0 );
>> Plot( ShiftedClose, "Shifted Close", Color, Style );
>>
>>
>>
>>
>> --- In amibroker@xxxxxxxxxxxxxxx,
"pacific5_au" <pacific5_au@xxx> wrote:
>>>
>>> Hi Steve
>>>
>>> Could you please post the afl coding in a message. I didn't get
the
>>> attachment.
>>>
>>> Many thanks :)
>>>
>>> Pac
>>>
>>>
>>> --- In amibroker@xxxxxxxxxxxxxxx,
"Steve Dugas" <sjdugas@> wrote:
>>> >
>>> > Hi - Here is a little tool I wrote a while back. Drop as many
copies
>>> as you
>>> > want on the same chart, 1 for each year, then open params and
shift
>>> them by
>>> > multiples of 250. Then you can fine-tune them to match the
dates by
>>> looking
>>> > at the chart, which shows bars shifted in parens followed by
the
>>> date in
>>> > DateNum() format. You can ignore the commas in the date or
delete the
>>> > separator in your prefs.
>>> >
>>> > HTH.
>>> > Steve
>>> >
>>> >
>>>
>>
>>
>>
>> ------------------------------------
>>
>> **** 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
>>
>>
>>
>>
>