<?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: simple moving average with two variables in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/simple-moving-average-with-two-variables/m-p/344898#M163150</link>
    <description>&lt;P&gt;As you're looking for a simple moving average with a window, instead of the &lt;CODE&gt;trendline&lt;/CODE&gt; command, what about using the &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/streamstats"&gt;streamstats&lt;/A&gt; command ? &lt;/P&gt;

&lt;P&gt;You can set the window / time window appropriately, and just have average(close) by symbol &lt;/P&gt;</description>
    <pubDate>Sat, 03 Feb 2018 21:47:16 GMT</pubDate>
    <dc:creator>acharlieh</dc:creator>
    <dc:date>2018-02-03T21:47:16Z</dc:date>
    <item>
      <title>simple moving average with two variables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/simple-moving-average-with-two-variables/m-p/344896#M163148</link>
      <description>&lt;P&gt;hi , &lt;BR /&gt;
i had the following data which is collected daily price of 50 itesms i.e. TIMESTAMP, CLOSE and SYMBOL &lt;BR /&gt;
( eg.     31-jan-2018, PRD1, 320&lt;BR /&gt;
            01-Feb-2018, PRD1, 330&lt;BR /&gt;
            31-jan-2018, PRD2, 1500&lt;BR /&gt;
            01-Feb-2018, PRD1,  1520&lt;/P&gt;

&lt;P&gt;). &lt;/P&gt;

&lt;P&gt;i need to find all the product whose closing price is lets say greater than 10 day moving average, 30 day moving average etc. ) &lt;/P&gt;

&lt;P&gt;this query i am writing &lt;/P&gt;

&lt;P&gt;input data &lt;BR /&gt;
|  fields SYMBOL, TIMESTAMP,CLOSE &lt;BR /&gt;
|  eval Date =strptime(TIMESTAMP, "%d-%b-%Y") &lt;BR /&gt;
| fieldformat Date=strftime(Date, "%d-%b-%Y") &lt;BR /&gt;
|  sort Date&lt;BR /&gt;
|  trendline sma10(CLOSE) as DMA10&lt;BR /&gt;
|  trendline sma30(CLOSE) as DMA30&lt;BR /&gt;
|  table Date, SYMBOL, CLOSE, DMA10, DMA30 &lt;BR /&gt;
|  sort -Date &lt;/P&gt;

&lt;P&gt;however this query works well if i write for any one product but calculation fails when data is for both product and sma moving average is also incorrectly calculated&lt;/P&gt;

&lt;P&gt;Please suggest the approach &lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 19:55:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/simple-moving-average-with-two-variables/m-p/344896#M163148</guid>
      <dc:creator>himpor</dc:creator>
      <dc:date>2018-02-02T19:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: simple moving average with two variables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/simple-moving-average-with-two-variables/m-p/344897#M163149</link>
      <description>&lt;P&gt;SYMBOL  is your product, right?&lt;BR /&gt;
Instead of | table Date, SYMBOL, CLOSE, DMA10, DMA30  try &lt;CODE&gt;stats values(Date),values(CLOSE),values(DMA10),values(DMA30) by SYMBOL&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Feb 2018 12:00:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/simple-moving-average-with-two-variables/m-p/344897#M163149</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2018-02-03T12:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: simple moving average with two variables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/simple-moving-average-with-two-variables/m-p/344898#M163150</link>
      <description>&lt;P&gt;As you're looking for a simple moving average with a window, instead of the &lt;CODE&gt;trendline&lt;/CODE&gt; command, what about using the &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/streamstats"&gt;streamstats&lt;/A&gt; command ? &lt;/P&gt;

&lt;P&gt;You can set the window / time window appropriately, and just have average(close) by symbol &lt;/P&gt;</description>
      <pubDate>Sat, 03 Feb 2018 21:47:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/simple-moving-average-with-two-variables/m-p/344898#M163150</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2018-02-03T21:47:16Z</dc:date>
    </item>
  </channel>
</rss>

