COCO研究院

 找回密碼
 註冊
搜索
查看: 2717|回復: 14

請問一個畫面兩種商品走勢的設定

[複製鏈接]
發表於 13-10-7 17:24 | 顯示全部樓層 |閱讀模式
請問一下各位有經驗的大大
AMIBROKER技術分析畫面中
我想要切上下欄, 上欄顯示鴻海的日線, 下欄顯示台積電的日線

請問要如何設定??

感謝各位大大
發表於 13-10-7 17:43 來自手機 | 顯示全部樓層
開兩個chart 跑不同 symbol 即可~~
發表於 13-10-7 19:17 | 顯示全部樓層
If you refer to charting then here http://www.traderji.com/amibroke ... ues.html#post793677 there are different options visually explained.
 樓主| 發表於 13-10-7 21:10 | 顯示全部樓層


像這樣要怎麼設定啊@@

感謝指導
發表於 13-10-8 01:00 | 顯示全部樓層
tempest88888 發表於 13-10-7 21:10
像這樣要怎麼設定啊@@

感謝指導

這個語法玩玩看吧

_SECTION_BEGIN("Background_Setting");
SetChartBkColor(1);
SetChartOptions(2,chartShowArrows|chartShowDates|chartWrapTitle);
SetChartBkGradientFill(1, 1, 1);
GraphXSpace = Param("Zoom/In Out", 100, -50, 150, 1);
dist = 5*ATR(12);
_SECTION_END();

_NAME = "NG #F=1";
_O = Foreign(_NAME, "O");
_H = Foreign(_NAME, "H");
_L = Foreign(_NAME, "L");
_C = Foreign(_NAME, "C");

PlotOHLC( _O, _H, _L, _C, "", IIf(C>O, colorRed, colorLime), styleCandle);




_name 就是你商品的 symbol

你可以改成可以選擇的 ex. paramlist


評分

參與人數 1金錢 +2 收起 理由
keymaker + 2 按一個讚

查看全部評分

發表於 13-10-8 01:08 | 顯示全部樓層
還有更簡單的語法...

就是打開 formula editor 貼上下列這段 ..

Ticker = ParamStr("Symbol", Name() );

然後您就可以 滑鼠右鍵 -> Parameters = 手動輸入 symbol 名稱
發表於 13-10-8 02:34 | 顯示全部樓層
本帖最後由 joshsmi 於 13-10-8 02:53 編輯
kilroy 發表於 13-10-8 01:00
這個語法玩玩看吧

_SECTION_BEGIN("Background_Setting");

@kilroy,

don't do it this way. It is not efficient and rather slow(er) than using SetForeign and you can't add indicators that are calculated using the foreign symbol's arrays.

Rather do it this way

_SECTION_BEGIN ("Background_Setting");
SetChartBkColor (1);
SetChartOptions (2, chartShowArrows | chartShowDates | chartWrapTitle);
SetChartBkGradientFill (1, 1, 1);
GraphXSpace = Param ("Zoom / In Out", 10, -50, 150, 1);
dist =
5 * ATR (12);
_SECTION_END ();

SetForeign( "NG #F=1" );
PlotOHLC ( O, H, L, C, "", IIf ( C > O, colorRed, colorLime ), styleCandle );
//Plot( C, "", IIf ( C > O, colorRed, colorLime ), GetPriceStyle() ); // alternative plot
//RestorePriceArrays(); // to restore selected symbol's price arrays

發表於 13-10-8 02:41 | 顯示全部樓層
本帖最後由 joshsmi 於 13-10-8 02:54 編輯
joshsmi 發表於 13-10-8 02:34
@kilroy,

don't do it this way. It is not efficient and rather slow(er) than using SetForeign and y ...

For example adding title and bollinger bands to foreign symbol




_SECTION_BEGIN ("Foreign Price");
Ticker =
ParamStr("Input Foreign Symbol", Name() );
SetForeign( Ticker );
PlotOHLC ( O, H, L, C, "", IIf ( C > O, colorRed, colorLime ), styleCandle );
//Plot( C, "", IIf ( C > O, colorRed, colorLime ), GetPriceStyle() ); // alternative plot
//RestorePriceArrays(); // to restore selected symbol's price arrays
_SECTION_END();

