Passing Series into custom function/indicator

Forums ProRealTime English forum ProBuilder support Passing Series into custom function/indicator

Viewing 15 posts - 1 through 15 (of 15 total)
  • #193018

    Hey,

     

    Is it possible to create a custom indicator/function that accepts an array/series of values? I want to create something like normalize or standardize function where I can pass in any series of values (maybe close, RSI, another function’s values) and run some calculation on the most recent N bars’ values of this input series.

     

    Thanks

    #193022

    Make an indicator (named, say, DoSomething) with a variable named, say, MySeries.

    That indicator will do its own calculations, then return one or more values.

    Then it can be used in a strategy with the CALL instructions:

    MyVar will retain the value calculated by the indicator according to MySeries.

    Only variables can be used as input and output parameters, not arrays.

    #193054

    Great. How does one declare/define “MySeries” inside the indicator? So that the indicator can do calculations on MySeries. I only see options for Integer, Decimal, Boolean, Moving Average Type. I assumed decimal but does not seem to do what I need.

    #193056

    You simply write the series of your choice within brackets when calling the indicator, such as:

    it can be any number of your choice, as only real  numbers are supported.

    #193057

    This is how you call a function from a strategy. I am asking to see how you define the function itself. Please show me the function definition for DoSomething. Let’s say DoSomething just divides all series values by 2.

    #193075
    JS

    In my opinion, it is not possible what you want because you have to define the input series (close, RSI,—) in the indicator itself.

    #193081

    I am afraid you’re right. Thank you.

    #193082

    There’s no need for special definitions, as only one data type is supported.

    Your indicator is simply this:

    InputDatum is the variable you have to add, in ProBuilder, as an input parameter.

    then use it on your strategy:

    it will halve whatever number is being input.

    Nothing changed since https://www.prorealcode.com/topic/custom-indiator-with-series-input/, despite a function-like support is highly longed for by many.

     

    #193109

     

    Can you please show an example on how to create the function with InputDaum as a series not as a scalar value. The options are only [integer, decimal, boolean, SMA type].

    Can you please show an example where you can pass in a SERIES and access the series’s historical values inside the indicator. Not just the most recent decimal value.

     

     

    #193111

    You can PASS values only by CALLing it within a strategy.
    If you want to USE different values other than those built-in to use them on a chart, you can’t.

    #193112

     

    Ok, hopefully series input parameters are supported soon. Thank you.

    #193120

    Actually there is something that can partially mimick functions.

    This is the DoSomething indicator that uses either RSI or MACD, Multiplting or Dividing it by a factor and returning the calculated result. You can add it to your chart like Rsi or Macd (but you don’t need to add them).

    The user can take advantage of the indicator’s settings to set some parameters without having to edit the code each time:

    You can also call it from a strategy:

    #193123

    You can add more indicators or different data series, as well as more operations to be undertaken (add, subbtract, square root, or any combinations etc…).

    #193124

     

    Unfortunately, I don’t want to hard code functions and only have ability to adjust the numeric input parameters to the hard-coded functions. I need to pass a SERIES into a function. This series could be any numeric values. I am not sure the weight you have with PRT dev team, but I highly urge them to add support for this functionality as it would greatly enhance the abilities of the platform.

    #193126

    I have no direct link with PRT. Maybe Nicolas can tell us more.

    For sure there will not be any text or string support (at least not within a few years), because that would involve changing massively the whole inner workings, mainly memory management.

     

Viewing 15 posts - 1 through 15 (of 15 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login