Faster optimization speed question and a thought

Questions about MultiCharts and user contributed studies.
User avatar
joebone
Posts: 175
Joined: 05 Sep 2018
Has thanked: 53 times
Been thanked: 4 times

Faster optimization speed question and a thought

Postby joebone » 13 May 2020

Hello,

I have a fairly complex calculation that I use several times.

would a function for the calculation be faster when optimizing or is it faster to create new variables for each iteration of the calculation?



Second thought or question...
This FAQ thread is awesome...viewtopic.php?t=10811

I haven't seen many posts about how to increase optimization speed. Curious if there was a good post about optimization speed that anyone knew about?

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

Re: Faster optimization speed question and a thought

Postby TJ » 13 May 2020

Hello,
. . .
This FAQ thread is awesome...viewtopic.php?t=10811
. . .
I am glad you find it useful. 8)

Good trading to you.

User avatar
joebone
Posts: 175
Joined: 05 Sep 2018
Has thanked: 53 times
Been thanked: 4 times

Re: Faster optimization speed question and a thought

Postby joebone » 13 May 2020

Hello,
. . .
This FAQ thread is awesome...viewtopic.php?t=10811
. . .
I am glad you find it useful. 8)

Good trading to you.

Awe dang... no tips on the speed question... I thought for sure you would have some input.. hahah

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

Re: Faster optimization speed question and a thought

Postby TJ » 13 May 2020

My understanding is, the function is a "human" short cut.
When MC compiles the indicator, the function code is inserted back into the script wherever it appears.

However, all is not lost. Good coding practice can speed up the execution.

For example:

Code: Select all

If H < average( C, 20 ) then . . . If L > average( C, 20 ) then . . .
should be written as

Code: Select all

AVG20 = average( c, 20 ); If H < AVG20 then . . . If L > AVG20 then . . .

User avatar
joebone
Posts: 175
Joined: 05 Sep 2018
Has thanked: 53 times
Been thanked: 4 times

Re: Faster optimization speed question and a thought

Postby joebone » 13 May 2020

My understanding is, the function is a "human" short cut.
When MC compiles the indicator, the function code is inserted back into the script wherever it appears.

However, all is not lost. Good coding practice can speed up the execution.

For example:

Code: Select all

If H < average( C, 20 ) then . . . If L > average( C, 20 ) then . . .
should be written as

Code: Select all

AVG20 = average( c, 20 ); If H < AVG20 then . . . If L > AVG20 then . . .
Thanks very Much.. This is something I picked up last year. Always try to replace a recurring function/calculation with a Variable.

After this I imagine it gets more difficult to lean out a script. Thanks for the confirmation on the function though.. Nice to know that it is efficient to use them at will as long as you follow that first rule


Return to “MultiCharts”