_SECTION_BEGIN("Title");
_N(Title = StrFormat(Ticker + " - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.2f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
_SECTION_END();

_SECTION_BEGIN("Bollinger Bands");
P =
ParamField("Price field",3);
Periods =
Param("Periods", 20, 2, 300, 1 );
Width =
Param("Width", 2, 0, 10, 0.05 );
Color =
ParamColor("Color", colorCycle );
Style =
ParamStyle("Style");
Plot( BBandTop( P, Periods, Width ), "\nBBTop" + _PARAM_VALUES(), Color, Style );
Plot( BBandBot( P, Periods, Width ), "\nBBBot" + _PARAM_VALUES(), Color, Style );
_SECTION_END();
發表於 13-10-8 03:00 | 顯示全部樓層
joshsmi 發表於 13-10-8 02:41
For example adding title and bollinger bands to foreign symbol

OK, I get it ~~

thanks for your information

I don't even have a thought about the effiecent and add any indicators on

---
that's what this forum for XD

good for you

發表於 13-10-8 03:12 | 顯示全部樓層
See help file of AmiBroker

Quote:

Single SetForeign( "ticker" ) call is equivalent to the following sequence:

C = Foreign( "ticker", "C" );
O = Foreign( "ticker", "O" );
H = Foreign( "ticker", "H" );
L = Foreign( "ticker", "L" );
V = Foreign( "ticker", "V" );
OI = Foreign( "ticker", "I" );
Avg = ( C + H + L )/3;

but 6x faster (SetForeign takes about the same time as single foreign). To restore original prices call RestorePriceArrays()
 樓主| 發表於 13-10-8 08:16 | 顯示全部樓層
感謝各位前輩提供方法

最簡單的就是把AMIBROKER內建的indicator: PRICE(foreign)拖出來
便能夠完成上欄A股, 下欄B股的目標

感恩^^
發表於 13-10-8 21:06 | 顯示全部樓層
tempest88888 發表於 13-10-8 08:16
感謝各位前輩提供方法

最簡單的就是把AMIBROKER內建的indicator: PRICE(foreign)拖出來

Built-in Price (foreign) code is just a very basic example of how you can draw foreign price but you can't apply indicators to that code via drag and drop as those indicators or other calculations will be calculated based on selected symbol but not based on the foreign symbol.

So rather use Set Foreign for that!
發表於 13-10-9 08:23 | 顯示全部樓層
那疊在一起又要怎麼辦到呢?

發表於 13-10-11 18:17 | 顯示全部樓層
本帖最後由 joshsmi 於 13-10-11 18:26 編輯
lwhuang 發表於 13-10-9 08:23
那疊在一起又要怎麼辦到呢?

just use Setforeign

_SECTION_BEGIN( "Selected Symbol" );
GraphXSpace = Param( "Stretch/Compress", 5, -50, 100, 1 );// or use Shift + left mouse on the y-axis
Color1      =
ParamColor( "Default Symbol - Color", colorGrey50 );
style1      =
ParamStyle( "Default Symbol - Style", styleBar| styleNoTitle, maskAll );

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, style1 );
_SECTION_END();

_SECTION_BEGIN( "Foreign Symbol1" );
EnableTextOutput( False );
ticker2     =
ParamStr( "Foreign Symbol1", "INPUT HERE" );
color2      =
ParamColor( "Foreign Symbol1 - Color", colorOrange );
style2      =
ParamStyle( "Foreign Symbol1 - Style", styleBar, maskAll ) | styleOwnScale;

if(ticker2 == "INPUT HERE" || ticker2 == "")
     style2 = style2 |
styleNoDraw | styleNoTitle;

SetForeign( ticker2 );
Plot( C, "\n" + ticker2, color2, style2 );
// add other calculations/plots here
RestorePriceArrays();
_SECTION_END();


The additional two Titles in your picture are created with GFX and are not included in above code example.

評分

參與人數 1金錢 +2 收起 理由
lwhuang + 2 太強了

查看全部評分

發表於 13-11-7 16:50 | 顯示全部樓層
感謝大大的分享....
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

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

GMT+8, 24-12-23 13:34

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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