How to use data from Indicator or Database in multiple Signals?

Questions about MultiCharts and user contributed studies.
idodo
Posts: 15
Joined: 28 May 2019
Has thanked: 6 times

How to use data from Indicator or Database in multiple Signals?

Postby idodo » 16 Jan 2021

Hi Guys,

When backtesting, let's say I am running 10 different Signals on the same chart. Each Signal has to make lots of calculations and it is realy slow.
The thing is, I have lots of redundant calculation exactly the same for all 10 Signals.

E.g. - The same MA (Moving Average) at all 10 Signals on the same charts.

There is no reason to calculate the same MA 10 times. In fact, I need to calculate it only once and use it later.
I am searching a way to run this indicator once (offline) , then Store it in a Database, and than use it in all signals as it is, with no calculations.
If I make a change in the Signal, I don't need to calculate the MA again, because it hasn't changed!
It could save a lot of running time.

How can I implement it?

Thanks,
Ido

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: How to use data from Indicator or Database in multiple Signals?

Postby TJ » 16 Jan 2021

Go to the Wiki
In Section 8
8 PowerLanguage Keyword Reference

Under
Plotting‎ (14 P)

Look up
I getplotvalue
I setplotvalue

idodo
Posts: 15
Joined: 28 May 2019
Has thanked: 6 times

Re: How to use data from Indicator or Database in multiple Signals?

Postby idodo » 16 Jan 2021

I know those 2 commands, in the Wiki it is written:
"i_getplotvalue can be used in functions and indicators if any signal is applied to the main chart."

If I understood correctly it is not possible to "i_getplotvalue " in the Signal, but only in functions and indicators.
What I need is to get the "shared value" in each Signal.

If it is possible to "getplotvalue" in a Signal, than it is great, I will check it

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: How to use data from Indicator or Database in multiple Signals?

Postby TJ » 16 Jan 2021

OK, I got your question wrong. These keywords won't work in your case.


You can try Global Variables
https://www.multicharts.com/trading-sof ... _Variables

idodo
Posts: 15
Joined: 28 May 2019
Has thanked: 6 times

Re: How to use data from Indicator or Database in multiple Signals?

Postby idodo » 16 Jan 2021

Correct me if I am wrong, but GV are not sync and not working well for BackTesting.
I mean, I could maybe sync it somehow, but this is getting ugly

idodo
Posts: 15
Joined: 28 May 2019
Has thanked: 6 times

Re: How to use data from Indicator or Database in multiple Signals?

Postby idodo » 16 Jan 2021

I had an Idea to run the MA once and print the values of each bar to an Ascii file.
Then... insert that file as an instrument (DATA2)
So, I have the MA ready to go as Data and no need to recalculate it 10 time.

Note - Just to make myself clear. I said MA as an Example. This is not a simple MA but a complex Indicator that take a lot of calculation time.
The Idea is to calculate it once! and use it in every Backtest.
E.g
Taking a symbol with 20 years History 1 Minute chart.
Then Generating and Saving all kinds of indicators for future use.
Then using the indicators in backtesting with no need to recalculate them.

I am sure it will work, but it is also getting ugly.
I hope there is a better way

hughesfleming
Posts: 275
Joined: 22 Apr 2014
Has thanked: 70 times
Been thanked: 72 times

Re: How to use data from Indicator or Database in multiple Signals?

Postby hughesfleming » 17 Jan 2021

Take a look a sharedvar server. I am very happy with how it works. It is so useful that there should be something native from Multicharts.

regards,

Alex


Return to “MultiCharts”