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 - 31 through 45 (of 51 total)
  • #136829

    Sorry,  now I got it.

    I’ve put in a spread of 0.0001 for every pair that I tested. Even though I know for some the spread may be 0.00015 or 0.0002.

    I didn’t think that should be a problem.

    #136830

    @Sascha What’s already suggested is what is what worked for me in my code and is preferred choice I think.

    though this indicator maybe gives a bit of extra insight.

    Alternatively perhaps you could have this code at the top of the strategy and create a condition only take trades if for  xx bars cnr=0 on the original posted here. There could also be a problem in the indicators which are being called I guess.

     

     

    1 user thanked author for this post.
    #136831

    I’ve put in a spread of 0.0001

    You entered a spread of 0.0001 as exactly 0.0001?

    I always enter spread (even on CFD) as the difference between Buy and Sell 1, 1.5 or 2 etc.

    #136832

    Thanks @Paul

    However I think this indicator doesn’t eliminate the fact that division by zero takes place in my code if open=close or close=open.

    The MAX formula as suggest from @GraHal seemed to have eliminated the division by zero error. But now the problem is that hardly any trades are executed.

    I only had 3 trades being executed  only on GBPUSD but  at least 9 trades have not been executed even though they showed up in ProBacktest (1. GBPUSD 10min long, 2. GBPUSD 15min long, 3. NZDUSD 10m long, 4. USDCAD 10m short, 5. USDCHF 10m short,, 6. USDCHF 15m short,  7. EURGBP 10m short, 8. EURGBP 15m short, 9. EURGBP 30m short).

    #136833

    @GraHal: I put in a spread of 1 pip. I just wrote it as 0.0001 in my message. Sorry for the confusion.

    1 user thanked author for this post.
    #136836

    does this align with  a missed trade?

    Also use … GRAPH = when you used the Max fix … to see if this aligns with a missed trade?

    #136936

    @GraHal: I looked into how to use the GRAPH function and it took me a while to figure it out. I applied it to the 10min chart and then realized it is probably easier to check it manually because I have used the MAX formula on multiple timeframes (4hr, 1hr, and the main timeframe: either 10min/15min/30m).

    So I went manually over 6 trades from yesterday that were not executed and checked if open=close on all timeframes, but it was not the case with any of the trades. This means that the MAX formula was able to successfully solve the division by zero error but it is not responsible to the non-execution of the trades.

    One problem solved and a new one created. 🙁

    Last night then I had another idea. My code for long and short trades has been and still is separate for ProBacktest as each is about 1200 lines long and testing is a bit faster keeping them separate. However for trading I wanted them to be together eventually as I otherwise would have to setup and manage 60 trading systems (10 FX pairs, 3 timeframes, 2 directions – long and short). By putting long and short together in one big system the total number of systems would be reduced to 30. So I created a combined version which I’ve been testing since last week.

    My thought was, maybe 2400 lines is too long for ProRealTime to execute without screwing up? Do you have any experience with extreme long systems?

    So last night I took out all the systems and put in separate systems for EURUSD, AUDUSD and USDCAD which makes already 18 systems (2 directions, 10m/15m/30m). To my surprise, so far overnight until now, all the trades that show up in ProBacktest have been taken as trades in my demo account. No trades was missed. It’s strange. Could be a coincidence maybe.

    Long-term I really want long and short to be together in one system as I don’t want to have to manage 60 system all the time. So the problem is not really solved in the end.

    So what I will do tonight is, I’ll put them again together and see if the problem occurs again.

    Do you have any other idea how to approach it? How would a profession programmer approach this issue of seeing trades in ProBacktest and and not having them executed in demo trading?

    #136946

    My thought was, maybe 2400 lines is too long for ProRealTime to execute without screwing up? Do you have any experience with extreme long systems?

    There is a code on here that is a few hundred over 3000 lines and I did recall somebody saying they though 3000 lines is the limit.

    The 3000 + lines System seemed to work okay as I recall.

     

    1 user thanked author for this post.
    #136948

    Have you checked your Rejected / Cancelled Orders List (see attached) … anything useful showing up??

    #136950

    No, nothing was showing up yesterday under rejected / cancelled orders.

    #136954

    No trades was missed. It’s strange. Could be a coincidence maybe.

    I doubt it … sounds like you have found a good lead to the cause of missed trades??

    Do the Systems that miss trades get stopped and you have to restart them?

    #136956

    How would a profession programmer approach this issue of seeing trades in ProBacktest and and not having them executed in demo trading?

    You need to isolate one missing trade and then examine – in closest detail – the candle before the (missed) entry candle.

    Then compare with the same candle on backtest noting in particular the entry price etc.

    Do you spot any difference?

    Is the entry candle on backtest the same candle as the (missing) entry on ProOrder?

    And anything else you can think of? 🙂

    All very boring … until you find the cause then it will have all been worthwhile!! 🙂

    #136971

    No trades was missed. It’s strange. Could be a coincidence maybe.

    I doubt it … sounds like you have found a good lead to the cause of missed trades??

    Do the Systems that miss trades get stopped and you have to restart them?

    After using the MAX formula starting yesterday the systems were not stopped anymore at all. So the division by zero error looks like being solved for now. However trades were simple not executed anymore except for one pair (GBPUSD). No clue why.

    As of now it looks like all trades are being executed since last night but only because I split up long and short systems (which I don’t want to do long-term as mentioned before).
    Also, now I cannot start all of my systems that I want to test because I got the message that in Demo I can only have 25 systems running at the same time while in a live account it is 100.

    I currently want to test 7 pairs. If I have to keep splitting them in long and short this will end up being 42 systems, that’s just too much. If long and short was together it would only be 21.

     

    #137032

    How would a profession programmer approach this issue of seeing trades in ProBacktest and and not having them executed in demo trading?

    You need to isolate one missing trade and then examine – in closest detail – the candle before the (missed) entry candle.
    Then compare with the same candle on backtest noting in particular the entry price etc.
    Do you spot any difference?
    Is the entry candle on backtest the same candle as the (missing) entry on ProOrder?

    @GraHal: The candle before the missed entry candle generally always looks the same. Besides it sounds like you are talking about two separate things, backtest charts and trade charts. Up till now I’ve been doing my back testing in my live account and then put on the “test” trading in my demo account. So you could say these are two separate charts or two separate environments, but the charts are actually the same. They have to be the same. It’s the same ProRealTime software.
    Also, when I set up the ProBacktest in my demo account instead of my live account, the results are exactly the same as in my live account (see srceenshot of an example of ProBacktest in demo account).

    Last night I put again the code for long and short trades in one big code to see if again no trades are taken. So far today trades have been taken which is good, but there are also 6 trades across 4 currency pairs on 10m or 15m that have not been taken. Two examples you see in the attachment where two trades on USDCAD on 10m were not taken.

    So it feels like a puzzle I can’t solve at the moment. There is no division by zero error anymore (great!), the system doesn’t get stopped (great!), but only partly trades are taken when I have long and short in one big code. My thinking is if ProBacktest shows a trade it should also appear in my demo trading. I don’t know where else to look. I have now around 200 “no-entry” conditions for long and short, so 400 together. It’s super complex. Where do you starting looking in such a situation. But again, if ProBacktest works properly and shows trades without any error, it tells me that ProRealTime is able to process the entire code without any problems. So the execution part is the issue.

    #137037

    Besides it sounds like you are talking about two separate things, backtest charts and trade charts.

    Yes I am, but so are you surely … Backtest and Forward Test?

    Let’s both be clear on what we are talking about …

    1. Backtest Live Account
    2. Backtest Demo Account
    3. Forward Test Live Account
    4. Forward Test Demo Account
Viewing 15 posts - 31 through 45 (of 51 total)

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