title: Buy and sell-markers on lower time frames when longer time frame shows uptrend
body: <p>So, I'm trying to run a trading bot on medium timeframes (1h - 4h) using the KDJ-indicator. I know it's not the most responsive indicator but it is very reliable, at least on higher time frames (8h - 1D).
  What I would like to be able to do is use the following script to send BUY/SELL-signals to my bot, BUT ONLY when the asset is not trending down on the 1D-chart. In other words, I would like to run this script:</p>
  <pre><code>//@version=4
  study(title=&quot;KDJ IndicatorTV&quot;, shorttitle=&quot;KDJ_TV&quot;, format=format.price, precision=2, resolution=&quot;&quot;, overlay=true)
  periodK = input(9, title=&quot;K&quot;, minval=1)
  periodD = input(5, title=&quot;D&quot;, minval=1)
  smoothK = input(3, title=&quot;Smooth&quot;, minval=1)
  multiplierJ = input(3.5, title=&quot;Jx&quot;, minval=0.1)
  k = ema(stoch(hlc3, high, low, periodK), smoothK)
  d = ema(k, periodD)
  j = multiplierJ * k-2 * d
  
  makeShape1 = if (crossover(j,d) or crossover(j,99))
      true
  else
      false
  
  plotshape(series=makeShape1, style=shape.cross, color=#0094FF, transp=10, text=&quot;buy&quot;, title='buy')
  
  makeShape2 = if (crossunder(j,d) or crossunder(j,99))
      true
  else
      false
      
  plotshape(series=makeShape2, style=shape.cross, color=#FF6A00, transp=10, text=&quot;sell&quot;, title='sell')
  //end
  </code></pre>
  <p>And I would like to add a condition to makeShape1, something like &quot;AND If j&gt;d on 1D-chart&quot;, to ensure that buys are only generated while J is larger than D on the 1D-chart of that asset (ie: when the market for that asset is in an uptrend).</p>
  <p>Any ideas on if/how I can achieve that?</p>
  <p>Thanks!
  -Daniel</p>