array variables availability in ProRealTime – examples and discussions

Forums ProRealTime English forum ProBuilder support array variables availability in ProRealTime – examples and discussions

Viewing 15 posts - 166 through 180 (of 208 total)
  • #184269

    Hi, no

    (unless you have a mathematical relationship between array index and value with a function f, in which case a workaround would be to loop on i with i as index and f(i) as value $period[i]=f(i) to minimise number of lines for initialisation… but I assume you would have mentionned it if it was the case)

    1 user thanked author for this post.
    #185587

    Will be possible in a few days for ProRealTime software, then updates with new instructions will come to other versions dealed by brokers. I’m currently testing these new capabilities (with other many cool new instructions and not specific to arrays..). The new instructions for arrays are: Unset($var) Reset the whole array ArraySort($var,mode) Sort ASCEND or DESCEND (mode) the whole data set of an array

    Hi @Nicolas,

    Maybe you can help out …
    Do you think that it can it be so that someone forgot to implement these for ProOrder ? Both don’t work there, while for ProBuilder they do (see top-part vs bottom-part in the attachment).
    The other array commands seem to work fine in ProOrder.

    Thank you !
    Peter

     

    #185668

    There is always a time between updates of the engines, so I would say it is normal.

    #187962

    Hello Nicolas,

    i m learning and for that i m looking the example, the example #3 is not working for me when i import it in the 1 tick graph.

    Something more should be added in the code ?

     

    Regards,

    tom

    #187966

    I changed the code and it works now.

    #187967

    thanks Nicolas !!!!

    Now, i ll try to reset the upvol and dnvol array value for discarding the cumulative effect of the runtime.

    #189460

    array versus “once” variable

     

    Hi,

    is there a way to populate an array and use its values over several bars (like a “once” variable, which is memorized from one bar to the next) ?

    Thanks.

    #189461

    You can write:

     

    #189465

    is there a way to populate an array and use its values over several bars (like a “once” variable, which is memorized from one bar to the next) ?

    No.
    And this makes arrays virtually useless (says me). All is relative (read : with huge imagination we can utilise arrays), but what they should do (your question) they don’t.

    #189470

    Values stored in arrays can be used at any time like any other variable. The values will remain the same as long as you don’t populate them with new ones.

    I think Peter is talking about history of arrays, the values they used to have X bars ago.

    #189476

    I think Peter is talking about history of arrays, the values they used to have X bars ago.

    No ?
    I’d say the discussion could be interesting (including me missing it all !).

    So No, I am *not* talking about $Arr[x,3] or something – the 3 denoting 3 bars back. When arrays would work as “expected” (from normal coding environments) then this is not even needed. But the other day I found out this (if my memory serves me well) :

    What I would always be talking about is about Strategy code.
    What you, Nicolas, would normally think about is Indicator code.

    … And that other day it seemed to me that Indicator code does do what I’d want or would find normal …

    **Better skip till under the horizontal line below.**

    There is much more going on which an inherent coder (me) can’t think of for logic. This is, for example, the variables in Strategy Code being accessible by Indicator code (I suppose you know that, *or* by now I am talking from my *ss). What I should add is that I am not heading for that this is all “wrong” as such, because if it works, it works, and if it is what PRT coders are used to, who am I to debunk it. But so many things don’t work as expected, and it makes me make mistakes (in judgment but also in coding). Anyway, this is not a subject really. This is :

    The question from @fhornus is there for  a reason. And if I were you or Roberto, I would answer with a “but this is just possible !”. Instead of (like Roberto) coming up with an other solution (which is a moot one IMHO and springs from misunderstanding). So possibly I understand what fhornus’ problem is, and this is from within Strategy code. The point is also (kind of) :

    He uses ONCE in his question for a reason. I would do that too (and in my topic about it from 2 months or so back, I actually presented all around ONCE). This in itself is so super vague that I can (and have !) posted about the usage of Once with a completely wrong perception. Still – when it is interpreted by e.g. Roberto- his responses are so different from what I expect, that it indeed leads to *ME* (!!) having it wrong, while he can not see it. Too hard to explain, but this is probably why I understand fhornus’ question.


    If I – in Strategy code – do something like

    $Arr[0] = 89
    $Arr[1] = 200

    then in a next bar call (call of my Strategy code) I want to work with $Arr[0] and $Arr[1]. But it can’t because it does not exist any more. And would I apply

    MyVar = 10
    MyVar = MyVar + $Arr[0]

    I’ll receive a nice 10 instead of 99 because of the internal construction (this is caught internally) and I can’t even see I am doing it wrongly (no error message because that is how PRT deals with it). The logical solution :

    Once $Arr[]

    This is not related to the history of arrays and that I 20 bars further want to see the array content of the first or second etc. bar. The application of arrays is for normal coding environments (be it Basic, C++, VB.net, cobol, Fortran, Mumps) completely different from how PRT presents it. And since the Indicator Code can do it (can it ??) it is beyond me why not with Strategy code. It would be useful !!

     

    Do I have it all wrong ?

    #189480

    Sorry, I dont get it, I just made a test wit the code you provided and the result is 99:

    If you have defined $Arr[0] = 89 one time, this value will last forever until you change it.

    #189485

    Thanks to Roberto for his answer -as always- and to PeterSt …for getting the point.
    My purpose in fact was not coding strategy , rather to generate statistics to -try to- analyse the dynamic of market mouvements, but in both cases the point is the same : to use data collected in one bar within an array, in an other bar later on. I’ve tried “Once $Arr[]”, but with no success.

    Rgds

    #189486

    Thanks Nicolas ; I’ll try that in Probuilder

    #189487

    @fhornus

    If you give a value to a variable in an array, you will be able to use it later, so I don’t understand your question 🙂

    ONCE is an instruction that is used to give a variable a value only one time, at the first read of the code, it is used for specific purpose and I don’t think it is relevant for your own issue.

    There are plenty of examples on how to use arrays in the first pages of this thread. But here is a simple example:

    in this example we store in the $var variable array the type of candlestick (green is equal to 1 and red equal to -1), so you can make analysis in the last X bars for example, of how many bars were green or red:

     

Viewing 15 posts - 166 through 180 (of 208 total)
Similar topics:

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