Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Powerlanguage - using functions to construct signals
I tried to transform a signal into a generic function and reuse it into a signal. It seemed to work, but, after some updates in OS, I am not able to make it work anymore (the same signal and the others, meanwhile, I wrote). Maybe some name conflict (variable names?) came up. Is it generally possible to make this transformation? Which rules must be followed? Thank you in advance for any suggestions.
Can you help answer these questions from other members on NexusFi?
I have just started using PowerLanguage, but I have a lot of EasyLanguage experience, which is very similar. First, a basic question: Did you try to recompile your function(s)? Maybe they need to be recompiled.
Here is my approach to turning an indicator into a function:
Get the indicator code
Create a new function: do not use any special character except underscore "_". I use a prefix before every function, example HSC_ is my prefix, so a function might be called HSC_NoLag_MA. This helps avoid naming conflicts
Remove Alert criteria from the code
Remove Plot criteria
If the function generates more than one value, then create the 'numericref' or 'stringref' inputs to store the values to be used (see example below)
Add a return statement (see example below)
Compile and correct any errors
Test the function in an indicator or signal
Here is an indicator that I turned into a function. I used a Return Type of TrueFalse (boolean), because my function generates three values that I need:
Here is the function:
Here is how I would call the function:
You can use the same approach with converting a Signal.