title: How to forward test and plot?
body: <p>Have received a lot of help. Will look for some more. Learning a lot by just going through the code. </p>
  
  <p>I have thus far:</p>
  
  <p>Loaded an xlsx file using xlsread function.</p>
  
  <p>After this calculated the correlation coeff. Assigned it a variable(?).</p>
  
  <p>Then used(Thanks @Robert P.):</p>
  
  <pre><code>BUYx = x(find(APC &lt; -2.9079,1,'first'))  
  SELLy = y(find(APC &lt; -2.9079,1,'first'))
  BUYy = y(find(APC &gt; 0.44,1,'first'))
  SELLx = x(find(APC &gt; 0.44,1,'first'))
  </code></pre>
  
  <p>To get the first value meeting a particular condition.</p>
  
  <p>Now I want to forward test from where the first value is received till another condition is met. At the same time I would like to make a plot the results. </p>
  
  <p>I am just wondering where to start looking to code/try this. </p>
  
  <p>Please point me in the direction of the functions required. I think it has to loop through all the elements after receiving entry. Not sure which is the right way to go about it. </p>
  
  <p>Thanks</p>
  
  <p>Context:</p>
  
  <p>I am trying to test a StatsArbitrage strategy. I was using excel for the work but I can't seem to get the right functionality.</p>
  
  <p>Basically, when we have an entry(any set of the BUY SELL) I want the system to automatically start calculating Profit/Loss from the next data point and give an output to a new variable. Then I would plot it. 
  Then search for new entry and again start Profit/Loss calculation.</p>