Strategy Stop because an index in an array…

Forums ProRealTime English forum ProOrder support Strategy Stop because an index in an array…

Viewing 11 posts - 1 through 11 (of 11 total)
  • #197105

    Hi,

    Im woundering if someone could help me with my failing strategy. Soon after I start my system it fails and I get the following message:

    “Trading system stopped because an index in an array is out of bounds”

    I would not like to post my code here, so maybe its hard to give me any avise, but its a code that “calls” an indicator if thats the problem. Anyone here who can explaine what the message means? That might give me a clue of whats causing the stop.

    Thanks!

     

     

    #197106
    JS

    “UnSet” the array at the beginning of your code:

    DefParam….

    UnSet($MyArray)

    #197109

    Thanks for the reply JS,

    I have DEFPARAM CumulateOrders = False , which I need in this case. Can you please explaine how I should type in the beginning? I cant get it to accept 🙂

    http://unset($MyArray) DEFPARAM CumulateOrders = False // Cumulating positions deactivated n=30 rate=1 once trade=0 number=30 extra=0

    #197112
    JS

    DefParam CumulateOrders = False

    Once trade=0

    n=30

    rate=1

    number=30

    extra=0

    UnSet($MyArray) -> (and of course use your array name, UnSet($……..))

     

    1 user thanked author for this post.
    #197121

    Thanks again Js,

    I am sorry I dont understand what My Array is, so I dont know my array name 🙂

    Probably basic knowledge, but it seems like I missed it simehow 🙂

     

     

    #197122

    You should post your code, to spare helpers guessing.

     

    #197131

    I dont know my array name

    The letters / name following the $ sign in your code.

    1 user thanked author for this post.
    #197133
    JS

    What indicator does your code call up?

    Maybe this indicator uses an array… 🙂

    #197153

    “Trading system stopped because an index in an array is out of bounds”

    ‘Rob’, here’s my guess…

    Since error message reference ‘Trading system stopped’ i’m leaning towards this error is from the Trading sub system of PRT. However, I haven’t used that part of the PRT myself.

    It mentions, ‘index in an array is out of bounds’, we’ll I would have thought that would fall under one of these:

    • Negative Index (must be positive)
    • Decimal Index (must be an integer)
    • Index too large (hitting a system limit)
    • Index in array doesn’t exist (trying to access an element beyond the index size of the array)

    Now I bombarded a ProBuilder array to see what error messages I could get out it, and none of the mentioned ‘Bounds’, backing up the way I,m leaning.

    So me thinks it could be that the ‘code’ + ‘call’ is generating/calculating a value which is affecting either directly or indirectly the flagged array in the error.

    The only options I can think of to work towards a solution is to systematically isolate and verify code segments and data value used, to see if they fall outside acceptable bound and limits. The four bullet-ed item’s above might be a good place to start a search.

    Note:       A ‘Problem’ always come’s in pairs, but, luckily there something common between them, ‘Find’:

      • Problem 1.    Find the Problem
      • Problem 2.   Find the Solution

     

     

     

     

    1 user thanked author for this post.
    #197211

    Hi,

    Thank you Druby for taking the time to answer.

    Im using a indicator that I bought so maybe it doesnt help if I post it here, if the problem is within that indicator, but here is a “dummy code” that gives me the exact same problem. I contacted MetaSignals but they couldnt really help and he was on vacation. I also realized there is a thread about this indicator, but I found no answer in that thread.

    As mentioned, the indicator that im calling is not public, so it will be hard for anyone to test below code. I will raise this question in the thread for the indicator.

    Thanks everyone for your help.

     

     

     

    #197506

    Hi,

    Yes, that’s always going to be difficult when the code is not accessible, but that won’t stop me, here,s what I’m thinking based around my earlier comments above. Using the Guessing and Assuming technique, systematic approach to formulate questions and throwing a spanner in the works!…..

    The code above/below the ‘call’ does not set any of the ‘call’s parameters, only literal values – so they are fixed! – that’s convenient, and the only return is used in the logic of the ‘if’ statements. The other code does not appear problematic especially with respects to the error message, nothing else implied. Therefore focusing on the ‘call’.

    The ‘call’ to the indicator returns  ‘2’ parameter’s and accepts  ’19’ parameter values and is calculated on ‘Close’ data.

    • Have you set the minimum required ‘unit’ setting for the indicator to be able to do its calculations.

    Looking at the return parameters, since there’s only two, your ‘ignore’ ing the 1st, which I think may give a changing value with respect to each bar change, and the 2nd your using, appears to return ‘1’ or ‘-1’.

    • What is the number range of this 2nd param, what happens if its ‘o’ or another value, can it be etc.
    • Why not use the 1st, what is it, what’s it’s range, etc.

    Now the input param’s, that’s a lot, I’m assuming you now what they are since you have put in values for them.

    • Is there ’19’ param, too many, too little
    • What type of number do these each expect
    • Boolean, integer, decimal , etc
    • What range do these number expect, the range should be limited in the indicator, but if not, could allow you to set a value beyond its capacity to calculate properly and create a runtime error which inadvertently trigger the main error.
    • Are the numbers you’ve chosen correct, extreme, ball park, as advertised,
    • If you don’t want to use a param, has it a default value, do certain params rely of other params, ect

    Some of the questions posed could be found in the indicators documentation, watch out for things that are ‘not’ said or implied! don’t assume here and expect spelling mistake. You can build up a picture of what you actually know, so you can focus on what you don’t, and assuming a typo is done once do other reference differ or agree.

    Warning – if your testing make sure you disable the ability of the code to trade, and/or replace with a visual representation in the chart panel of correct logic operation.

    Other answers can be found by testing, this should give you other error messages, which could validate certain things. Looking at it from the point of view which error comes first, the one you create against the main error. By deleting one piece of the code,  one of the following points, replacing and trying another.

    • delete 1st return param   ‘ignored,’
    • delete a call param
    • add a extra return param
    • add a extra call param
    • Since an array index need an integer, set all your input ‘call’ params to integers, does that make a difference.
    • is ‘BladeSCALPER’ spelled right

    Try the ‘call’ in a different file, set up visual output of return values, use 1st return as well, if value’s wildly differ on screen, offset the logic with value to show both in similar position range. i.e.  param 1 (param @ 12,345) ….. param2(12400+param2 ) =12401(1),12399(-1) you can zoom in or just look at the scale or cursor labels. This will give further detail on the data values inside ‘call’ indicator, maybe there’s something you see and add another piece to the puzzle.

    Based on the error message and my earlier comments on array indexes, if that’s right, then a combination of PRT setting, along with the trade instrument you using, the indicator code, and your purchased indicator, set the seen of the problem.

    All this is something you can do, it may help solving the problem, no guarantees, but in the long run will help in other situations. If you get rid of the main error by changing stuff, then that need focused scrutiny to determine why, and what difference has occurred.

    If you fail to find your own solution, at least you will be in a better position to ask a list of systematic probing questions to the seller.

    Can’t think of anything else, to summarize generally, if you can logically learn, and get ahead of the problem you’ll get closer to identifying the problem. Then, you’ve got another problem, ‘The solution!’. Feel free to ask about anything you find.

    Goodluck!

     

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

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