<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Candle Stick Chart for Stock Data in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Candle-Stick-Chart-for-Stock-Data/m-p/628474#M19529</link>
    <description>&lt;P&gt;Rough idea is here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*--Extract one stock, set group and add caps based on Open &amp;gt; Close--*/
data stock;
  length Gain $4 lowcap highcap $12;
  set sashelp.stocks(where=(stock='IBM' and date &amp;gt; '01Jan2003'd));
  
  if open &amp;lt; close then do;
    gain='Up';
    v1=open; v2=close;
    lowcap='';
    highcap='FilledArrow';
  end; 
  else do; 
    gain='Down'; 
    v1=close; v2=open;
    lowcap='FilledArrow';
    highcap='';
  end;
run;

proc template;
    define statgraph needleVolume;
        begingraph / collation=binary;
        EntryTitle "Monthly Stock Price" /;
        layout gridded / columns=1 rows=2 rowgutter=5 columngutter=5;
        layout overlay / xaxisopts=(display=(ticks tickvalues line) type=time) 
            y2axisopts=(labelFitPolicy=Split) yaxisopts=(Label="Price" 
            labelFitPolicy=Split type=linear griddisplay=on) 
            y2axisopts=(labelFitPolicy=Split);
        HighLowPlot X=Date High=High Low=Low / primary=true LegendLabel="HighLow" 
            NAME="HIGHLOW";
        HighLowPlot X=Date High=v2 Low=v1 / type=bar Group=COLOR_GAIN 
            OutLineAttrs=(Color=CX000000) LegendLabel="HighLow" NAME="a";
        DiscreteLegend "a" / Location=Inside valign=bottom;
        endlayout;
        layout overlay / yaxisopts=(labelFitPolicy=Split) 
            y2axisopts=(labelFitPolicy=Split);
        NeedlePlot X=Date Y=Volume / primary=true LegendLabel="Volume" NAME="NEEDLE";
        endlayout;
        endlayout;
        endgraph;
    end;
run;

proc sgrender template=needleVolume data=stock;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/120766"&gt;@k_shide&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Team,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you know any sample sgprot codes draw candle stick charts with volume information?&lt;BR /&gt;I found some only for prices in candle stick but don't see codes including volume information at the bottom of the chart.&lt;/P&gt;
&lt;P&gt;sashelp.stocks as the example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Here's the reference to the SGTEMPLATE documentation&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=grstatug&amp;amp;docsetTarget=titlepage.htm&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=grstatug&amp;amp;docsetTarget=titlepage.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 29 Feb 2020 20:01:52 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-02-29T20:01:52Z</dc:date>
    <item>
      <title>Candle Stick Chart for Stock Data</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Candle-Stick-Chart-for-Stock-Data/m-p/628447#M19527</link>
      <description>&lt;P&gt;Hi Team,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know any sample sgprot codes draw candle stick charts with volume information?&lt;BR /&gt;I found some only for prices in candle stick but don't see codes including volume information at the bottom of the chart.&lt;/P&gt;&lt;P&gt;sashelp.stocks as the example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Feb 2020 15:22:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Candle-Stick-Chart-for-Stock-Data/m-p/628447#M19527</guid>
      <dc:creator>k_shide</dc:creator>
      <dc:date>2020-02-29T15:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: Candle Stick Chart for Stock Data</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Candle-Stick-Chart-for-Stock-Data/m-p/628474#M19529</link>
      <description>&lt;P&gt;Rough idea is here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*--Extract one stock, set group and add caps based on Open &amp;gt; Close--*/
data stock;
  length Gain $4 lowcap highcap $12;
  set sashelp.stocks(where=(stock='IBM' and date &amp;gt; '01Jan2003'd));
  
  if open &amp;lt; close then do;
    gain='Up';
    v1=open; v2=close;
    lowcap='';
    highcap='FilledArrow';
  end; 
  else do; 
    gain='Down'; 
    v1=close; v2=open;
    lowcap='FilledArrow';
    highcap='';
  end;
run;

