|
本帖最後由 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();
|
|