0
votes

I bought an algo-bot indicator for tradingview, and its been working well, but I'd be interested in building a strategy out of it to backtest.

Example, in the self-made strategy script, i want to do something to the effect of

''' strategy("Bot backtest")

long = condition for the study bot - signals buy short = condition for the study bot - signals sell

strategy.entry("long", strategy.long, 1000.0, when=long) strategy.entry("short", strategy.short, 1000.0, when=short) '''

Basically, am looking to code the actual long entry condition to be the bot indicator signalling to buy. (and same thing for short entry)

Is this even possible without having the source code for the bot? Or is there a way to reference indicators in the manner im talking about? it seems like I would have to have the source script in order to this, because i would need to know what the bots conditions are for it outputting a buy or sell signal, correct?

1

1 Answers

0
votes

It is possible if the study script have boolean plot outputs for signals. However you can "connect" only one reference from the study script to your strategy script. To do that, add the study script to the chart and include this line in your strategy:

signalFromStudy = input(close, "Input", input.source)

Then go to the strategy settings and select the output from the dropdown list.

Then you can operate with the variable and connect strategy functions to execute the backtests.