title: Calculating signals in stock trading
body: <h2>Pre-description</h2>
  <p>I am analyzing stock prices.</p>
  <ul>
  <li>The <strong>spread</strong> value is the value of one pair.</li>
  <li>A pair is two stocks, like <strong>Amazon_Tesla</strong>.</li>
  <li>If the <strong>signal is 1</strong>, it means the stock must be sold.</li>
  <li>If the <strong>signal is 0</strong>, means that the stock must be bought.</li>
  </ul>
  <p><a href="https://i.stack.imgur.com/5sXmH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5sXmH.png" alt="enter image description here" /></a></p>
  <h2>Inputs</h2>
  <ol>
  <li>std values: float</li>
  <li>spread: list or pandas series</li>
  </ol>
  <h2>Outputs</h2>
  <ol>
  <li>Signal-1</li>
  <li>Signal-2</li>
  </ol>
  <h2>How do the signals change?</h2>
  <p>Signal changes according to <em>spread</em> and <em>threshold value</em>. In this example, the threshold value is the standard deviation (value=1). In index # 2, we sell amazon shares and buy tesla shares.  The spread must be expected to exceed the std value for the first trade to begin. Signal values change as in the sample data.</p>
  <h2>Result</h2>
  <p>What is the easiest way to get outputs like the example using inputs?</p>
  <p>To access sample data:
  <a href="https://gist.github.com/birdalugureren/05ea6995a9f31478599e9c062e9cd452" rel="nofollow noreferrer">https://gist.github.com/birdalugureren/05ea6995a9f31478599e9c062e9cd452</a></p>