Variables with String data

Forums ProRealTime English forum ProScreener support Variables with String data

Viewing 7 posts - 1 through 7 (of 7 total)
  • #61770

    Hi,

    I’ve searched around manuals and this forum, and I fail to find an answer. Not finding how to do it, neither finding a confirmation that it’s not possible. So I turn to all you guys here for help.

    Is there a way to get a variable to hold a text string?

    I wrapped up some very simple example code. (just a sample to visualize my question, not an idea for a good scanner 😉

    With the bellow scanner, I would get a column in the proscreener window with the name “Bull or Bear”, and in the column the number 1 or 2 would show.

    Is there a way to get the variable “varBullOrBear” to hold a text string instead? I many other programming scenarios I would use varBullOrBear = “Bull”, and so forth, but it doesn’t seem to work in this language.

    I would like to display text info in the column in Proscreener instead of a number. Is it possible, if so, how?

    thanks in advance

     

     

     

    —————————

    condition1 = Average[100](close) > Average[200](close)
    condition2 = Average[100](close) < Average[200](close)

    if condition1 then
    varBullOrBear = 1
    endif

    if condition2 then
    varBullOrBear = 2
    endif

    screener [condition1 or condition2] (varBullOrBear as “Bull or Bear”)

    #61773

    The way you have coded your screener is the best way to handle the 2 different results you look for. Variables can’t be text strings, only numbers.

    #61776

    Thank for the very quick response!

    Even though it wasn’t the answer I wished for, I accept the limitation. 🙂

    #62657

    A follow-up question using the same example above. I didn’t find any answer in the programming guide.

    Using the above example the sorting will always be high to low. Let’s say that I value the result “1” higher than “2”, then I obviously would like to show the 1’s on top of the list. Is there a way to reverse the sorting?

    thanks in advance

    #62694

    To change the sorting you can:

    • modify your sorting criteria with any variable values
    • change the sorting order with the dedicated button in the proscreener window (right below the timeframe selection)
    #62707

    Hi,

    I was more looking for a code way of doing it. You might have more than one scanner with different preferences, then it would be nice to be able to do it from the code.

     

    #62710

    Well, sorting is only based on ascending or descending numeric value. You can also separate your screener into 2 different ones: a bullish one and a bearish one.

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

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