Stock Portfolio Organizer
The ultimate porfolio management solution.
Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
abc for Amibroker (AFL)
Copy & Paste Friendly
Back
_SECTION_BEGIN( "XY-Rotation Chart" );
_N( base = ParamStr( "Base", "IHSG" ) );
_N( list = ParamStr( "Symbols", "IDXBASIC,IDXCYCLIC,IDXENERGY,IDXFINANCE,IDXHEALTH,IDXINDUST,IDXINFRA,IDXNONCYC,IDXPROPERT,IDXTECHNO,IDXTRANS" ) );
tbar = Param( "Trailing Bar", 12, 1, 100, 1 );
EnableTextOutput( False );
GfxSetOverlayMode( 2 );
pxl = Status( "pxchartleft" );
pxr = Status( "pxchartright" );
pxt = Status( "pxcharttop" );
pxb = Status( "pxchartbottom" );
pxw = ( pxr - pxl ) / 2;
pxh = ( pxb - pxt ) / 2;
xm = pxl + pxw;
ym = pxt + pxh;
GfxMoveTo( pxl, ym );
GfxLineTo( pxr, ym );
GfxMoveTo( xm, pxt );
GfxLineTo( xm, pxb );
function getrs ( sc, t )
{
bc = Foreign( base, "C" );
sbr = sc / bc;
rs1 = MA( sbr, 12 );
rs2 = MA( sbr, 26 );
rs = 100 * ( ( rs1 - rs2 ) / rs2 + 1 );
rm1 = MA( rs, 1 );
rm2 = MA( rs, 9 );
rm = 100 * ( ( rm1 - rm2 ) / rm2 + 1 );
return IIf( t, rs , rm ) - 100;
}
function drawpos ( x, y, sym, text )
{
rsl = VarGet( "rsl" );
rsh = VarGet( "rsh" );
rml = VarGet( "rml" );
rmh = VarGet( "rmh" );
xx = pxl + pxw + x * ( pxw / ( Max( rsh, -rsl ) * 1.10 ) );
yy = pxb - pxh - y * ( pxh / ( Max( rmh, -rml ) * 1.10 ) );
xp = Nz( VarGet( "xp" + sym ), xx );
yp = Nz( VarGet( "yp" + sym ), yy );
VarSet( "xp" + sym, xx );
VarSet( "yp" + sym, yy );
GfxMoveTo( xp, yp );
GfxLineTo( xx, yy );
GfxCircle( xx, yy, IIf( text == "", 2, 4 ) );
if ( text != "" ) GfxTextOut( sym, xx + 6 , yy - 3 );
}
for ( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
{
SetForeign( sym );
rs = getrs( C, 1 );
rm = getrs( C, 0 );
for ( ii = BarCount - tbar; ii < BarCount; ii++ )
{
rs_ = rs[ ii ];
rm_ = rm[ ii ];
rsh = Nz( VarGet( "rsh" ), rs_ );
if ( rs_ >= rsh )
VarSet( "rsh", rs_ );
rsl = Nz( VarGet( "rsl" ), rs_ );
if ( rs_ <= rsl )
VarSet( "rsl", rs_ );
rmh = Nz( VarGet( "rmh" ), rm_ );
if ( rm_ >= rmh )
VarSet( "rmh", rm_ );
rml = Nz( VarGet( "rml" ), rm_ );
if ( rm_ <= rml )
VarSet( "rml", rm_ );
}
RestorePriceArrays( True );
}
for ( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
{
SetForeign( sym );
rs = getrs( C, 1 );
rm = getrs( C, 0 );
for ( ii = BarCount - tbar; ii < BarCount; ii++ )
{
drawpos( rs[ ii ], rm[ ii ], sym, WriteIf( ii == BarCount - 1, sym, "" ) );
}
RestorePriceArrays( True );
}
_SECTION_END();