0

I cannot find any document in TradingView, can any one help me out this problem:

I have Trend1 indicator from 3rd-party script, it has Buy and Sell data series:

enter image description here

And I wanna read Trend1 data on H1 and M15 timeframe like:

//@version=4
study("SupertrendSignal", overlay = true)

trend1_H1 = input(trend_1_result_on_H1, title="Trend1 on H1")
trend1_M15 = input(trend_1_result_on_M15, title="Trend1 on M15")

if (trend1_H1 is buy) and (trend1_M15 is buy)
then plot(1)
else plot(0)   

But I cannot find any guide to do this.

My big problem is I'm new to Pinescript and:

  • I don't know how to get data from SuperTrend custom indicator above
  • I don't know how to get H1 and M15 data at the same time from indicator
  • Is there anyway to debug the data better than plot it on the chart?, cause I'm familiar with the breakpoint in other languages, I don't know how to see its data structure.
Neo.Mxn0
  • 953
  • 2
  • 8
  • 25
  • 1
    Welcome to Pine! This is the best place to start your journey: https://www.pinecoders.com/ . For your question, search the Public Library for MTF SuperTrend scripts: https://www.tradingview.com/scripts/search/supertrend%20mtf/ – PineCoders-LucF Sep 11 '20 at 08:35
  • Many thanks, this helps me resolve first 2 problems – Neo.Mxn0 Sep 11 '20 at 10:01
  • 1
    Oops. Sry missed the last one: https://www.pinecoders.com/faq_and_code/#debugging and https://stackoverflow.com/questions/48656195/what-is-the-equivalent-of-console-log-in-pine-script – PineCoders-LucF Sep 11 '20 at 10:13

1 Answers1

0

You must use the security() function. Here is an example

//@version=4
study("Example security 1", overlay=true)
ibm_15 = security("NYSE:IBM", "15", close)
plot(ibm_15)
clst
  • 111
  • 1
  • 11