Error indicator negative entry or zero parameter

Forums ProRealTime English forum ProOrder support Error indicator negative entry or zero parameter

Viewing 15 posts - 1 through 15 (of 18 total)
  • #163679

    Hello everyone! 😀

     

    I hope you are well!

     

    I launched live a code yesterday and today it has been stopped with the message ” indicator negative entry or zero parameter” and I can’t find why and where could be the error…

     

    Could someone give me a hint?

     

    Thanks! 😀

     

     

    #163682

    Try replacing lines 57-58 with:

    because the first time BarresDepuisOpen retains 0.

    #163687

    Thanks @Robertogozzi ! I’ll try that!

     

    Do you think it could also come from elsewhere?

    #163691

    No, I think that can only be the cause.

     

    #219936

    I have had virtually the same problem and although it works if you leave the code in the main algo, it still gives the error when you place the code in an indicator.

    Would you know why it behaves differently in an indicator vs main algo ?

    #220055

    I assume you are talking about the syntax error regarding the variable BREAKEVEN.

    As you can see it’s coloured in blue, this means it’s a reserved keyword (now, it wasn’t at the time the code was written). You only have to replace it with a name of your choice, whenever it occurs, usually adding (at the beginning or at the end of that name) any character of yoiur choice so that it’s no more recognized as a keyword.

    I replaced it with MYBREAKEVEN (all variables and keywords are case insensitive):

     

    #220176

    Thanks for you response Roberto. But no I wasn’t talking about the variable BREAKEVEN.

    I have the following code in the main algo, and it works fine in real time. If I move this piece of code in an indicator and call the indicator in the main algo , I am getting an error saying a zero or negative parameter ….

    any idea why it would behave differently if in main algo or in the indicator section ? Thanks in advance

    If Month <> Month[1] and Barindex > 0 then
    monthlyHigh = Highest[BarIndex – lastMonthBarIndex](dailyHigh)

    monthlyLow = Lowest[BarIndex – lastMonthBarIndex](dailyLow)

    lastMonthBarIndex = BarIndex
    ENDIF

    #220207

    I added that code as an indicator of its own, then calling it from the strategy, and it works as expected.

    I placed those lines in your code above and it works fine like in the indocator.

    I couldn’t spot anything wrong.

    You should post the whole code for both the strategy and the indicator, specifying the instrument, timeframe and units used.

     

     

    #220233

    Thanks again for the reply.

    I should have also indicated that the error is only in real time (i.e when trading) not when running BT.

    #220237

    The code is below inspired from Reiner – Pathfinder that I am trying to use as one indicator to buy or sell. If I insert in the main algo it works but stopped working as I put it in an indicator
    It does not really matter, I can continue to have it in the main algo but just tidier to use as an indicator to simplify the view of the main code.
    And also curious to understand why it works in one case and fails in the other.

     

    #220238

    The error should reoccur tomorrow Monday at 4:00 (GMT)  – I believe because it is a new week and 4:00 is due to the 4h timeframe

     

    #220240
    JS

    Hi,

    I tried the indicator, and I don’t get an error message (also not on Monday) and the indicator gives buy and sell signals…?

    #220242

    Hi JS

    When you say trying do you mean in BT ? The error only occurs in real time trading

    I also can run the BT without any problems

    #220247
    JS

    Hi,

    That’s right, I hadn’t read everything yet… 🙂

    I personally think that error message is due to the “Crosses Over” and “Crosses Under”…

    Perhaps it would be better to use “greater than (>) ” and “smaller than (<)” here…

    (remark: there is no WeeklyLow in the code…?)

    #220275

    Thanks JS.

    If the error is due to cross over – under , replacing these with > and < is fundamentally different.

    Cross over and under are only valid for 1 bar whereas > and < are not limited in time

     

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

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