System stopped

Viewing 5 posts - 1 through 5 (of 5 total)
  • #14748

    Hi

    How can i render this?

    This trading system was stopped because the program used a negative or zero offset (ex: close[-10]) during the evaluation of the last candlestick. Please add protections to your code to prevent negative or zero offsets.

     

    #14750

    Because you have calculation period somewhere in your code and it returns a null or negative value. You might be able to fix this with ABS instruction.

    If it doesn’t work, please post your code for a complete explanation of what happened.

    #14792

    Thanks for answer

     

     

    #63413

    Hi all,

    since I ran into the issue which Gordon Gekko describes, I would like to show you how I solved it for my case.
    The original code was:

     

    In every every trade, when the first candle ran through and the system tried to evaluate the next candle, it ran on error
    “… system was stopped because the program used a negative or zero offset (ex: close[-10]) during the evaluation of the last candlestick. …”

    I solved it by just preventing the code to check “BarIndex – TradeIndex” when it is 0. This is always 0 in the first candle of the trade. So I added a simple condition to my code so that it looks as follows:

     

    This worked well and the system doesn’t stop anymore 🙂

    1 user thanked author for this post.
    #63471

    Thanks a lot for your feedback about how to resolve this kind of error. We could also test the Highest period with MAX instruction, to “force” the period to be at least 1 if it is inferior or Barindex-Tradeindex if it is superior:

     

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

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