Array programming

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

    Hallo to all,

    I would like to ask, if it is possible to use arrays by the code programming?

    Due to the fact that the original code is much more complex (frequenz analysis) i have given a simple sample below.

     

    In case that arrays are not usable, is there any alternative?

    Many thanks for your support.

    Best Regards

    Hasardeur

     

    #38743

    Sorry but it is not possible to build variables arrays, we must know in advance how much variables we need in our codes, I know it somewhat limited our way of programming .. I hope it will be possible soon or later in the future ..! 😐

    #38776

    Good morinng Nicolas,

    many thanks for your explanation.
    In the men time i have struggled out the forum for arrays.
    Sorry I should have to check the forum first before posting, SORRY.
    Is there any possibility to program the array syntax without using the array function?
    A possible programming sample would be helpful (I try to program frequenz analyser).

    Many thanks in advance.
    Best reagrds

    Hasardeur

    #38777

    programming an array without the array functionnality? Hmmm… not possible 🙂 You’ll have to deal with different variables names instead.

     

    #38778

    I needed this feature (array programming) last month when I coded a Wyckoff Wave indicator. Eventually I worked around this limitation (I can understand why PRT, from programming model aspects, do not open the option for this) with the set of graphical commands that PRT released in 10.3. Basically what I did was to identify the “current” bar, i.e. the “newest” bar, and do all my calculations at that point. Then, I used the graphical commands, DrawSegment and DrawRectangle, to actually draw the wave on the price chart. This way I have all the history stored in a read only array and I can access it readily. To express this is other words – you can read a “historical” point of data but you cannot write to it – so I “wrote” in a form of graphics on the chart 🙂

    There are few advantages to this method, mainly speed as the indicator is calculated on all the bar set only once, and few limitations (like scaling) that I found to be workable.

    Pinny

    #38781

    @Pinny

    So you make a loop through history only on the last bar to find what your indicator needs to draw your figure? You are not building an array, right?

    #38782

    Correct. As you noted I cannot build an array or, to be more exact, I cannot “write” to a past element of an array. But I can draw an element at any past point in time. In a sense it is an array but unlike all standard arrays in PRT (e.g. volume, price or any indicator) where you can read past points but cannot write to them, in this specific workaround, I write to past points but can’t read them (only re-calculate them) as the array cells are images on a graph.

    1 user thanked author for this post.
    #38784

    Ok, so this is not an Array Function as we are used to with other programming language 🙂 Of course we can read past datas of any variables! 🙂

    How do you find you are on the last bar of the chart? I know I shared something with you the other day, but I’m wondering if you find anything more relevant for this purpose?

    1 user thanked author for this post.
    #38786

    I use the hint you gave me (Date and Today commands) – I first identify the timeframe I am in by calculating (Date-Date[1]) and (Date[1]-Date[2]), this yield a fixed number: 1 for Daily, 7 for Weekly etc. Then I calculate (Today-Date) to see if the current bar is complete or partial – I work only on complete bars. The reason for doing both (Date-Date[1]) and (Date[1]-Date[2]) is to overcome the effects of weekends/yearends etc.  (will cause the difference to be more than 1 for daily and cause irregularities in year end etc)

    Hope this is clear, otherwise I’ll just send the code

    #38792

    Yes, put the code here please, for future reference. Thanks.

    #38795

     

    3 users thanked author for this post.
    #38960

    Hallo Nicolas,

    I would like to have the period / dominat cycle calculation of the autocorrelation code by John Ehlers.

    Is there any possibility to convert the code (using arrays) to PRT,

    or do you know a well working alternative period / dominat cycle measuring code (not Hilbert Transformation)?

    Many thanks for your replay in advanced.

    Best Regards

    Hasardeur

     

    #38964

    There are a lot of John Ehler’s code in the forum and the library. I found this indicator for cycles (?) https://www.prorealcode.com/topic/can-anyone-code-john-ehlers-empirical-mode-decomposition/

    or

    https://www.prorealcode.com/prorealtime-indicators/ehlers-adaptive-cyber-cycle/

     

    #56481

    Hi Nicolas,

    Do you happen to know if PRT have any plans to implement array functionality in their code?

    Thanks

    Rob

    #119595

    Variables arrays should be available in a few weeks, more infos and examples, howto, in this topic: array variables availability in ProRealTime : examples and discussions

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

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