add a foreign stock price for comparison

#1
please help on how can I add another stock into the same chart for comparison, either by absolute amount or by % (as in the attached picture).



 

trash

Well-Known Member
#3
Here is a basic example.

Use GFX to add an additional price axis.

Code:
_SECTION_BEGIN( "Default Symbol" );
GraphXSpace = Param( "Stretch/Compress", 5, -50, 100, 1 );// or use Shift + left mouse on the y-axis
Color1      = ParamColor( "Default Symbol - Color", colorGrey50 );

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, ParamStyle( "Default Symbol - Style", styleBar| styleNoTitle, maskAll ) );
_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", styleLine, maskAll ) | styleOwnScale;

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

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

Similar threads

Trade in Rs 20, No more % brokerage

Name:Phone:
Email:City:
State:
Are you a day trader?