Division by Zero Error: Trading system was stopped

Forums ProRealTime English forum ProOrder support Division by Zero Error: Trading system was stopped

Viewing 15 posts - 16 through 30 (of 51 total)
  • #136600

    Hahaha mystery solved!

    I don’t know why (yet) but I was backtesting on my spreadbet platform and I was getting no trades whatsoever on any Instrument or any Timeframe.

    I saw your screenshot and switched to my CFD Platform  … I’ve got trades now!

    I will set the System going in Demo Live and report back if I find anything re the Division by Zero Error.

    I’ve had the same error before and it is damned annoying!

    #136602

    Here’s a thought before I go to bed 🙂

    Where you have below and similar … what if a bar opened and closed with no price movement whatsoever … you would have a divide by zero??

    Might be worth trying …

     

    1 user thanked author for this post.
    #136611

    I woke with another idea! 🙂

    See attached … the GRAPH variable shows instances where below code is true.

    It’s not your System, I chose one that backtests quicker, but that doesn’t matter … it’s the zero / 0 price movement bar I wanted to highlight.

    10 mins there is less than 5 mins (expected) and 15 mins more than 10 mins … due to longer time period as you can see the extras are to the left on older data.

    When was the last time you had this divide by zero error and on what Instrument and Timeframe?

     

    #136632

    Thank you for your feedback so far!

    I have a few instances where I have   /(open[1]-close[1])  or /(close[1]-(open[1])  in my code, and if a bar opened and closed with no price movement whatsoever then, I suppose,  this would cause a divide by zero error. So I will try your suggestion with the  max formula and see if that changes anything on Monday.

    I started running this system since the beginning of this week and I had around 20 times the division by zero error across all three timeframes and the 7 FX pairs. Basically it happened everyday this week. However, somehow I cannot imagine that there are so many bars with zero movement (open=close), and when I checked the charts after the error messages appeared (I didn’t do it every time), I couldn’t see any zero movement bar. Anyway, I’ll try your suggestion and see how it goes.

    #136633

    I cannot imagine that there are so many bars with zero movement

    No I didn’t think so either but did you look at my screen shots as that proves there is … unless my method is flawed?

    Logically there will be more bars with zero movement on lower time frames (more on 5 min than on 10 min).

    If you cannot face all the work required on all your Systems then just accept the divide by zero error (for now anyway) and as a work around … just start the System going again! 🙂  This what I have done in the past when I couldn’t find the cause.

    If you cannot do above because you are in work etc, then you may want to explore the PRT mobile App? I keep seeing references to PRT Mobile, but I cannot see a click here to get it webpage! 🙂

    #136752

    @GraHal:

    I’ve updated the code with the MAX formula as you suggested for the divisor side of the division involving only open and close values (not high or low values).

    The result: since I strarted running all 21 systems last night non of them have been stopped so far, which is great.

    However,  only 1 trade was taken and 7 other trades on 5 pairs on either 10m or 15m were not executed, even though the ProBacktest shows trades in my IG Demo and IG real account.

    So not sure why trades are not executed. And how can I find out why?

    #136774

    So not sure why trades are not executed. And how can I find out why?

    It has to be to do with the 0.0001?

    I think you need to sit and work out what divisor you need?

    I reckon you may need 0.000001?

    It needs to be less than 1 tick in price so it is only used when Open = Close , i.e. no movement in price at all.  Otherwise it is messing up your strategy??

    #136791

    I have use 1/10th of a pip or 0.00001. Like in the in example below:

    (close[1]-close[2])/MAX(0.00001,(open[2]-close[2]))>0.92

    So, if understand correctly, if open=close only then the value 0.00001 is used. Right?

    I just saw that there are more trades that have not been executed but show up in ProBacktest. But for three trades I’ve checked and there was no open=close which means the problem must come from somewhere else.

    #136792

    I just saw that there are more trades that have not been executed but show up in ProBacktest.

    Are you backtesting the Systems with code as below ?

     

     

    #136793

    This code was an example that I am using in one case. But I’ve basically  applied the MAX formula in each case where the divisor is either (open[1]-close[1]) or (close[1]-open[1]).

    I didn’t apply the MAX formula for the dividend as I figured it’s not relevant as the error message was Division by Zero.

    #136801

    Yes I guess I should have said … are you running the same code in Live and Backtest?

    If Yes … are you missing trades in Live but not missing trades in Backtest?

    #136811

    Yes, I am running the same code in Live (Demo account) and Backtest.

    And I am missing most of the trades in Live.

    #136823

    Are you entering spread in the backtest engine of a value appropriate for each Instrument being backtested?

     

    #136826

    I think it best to choose the Instrument which is giving the most missing trades.

    Then use GRAPH = Open = Close and check if when GRAPH is true … does this align with  a missed trade?

     

    #136827

    Are you entering spread in the backtest engine of a value appropriate for each Instrument being backtested?

    I don’t understand what you mean?

     

Viewing 15 posts - 16 through 30 (of 51 total)

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