Custom Indiator with Series Input

Forums ProRealTime English forum ProBuilder support Custom Indiator with Series Input

Tagged: ,

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

    Hey,

    Can someone please direct me to where I can read how to create a custom indicator that takes a series (expression) as input? Ideally, I want multiple inputs of different type (double series, int).

    customIndicator[n](series)

     

    Thanks,

    David

    #88012

    PRT only supports one data type, which can de defined as “floating point” in other languages, so you can store there decimal numebers, integers, with no distinction. No alphanumeric data types are supported as aren’t arrays of any kind (as of this version).

    A nice simple example of an indicator is at https://www.prorealcode.com/prorealtime-indicators/ma-lag-reduce-factor/.

    It can be CALLed with:

    then you can reference MyIndicator as any common variable, you can use brackets to access past values like in:

    You’ll find the PRT manual at https://www.prorealtime.com/en/help-manual/quick-tour (download the PDF file, page 109 will be of much help for indicators).

     

     

    #88013

    No, mate. This isn’t my question/concern.

    Let me try with an example:

    indicator1 = close * 3.7

    can I do something like this

    customIndicator[5](indicator1)

    If so, how do I create this customIndicator without hard coding the ‘close *3.7’? Because in another strategy I might want

    indicator2 = open / 2.4

    customIndicator[5](indicator2)

     

    Thanks,

    David

    #88014

    Ok, now I got it.

    Unfortunately it is NOT possible, since there’s no interaction between a strategy and the user, once it’s running.

    You can use prices or time to alter variables, but the user cannot change OPEN to CLOSE  or 3.7 to 2.4 at runtime. You have to hard code any constant value CLOSE will remain CLOSE till you hard code something different!

    It is rumoured version 11 is due this year (nobody knows when), we’ll see what improvements it will bring us. The interaction (input) would be much acclaimed and beneficial for the community!

    #88015

    I dont need to change anything at runtime. I just want a custom indicator that is flexible to take different inputs (or series or whatever we call them).

    So strategy1

    indicator1 = close * 3.7

    myIndicator = CALL customIndicator[5](indicator1)

     

    Then in strategy2

    indicator2 = open * 2.4

    myIndicator = CALL customIndicator[5](indicator2)

     

     

    I just dont want to create two custom indicators and I might have 57 strategies with indicator1, indicator2… indicator57 which would require 57 custom functions.. or 1 custom function that allows for changing the input series.

    If this is not possible, I would surely like to suggest this for v11!

    Thanks,

    David

     

    #88016

    Then my first answer is correct, you may use as many constants/variables within brackets, data will be returned in one or more variables written to the left of the “=“ operator.

    #88017

    I dont care about the values inside the brackets [ ]

    I want to change the “(close)” in your first answer to “(indicator1)” or “(indicator57)”. How do I create a custom indicator that allows for this?

    #88018

    I actually think the ‘customclose’ is the answer. Do you have any documentation for this? It seems to work!

    #88019

    Here is the reference I found ising the search box https://www.prorealcode.com/documentation/customclose/

    #88020

    Yeah, I found that too. It is only 1-2 lines and not very useful. Can it work like this…

     

     

     

    Would this work?

    #88024

    I guess it couyld work, but I can’t write that code due to the very odd values (close + open * 2 is impossible to be reached).

    Moreover, what does the number 2 within brackets mean? Where do you use it?

    To be able to help you I need to know the details, with common data, to write some code.

    #88025

    CUSTOMCLOSE can only be set predefined calculation modes (other than CLOSE), not user-defined ones.

    edit: To write code, please use the <> “insert PRT code” button, to make code easier to read. Thank you.

    #88036

    The beginning of the function should have read value1 = Length (which is preset to 2). It is used as a ‘lookback’ inside the for loop.

    Also, what relevance does it matter if (close + open * 2) can be reached? I am comparing the value of this calculation to its prior self. I’m not hoping price ‘reaches’ it. Regardless, I do not know how we’re 8 messages in and I still am unsure if you understand what I am trying to accomplish.

    Does anyone else know how to create template functions or change the input series? In other programming languages you can create a function like this

    functionName(std::vector<double> values, int length)

    {

    // blah blah

    }

     

    so then I can use this created function, functionName(), on any vector of data. It can be used on close values, open values or even (close + open * 2) values. I am afraid in PRT I must create 3 separate functions. 1 for close, 1 for open and 1 for (close + open * 2), e.g.!

    Thanks

    Another way of asking… If I want to create a function that

    #88039

    Indicators ARE like functions, though PRT only supports one data type and NO arrays.

    Try to use something like this:

    then use it within your strategy (setting CUSTOMCLOSE to Open, High, close, and so forth…):

     

     

    #88040

    Parameters must be written within brackets.

    Edit: I had to edit my previous post, you may want to re-read it.

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

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