keithlsp 發表於 12-11-3 00:58

Amibroker 能夠同時顯示2個Symbol 在同一個圖中嗎?

各位大大好, 請問Amibroker 能夠同時顯示2個Symbol 在同一個圖中嗎?

moneymaker 發表於 12-11-3 01:21

當然可以阿
...{:4_186:}

keithlsp 發表於 12-11-3 01:24

啊!!! 怎樣做的!!!那個功能來的

joshsmi 發表於 12-11-3 02:06

keithlsp, use Setforeign() or Foreign()

This code displays 3 tickers in the same pane.
Enter 2nd and 3rd ticker in Parameters dialogGraphXSpace = Param( "GraphXSpace", 5, -50, 100, 1 );
color1      = ParamColor( "Color 1", colorGrey50 );

//2nd ticker
color2      = ParamColor( "Color 2", colorOrange );
Ticker2   = ParamStr( "Symbol 2", Name() );

//3rd ticker
color3      = ParamColor( "Color 3", colorYellow );
Ticker3   = ParamStr( "Symbol 3", Name() );

SetChartOptions( 0, chartShowArrows | chartShowDates );
_N( Title = StrFormat( EncodeColor( Color1 ) + "{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}} ", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C, "", Color1, styleNoTitle | ParamStyle( "Style 1" ) | GetPriceStyle() );

// 2nd ticker
SetForeign( Ticker2 );
PlotForeign( Ticker2 , "\n" + ticker2 , Color2 , ParamStyle( "Style 2", styleCandle, maskAll ) | styleOwnScale );
RestorePriceArrays();

// 3rd ticker
SetForeign( Ticker3 );
PlotForeign( Ticker3, "\n" + ticker3 , Color3 , ParamStyle( "Style 3", styleCandle, maskAll ) | styleOwnScale );
RestorePriceArrays();If you want to display a foreign ticker in a separate pane then simply use thisGraphXSpace = Param( "GraphXSpace", 5, -50, 100, 1 );

//2nd ticker
Ticker2   = ParamStr( "Symbol 2", Name() );
color2      = ParamColor( "Color Ticker 2", colorBlack );

// 2nd ticker
SetForeign( Ticker2 );
SetChartOptions( 0, chartShowArrows | chartShowDates );
_N( Title = StrFormat( EncodeColor( Color2 ) + Ticker2 + " - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}} ", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
PlotForeign( Ticker2 , "" , Color2 , ParamStyle( "Style" ) | GetPriceStyle() );http://s17.postimage.org/qk8hg2pvz/image.png

keithlsp 發表於 12-11-3 02:49

感謝moneymaker , joshsmi 大大, 學到好東東了!!

joshsmi 發表於 12-12-19 03:03

joshsmi 發表於 12-11-3 02:06 static/image/common/back.gif
keithlsp, use Setforeign() or Foreign()

This code displays 3 tickers in the same pane.


One correction to my codes. PlotForeign is not needed if using SetForeign.
So here are the updates:


GraphXSpace = Param( "GraphXSpace", 5, -50, 100, 1 );
color1      = ParamColor( "Color 1", colorGrey50 );
//2nd ticker
color2      = ParamColor( "Color 2", colorOrange );
Ticker2   = ParamStr( "Symbol 2", Name() );
//3rd ticker
color3      = ParamColor( "Color 3", colorYellow );
Ticker3   = ParamStr( "Symbol 3", Name() );

SetChartOptions( 0, chartShowArrows | chartShowDates );

_N( Title = StrFormat( EncodeColor( Color1 ) + "{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}} ", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C, "", Color1, styleNoTitle | ParamStyle( "Style 1" ) | GetPriceStyle() );

// 2nd ticker
SetForeign( Ticker2 );
Plot( C, "\n" + ticker2 , Color2 , ParamStyle( "Style 2", styleCandle, maskAll ) | styleOwnScale );
RestorePriceArrays();

// 3rd ticker
SetForeign( Ticker3 );
Plot( C, "\n" + ticker3 , Color3 , ParamStyle( "Style 3", styleCandle, maskAll ) | styleOwnScale );
RestorePriceArrays();


GraphXSpace = Param( "GraphXSpace", 5, -50, 100, 1 );

//2nd ticker
Ticker2   = ParamStr( "Symbol 2", Name() );
color2      = ParamColor( "Color Ticker 2", colorBlack );

// 2nd ticker
SetForeign( Ticker2 );
SetChartOptions( 0, chartShowArrows | chartShowDates );
_N( Title = StrFormat( EncodeColor( Color2 ) + Ticker2 + " - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}} ", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C , "" , Color2 , ParamStyle( "Style" ) | GetPriceStyle() );
頁: [1]
查看完整版本: Amibroker 能夠同時顯示2個Symbol 在同一個圖中嗎?