TradingView
Trendoscope
2022年5月28日午前5時48分

Tutorial - Convert an indicator into strategy in pine 教育

Bitcoin / TetherUSBinance

詳細

Hello Everyone,

I just made this video because, this question came up many times in Pine QA. In this video we are trying to load default Bollinger Band indicator from Tradingview and convert it into strategy.

Below are the steps

  • Load the indicator on chart
  • Click on source code (curly brackets next to indicator title) to load the code into your pine editor.
  • Make copy of the script. Remove the indicator on chart and load your copy of the script from pine editor
  • Replace indicator call with strategy call
  • Define your entry/exit conditions for long and short
  • Add strategy.entry, strategy.exit, strategy.close calls based on the conditions to generate trades on chart


Useful references

Pine Reference Manual
https://www.tradingview.com/pine-script-reference/v5/#fun_strategy

Strategy template in the linked ideas.

Enjoy :)
コメント
ConConMcG
Super post man, really great and I was just about to try do it myself. One question - how do you tell the strategy to start from a date?
WAYTISECRETS
Always bussy.. very nice Amigo 🙌
Trendoscope
@WAYTISECRETS, Thanks my friend :)
sweetest
@HeWhoMustNotBeNamed, How do you change indicator call? what is indicator call? Need a more indepth instructions pls buddy. Got a great indicator and just want to see if the chart can buy and sell at the exact points of the indicator so I can automate the trading. Thanks so much.
Lunatic_Fringe
@sweetest, This is indicator call :
indicator(title="Directional Movement Index", shorttitle="DMI", format=format.price, precision=4, timeframe="", timeframe_gaps=true)
And this is strategy call :
strategy("DMI strategy 2", overlay=true, margin_long=100, margin_short=100)
Note : the above strategy call has overlay true but you should put it false if you want to hide panel. Using overlay true in strategies can create scale problems.
KioseffTrading
Awesome!
Trendoscope
@KioseffTrading, thanks man.
skytvfx
Hello Master, I hope you are well.
Dear Master, if you can send me the Source Code of this Indicator, because everything I do is not right 😭😭😭
Indicator-Jones
How did you know I was going to look for this 😃
Thank you 🙏
Trendoscope
@Indicator-Jones, Ha.ha.. do not joke mate. I know you are way past this ;)
詳細