Reputation: 65
I am trying to code and implement a strategy based on multiple timeframes. The logic is simple as follows -
Condition 1 = Stochastic K & D both Oversold (or Overbought) on both 15 Minutes and 30 Minutes timeframes Condition 2 = K > D (or K < D)
Enter Long (or Enter Short)
How can I code this in TradingView with pine script?
Upvotes: 0
Views: 687
Reputation: 21342
You should use the security() function for this purpose.
The following code will request SMA9
from the daily timeframe.
//@version=4
study(title="High Time Frame MA", overlay=true)
src = close, len = 9
out = sma(src, len)
out1 = security(syminfo.tickerid, 'D', out)
plot(out1)
Upvotes: 1