tempest88888 發表於 13-10-7 17:24

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

請問一下各位有經驗的大大
AMIBROKER技術分析畫面中
我想要切上下欄, 上欄顯示鴻海的日線, 下欄顯示台積電的日線

請問要如何設定??

感謝各位大大

kilroy 發表於 13-10-7 17:43

開兩個chart 跑不同 symbol 即可~~

joshsmi 發表於 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.

tempest88888 發表於 13-10-7 21:10

http://imageshack.us/a/img22/8523/20121228130740.png

像這樣要怎麼設定啊@@

感謝指導

kilroy 發表於 13-10-8 01:00

tempest88888 發表於 13-10-7 21:10 static/image/common/back.gif
像這樣要怎麼設定啊@@

感謝指導

這個語法玩玩看吧

_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


keymaker 發表於 13-10-8 01:08

還有更簡單的語法...

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

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

然後您就可以 滑鼠右鍵 -> Parameters = 手動輸入 symbol 名稱

joshsmi 發表於 13-10-8 02:34

本帖最後由 joshsmi 於 13-10-8 02:53 編輯

kilroy 發表於 13-10-8 01:00 static/image/common/back.gif
這個語法玩玩看吧

_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

joshsmi 發表於 13-10-8 02:41

本帖最後由 joshsmi 於 13-10-8 02:54 編輯

joshsmi 發表於 13-10-8 02:34 static/image/common/back.gif
@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();

kilroy 發表於 13-10-8 03:00

joshsmi 發表於 13-10-8 02:41 static/image/common/back.gif
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

joshsmi 發表於 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()

tempest88888 發表於 13-10-8 08:16

感謝各位前輩提供方法

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

感恩^^

joshsmi 發表於 13-10-8 21:06

tempest88888 發表於 13-10-8 08:16 static/image/common/back.gif
感謝各位前輩提供方法

最簡單的就是把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!

lwhuang 發表於 13-10-9 08:23

那疊在一起又要怎麼辦到呢?

http://img197.imageshack.us/img197/1055/78978453.png

joshsmi 發表於 13-10-11 18:17

本帖最後由 joshsmi 於 13-10-11 18:26 編輯

lwhuang 發表於 13-10-9 08:23 static/image/common/back.gif
那疊在一起又要怎麼辦到呢?
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.

nsmvjmsojki 發表於 13-11-7 16:50

感謝大大的分享....
頁: [1]
查看完整版本: 請問一個畫面兩種商品走勢的設定