timelyart / Kairos

Kairos aims to help you save time by automating repetitive tasks on TradingView such as scanning markets for setups, and refreshing alerts as well as creating new ones.
GNU General Public License v3.0
70 stars 31 forks source link

Idea: support for setting inputs of non-strategy indicator in a backtest #71

Open mrcrdwd opened 2 years ago

mrcrdwd commented 2 years ago

Here's the scenario: You have a strategy that takes a chart indicator as an input parameter. For example the chart indicator could be a Moving Average. And the strategy used the Moving Average to filter entry trades.

Currently it's not possible to run a backtest where you test / change the values of the Moving Average indicator and keep the strategy static.

I think implementing this shouldn't be too hard but curious what you think.

You'd need to: 1) Check if there is a strategy present on the current chart. 2) Click the settings icon of the first item on the chart, regardless if thats an indicator or strategy

Right now number 2 is implemented by clicking the settings icon on the performance pane and that's always a strategy.

timelyart commented 2 years ago

First and foremost, if the MA is part of a strategy then it should be defined as an input for said strategy. Otherwise, it would become more complicated for the user as you'll need to keep track on updates from multiple sources. I can't think of a case where you want to make your strategy dependent on what a different study does on your chart as it would make it more prone to mistakes. Especially, if you are using it in combination with a trading bot.

Secondly, checking additional studies for inputs will add significant cost. Changing an indicator will force the strategy to reload which, I assume, is what you want but loading a strategy is slow and it will make the performance worse for everyone whether they would use it or not (which they shouldn't imho).

In short, whilst technically feasible, I am hesitant to add this because:

Can I ask why you don't incorporate the study into your strategy?

mrcrdwd commented 2 years ago

I would say there is a strong case for having to option of specifying an "external" indicator in a strategy. It opens up the possibility to leverage the entire TradingView arsenal of indicators as a filter in your main strategy. This external indicator acts as an additional filter on your starting condition for instance. And you could backtest if your strategy performs better when you use MA, Volume or MACD as filter (or any of the other available indicators). Does this make sense?

I don't see it as an additional thing that would need to be checked. The way I see it is that Kairos would still pick the top item (not sure what the correct terminology is) on the chart, regardless whether that's a strategy or not. And from there it would set the inputs just like it's doing right now.

So your chart would look something like this: 1) External indicator with a set of inputs (eg. MA) 2) Main strategy that uses 1 as input (eg. QFL)

I'm actually already using this exact setup with a trading bot.