Array Programming

Viewing 13 posts - 1 through 13 (of 13 total)
  • #158371

    Dear Nicolas,

    I would like to ask you for an array programming support.
    For each day a 2 pole bandpass filters shall be calculated for periods from PD= 8 to 48 (swami).
    The Bandpass filter looks back 1 and 2 days “BP= ….. +  ……. BP[1]  + …….BP[2]“.
    By using the normal programming, the BP[i] is always stored from the last calculated Period.
    That is not correct for swami.
    Correct would be for example:

    BP[0] at Period 3 has to be calculated as BP[0]= ….. +  ……. BP[51]  + …….BP[99]

    BP[0] at Period 48 BP has to be calculated as BP[0]= ….. +  ……. BP[96]  + …….BP[144]

    In order to calculate the Peak to Peak cycle amplitude wave the following loop is required:

     

    For this the array has to be designed for 48-1 look back days as follows (0 to 47=48 steps)

    By the above the calculating time of my code is very very long (not practicable for using).
    Do you have an idea for optimising the code in order to speed it up?
    An adjustable PD calculation step (for example 2) could also be helpful to optimize the calculating time.

    Many thanks for your support in advance.

    Best regards
    Hasardeur

    #158381

    Here the array sample in order for easier understanding of the above description.

    #158393

    Hasardeur – Please be more careful when posting. Your post was a total mess of HTML that took a lot of time to tidy up.

    #158402

    Hallo Vonasi,

    I am very sorry about the mess i have caused. I have seen it but have not been able to formate it fine. Is there any trick?  Sorry once again.

     

    #158403

    Cutting and pasting from other websites often causes issues as well as trying to edit code that has already been inserted in the text box from within the text box.

    You have five minutes to edit your post after hitting submit. If it looks like a total mess that will take a lot of work to correct then you are better to delete and start again. This save moderators an awful lot of work! 🙂

    #158412

    ok, understood. Next time i will not copy past and i have learned that there is a time slot of 5 minutes. Could you please say me how to enter the textbox within the 5 minutes after submitting. I have not found these function. Many thanks in advance.

    #158418

    Via Edit

    #158507

    Hello Hasardeur,

    Did you try to replace this line :

    with your complete Indicator code ?
    I know it will be “bad programming” like that, but you should at least test the speed one time because proceeding by impossible (?) means might not lead anywhere anyway. If the speed now suits you, you can proceed from there.

    How long does it take currently ? What do you want to achieve regarding “speed up” ? (2x faster etc. is an answer)

    Can’t you use less wave cycles ? -> obviously not. … I suppose I now like to look into Swami (sorry to be unexperienced) – but not easy to find quickly in this context.

    Peter

     

    #158521

    Sorry, i’m lost in your code. I’m not sure about the nested loops, are they mandatory in order to achieve your calculation?

    A better way to code with arrays, and make it faster, is to calculate what you need at first read of history and store the value in an array with BARINDEX as column number.

    Then, on the current bar, do your calculation included into an IsLastBarUpdate in order to fill your array with the results (result of the current bar or back in history).

    Keep in mind that it is better to loop through arrays on the last bar only, than loop through candlesticks to fill an array on each bar. To be clear, you can make your code do what is needed, but in multiple steps.

    #158868
    HalloNicolas,
    hallo all
    may thanks to for your assistance.
    Nicolas, do you have a sample foryouraboveexplanation.
    The lines of array organisation is enough, i will be able to fill it with the required code by my own. Hopefully.
    Many thanks for your replay in advanced.
    Best regards
    Hasardeur
    #158869

    @Hasardeur

    Do not use the ‘Insert PRT Code’ button for text.

    Thank you 🙂

     

    #158891

    This is what I’m doing in this example: https://www.prorealcode.com/topic/array-variables-availability-in-prorealtime/#post-118817

    While the chart history is loaded (at start of the code and then on each new bar created), I store fractals points into arrays, so that I can use that complete set of values but only when the current bar is updated (with IsLastBarUpdate).

    1 user thanked author for this post.
    #158910

    Dear Nicolas,

    many thanks for your support.

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

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