Reusable Candlestick Screening Code

Forums ProRealTime English forum ProScreener support Reusable Candlestick Screening Code

Viewing 10 posts - 1 through 10 (of 10 total)
  • #31408

    Hello there,

    I’m completely new to ProRealTime and its programming language. I would like to create a number of individual “functions” that represent a single Candlestick pattern that I want to scan for. So, say, morning star, hammer, bullish harami and so on.

    Then, I would like to write a screener that might reference two or three of my Candlestick pattern functions as well as other technical conditions eg: oversold stochastics etc.,

    I’ve noticed that there is a CALL command but it specifies it’s use for calling indicator code whereas I want to call individual candlestick pattern screening functions.

    Is this kind of library/function calling possible in the language. If, are there any examples I could see?

    Many thanks.

    #31444

    Hi Geester

    You have to write the code for the pattern that you want.

    But it may be all done for you … have you searched for candlestick patterns on this site?

    I find it quicker and better using google … just enter prorealcode.com and candlestick pattern and you will see Nicolas has done some very good codes to identify loads of patterns.

    Cheers
    GraHal 

    #31453

    Hi GraHal,

    Thanks for your response!

    I’m happy to write the code. I just want to be able to re-use each pattern with other pieces of code. From what I can see, because you can’t call the code as a function, you would have to replicate the code each time you want to use it [the same pattern] in a different situation.

    For example, I wrote some code for a morning star and evening star and tried to return the value. However, the compiler said that you can only return a value from an indicator. The system seems very capable so I would have thought there would be some way to write a library of candlestick patterns that can be called/invoked from other pieces of code.

    If I wrote some code where I want to screen for RSI oversold with a Morning Star pattern and a different screener for Stochastics oversold with a Morning Star pattern, it looks like I would have to have the Morning Star pattern code in the two screeners. I just want to be able to call a function that re-uses the Morning Star pattern code from just one place.

    Cheers,

    –G

    #31493

    Ah gotcha Geester, I understand now, yes a good idea.

    Nicolas may be along to say if there is a way, or anyway you could email PRT directly and ask them or even suggest it via the PRT Contact Form.

    https://www.prorealtime.com/en/contact?suggestion=1

    Cheers
    GraHal

    #31887

    You’ll have to write an indicator with ProBuilder, named “morningstar” for instance, that return true is this pattern is found. Then you’ll be able to use a CALL to get this value in any screener you’d like to create. Same for any other functions/patterns/indis, …

    #31889

    Do you mean literally:

    RETURN true

    from the indicator?

    I don’t understand how I can return the condition from “morningstar” to include in the SCREENER argument list?

    so:

    morningStarResult  = CALL “morningstar”

    // Is morningStarResult == true ??

    SCREENER [morningStarResult] // Surely this won’t work – it needs the filter expression that was in the indicator called “morningstar”

    See where I am coming from?

     

    #31940

    Ok, let’s make it step by step:

    1/ firstly create your indicator for the morning star pattern and name it “morningstar” (case sensitive for the CALL function we’ll use in the next step):

    This indicator will return “1” if the pattern is found (boolean variable)

    2/ in your screener, you can now include this returned variable value easily:

    and of course add it to any other conditions you’d like to include into your own screener formula.

     

    #31943

    Hey Nicolas,

    Thank you very much indeed for taking the time to explain this so that I could understand it! 🙂

    I’ve called the indicator from a screener and it works beautifully! This is great news and will allow me much greater re-use, now I know the “secret”! 🙂

    Again, I really appreciate your help with this!

    Cheers,

    –G

    #55628

    Nice bit of code Nicolas. I had been wondering if there was a way of defining subroutines, found this thread, and like the clean way you have written it.

    #55629

    Hi John, unfortunately, there is no way to define ‘subroutine’ or ‘function’ like the way you think about (like other programming languages). But use CALL instruction is almost the same like the way I did in my above post. Possibilities are enormous with reusable CALL “functions” 🙂

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

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