Page 1 of 1

Back testing combined indicators & scripts ?

Posted: Sat Dec 05, 2020 5:06 am
by Rapatera
Good day guys,

a newbie here with a quick question.

We all make use of signals from multiple indicators on multiple time frames before making a trade, but is it at all possible to create a script / TV strategy that can be back tested by using inputs from multiple indicators from multiple time frames and bake them all into one strat. that can be back tested ? (even if you dont have the source code of some of them) .

For example - I want my strategy to give a buy signal only when the MACD produces a buy cross above the zero line on the 4hr, 6hr and 8hr, and also only when say the RSI is over sold on the 8hr and 12hr. and then bake in some more conditions from other indicators ( that might even have locked source code).

or in the very least use alerts that get triggered from certain indicators as inputs for a custom script that can be back tested ?

thnx for your time.

Re: Back testing combined indicators & scripts ?

Posted: Thu Dec 10, 2020 4:12 am
by Matthew
Hi Rapatera!

It's absolutely possible to mix and match multiple timeframe indicator conditions in your strategy scripts, but not with locked scripts.

Unfortunately Pine Script doesn't allow you to reference user-published scripts in your source code, so unless you have access to their source code (or you can successfully recreate it), you can only reference existing inbuilt indicators.

As far as I know you also can't reference other script's alerts in your scripts.

What you're trying to do is probably outside the scope of Pine Script and might be better suited to a language like Python. But referencing RSIs/MACDs/EMAs/ATRs and other "vanilla" indicators in your scripts across multiple timeframes (and markets for that matter) is definitely possible.