<?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 Is there a way to write a rule where the majority of subrules are true? in Discussions</title>
    <link>https://connect.mozilla.org/t5/discussions/is-there-a-way-to-write-a-rule-where-the-majority-of-subrules/m-p/34580#M12585</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Just returned to TS and I'm trying to code a rule where over the last X bars, price was above EMA 20 for X-Y times - where X-1, or X-2 etc.&lt;/P&gt;&lt;P&gt;On another site, they support a looping rule;&lt;/P&gt;&lt;P&gt;LoopSum("Close(CTR)&amp;gt;SMA(20,0)",10) for example. LoopSum counts the number of time the condition in quotes is true. CTR is a private variable inside LoopSum and the second arg specifies the number of times to loop.&lt;/P&gt;&lt;P&gt;So if I wanted to screen for a stock that closed above SMA20 at least 7 times over the last 10 days, this would work;&lt;/P&gt;&lt;P&gt;LoopSum("Close(CTR)&amp;gt;SMA(20,0)",10)&amp;gt;=7&lt;/P&gt;&lt;P&gt;Can I do the same in TS?&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Walter&lt;/P&gt;</description>
    <pubDate>Thu, 29 Jun 2023 21:54:49 GMT</pubDate>
    <dc:creator>wwasilev</dc:creator>
    <dc:date>2023-06-29T21:54:49Z</dc:date>
    <item>
      <title>Is there a way to write a rule where the majority of subrules are true?</title>
      <link>https://connect.mozilla.org/t5/discussions/is-there-a-way-to-write-a-rule-where-the-majority-of-subrules/m-p/34580#M12585</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Just returned to TS and I'm trying to code a rule where over the last X bars, price was above EMA 20 for X-Y times - where X-1, or X-2 etc.&lt;/P&gt;&lt;P&gt;On another site, they support a looping rule;&lt;/P&gt;&lt;P&gt;LoopSum("Close(CTR)&amp;gt;SMA(20,0)",10) for example. LoopSum counts the number of time the condition in quotes is true. CTR is a private variable inside LoopSum and the second arg specifies the number of times to loop.&lt;/P&gt;&lt;P&gt;So if I wanted to screen for a stock that closed above SMA20 at least 7 times over the last 10 days, this would work;&lt;/P&gt;&lt;P&gt;LoopSum("Close(CTR)&amp;gt;SMA(20,0)",10)&amp;gt;=7&lt;/P&gt;&lt;P&gt;Can I do the same in TS?&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Walter&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2023 21:54:49 GMT</pubDate>
      <guid>https://connect.mozilla.org/t5/discussions/is-there-a-way-to-write-a-rule-where-the-majority-of-subrules/m-p/34580#M12585</guid>
      <dc:creator>wwasilev</dc:creator>
      <dc:date>2023-06-29T21:54:49Z</dc:date>
    </item>
  </channel>
</rss>

