COCO研究院

 找回密碼
 註冊
搜索
查看: 2165|回復: 5

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

[複製鏈接]
發表於 12-11-3 00:58 | 顯示全部樓層 |閱讀模式
各位大大好, 請問Amibroker 能夠同時顯示2個Symbol 在同一個圖中嗎?
發表於 12-11-3 01:21 | 顯示全部樓層
當然可以阿
...
 樓主| 發表於 12-11-3 01:24 | 顯示全部樓層
啊!!! 怎樣做的!!!那個功能來的
發表於 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 dialog
  1. GraphXSpace = Param( "GraphXSpace", 5, -50, 100, 1 );
  2. color1      = ParamColor( "Color 1", colorGrey50 );

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

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

  9. SetChartOptions( 0, chartShowArrows | chartShowDates );
  10. _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 ) ) ) );
  11. Plot( C, "", Color1, styleNoTitle | ParamStyle( "Style 1" ) | GetPriceStyle() );

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

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

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

  5. // 2nd ticker
  6. SetForeign( Ticker2 );
  7. SetChartOptions( 0, chartShowArrows | chartShowDates );
  8. _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 ) ) ) );
  9. PlotForeign( Ticker2 , "" , Color2 , ParamStyle( "Style" ) | GetPriceStyle() );
複製代碼

評分

參與人數 2金錢 +4 收起 理由
joey0415 + 2 按一個讚!
enochyu + 2 按一個讚!

查看全部評分

 樓主| 發表於 12-11-3 02:49 | 顯示全部樓層
感謝moneymaker , joshsmi 大大, 學到好東東了!!
發表於 12-12-19 03:03 | 顯示全部樓層
joshsmi 發表於 12-11-3 02:06
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:


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

  9. SetChartOptions( 0, chartShowArrows | chartShowDates );

  10. _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 ) ) ) );
  11. Plot( C, "", Color1, styleNoTitle | ParamStyle( "Style 1" ) | GetPriceStyle() );

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

  16. // 3rd ticker
  17. SetForeign( Ticker3 );
  18. Plot( C, "\n" + ticker3 , Color3 , ParamStyle( "Style 3", styleCandle, maskAll ) | styleOwnScale );
  19. RestorePriceArrays();
複製代碼


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

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

  5. // 2nd ticker
  6. SetForeign( Ticker2 );
  7. SetChartOptions( 0, chartShowArrows | chartShowDates );
  8. _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 ) ) ) );
  9. Plot( C , "" , Color2 , ParamStyle( "Style" ) | GetPriceStyle() );
複製代碼

您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

手機版|Archiver|站長信箱|廣告洽詢|COCO研究院

GMT+8, 24-12-23 18:52

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回復 返回頂部 返回列表
理財討論網站 |