proc template;
    define statgraph needleVolume;
        begingraph / collation=binary;
        EntryTitle "Monthly Stock Price" /;
        layout gridded / columns=1 rows=2 rowgutter=5 columngutter=5;
        layout overlay / xaxisopts=(display=(ticks tickvalues line) type=time) 
            y2axisopts=(labelFitPolicy=Split) yaxisopts=(Label="Price" 
            labelFitPolicy=Split type=linear griddisplay=on) 
            y2axisopts=(labelFitPolicy=Split);
        HighLowPlot X=Date High=High Low=Low / primary=true LegendLabel="HighLow" 
            NAME="HIGHLOW";
        HighLowPlot X=Date High=v2 Low=v1 / type=bar Group=COLOR_GAIN 
            OutLineAttrs=(Color=CX000000) LegendLabel="HighLow" NAME="a";
        DiscreteLegend "a" / Location=Inside valign=bottom;
        endlayout;
        layout overlay / yaxisopts=(labelFitPolicy=Split) 
            y2axisopts=(labelFitPolicy=Split);
        NeedlePlot X=Date Y=Volume / primary=true LegendLabel="Volume" NAME="NEEDLE";
        endlayout;
        endlayout;
        endgraph;
    end;
run;

proc sgrender template=needleVolume data=stock;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/120766"&gt;@k_shide&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Team,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you know any sample sgprot codes draw candle stick charts with volume information?&lt;BR /&gt;I found some only for prices in candle stick but don't see codes including volume information at the bottom of the chart.&lt;/P&gt;
&lt;P&gt;sashelp.stocks as the example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Here's the reference to the SGTEMPLATE documentation&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=grstatug&amp;amp;docsetTarget=titlepage.htm&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=grstatug&amp;amp;docsetTarget=titlepage.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Feb 2020 20:01:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Candle-Stick-Chart-for-Stock-Data/m-p/628474#M19529</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-02-29T20:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Candle Stick Chart for Stock Data</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Candle-Stick-Chart-for-Stock-Data/m-p/628501#M19530</link>
      <description>&lt;P&gt;Thank you very much. I understand the idea.&lt;/P&gt;&lt;P&gt;Actually R provides quite powerful charting procedure as attached pdf file and if SAS also could do that's great but seems to require more complicated template creation right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Mar 2020 00:35:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Candle-Stick-Chart-for-Stock-Data/m-p/628501#M19530</guid>
      <dc:creator>k_shide</dc:creator>
      <dc:date>2020-03-01T00:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: Candle Stick Chart for Stock Data</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Candle-Stick-Chart-for-Stock-Data/m-p/628502#M19531</link>
      <description>You can create a Candle Stick chart using the HighLow statement in SGPLOT&lt;BR /&gt;procedure.  Some data step processing may be needed to create the&lt;BR /&gt;appropriate columns.  I will try to build an example.&lt;BR /&gt;</description>
      <pubDate>Sun, 01 Mar 2020 00:44:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Candle-Stick-Chart-for-Stock-Data/m-p/628502#M19531</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2020-03-01T00:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: Candle Stick Chart for Stock Data</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Candle-Stick-Chart-for-Stock-Data/m-p/628589#M19537</link>
      <description>ggplot2 is pretty powerful but I'm not sure I'd say the template creation is more complicated. It's defining your own template and then the automation is pretty straightforward but I didn't attempt to make it pretty or anything, I'll leave that to you.</description>
      <pubDate>Sun, 01 Mar 2020 21:44:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Candle-Stick-Chart-for-Stock-Data/m-p/628589#M19537</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-03-01T21:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: Candle Stick Chart for Stock Data</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Candle-Stick-Chart-for-Stock-Data/m-p/628849#M19545</link>
      <description>&lt;P&gt;There is an example here: &lt;A href="http://support.sas.com/kb/35/040.html" target="_blank"&gt;http://support.sas.com/kb/35/040.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;that starts with the SASHELP.STOCKS data set that may get you started.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You don't explain in your PDF what the difference may be between the red and green elements so can't make any suggestions.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 17:30:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Candle-Stick-Chart-for-Stock-Data/m-p/628849#M19545</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-03-02T17:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: Candle Stick Chart for Stock Data</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Candle-Stick-Chart-for-Stock-Data/m-p/628944#M19546</link>
      <description>Thank you this is what I want. Didn't make it clear but volume and price must be perfectly aligned so that I can compare them.</description>
      <pubDate>Mon, 02 Mar 2020 22:13:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Candle-Stick-Chart-for-Stock-Data/m-p/628944#M19546</guid>
      <dc:creator>k_shide</dc:creator>
      <dc:date>2020-03-02T22:13:13Z</dc:date>
    </item>
  </channel>
</rss>

