Does the back-tester only calculate from whole numbers?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #113489 quote
    VPT PRT
    Participant
    Junior

    Hi All,

    I am getting some what I would call anomalies within the backtesting strategy creator, and I was wondering if anyone could help?

    The strategy I’m looking at is just a simple crossover system using a custom indicator that I have made.  So if X > Y then long, Y > X then short.  Always in.

    However, when I run the backtest, very occasionally, the indicator crosses it’s MA (very slightly) and the on the next bar crosses immediately back – but the back-tester does not register this as a cross?

     

    So my question is:  Does the backtesting program work to a certain number of decimal places to the right or just whole numbers?  For example; the indicator is calculating to 5 decimal places, but the crosses only seem to register within the program when the cross magnitude is greater than 1.

     

    Can anyone please help clear this up for me?

     

    Many Thanks as always.

     

    Ross

    #113672 quote
    VPT PRT
    Participant
    Junior

    Anyone?

    #113678 quote
    Vonasi
    Moderator
    Master

    This simple indicator will test whether tiny value crosses are recognised:

    if barindex = 0 then
    a = -0.0000000001
    endif
    
    if barindex = 1 then
    a = 0.0000000001
    endif
    
    if a crosses over 0 then
    flag = 1
    endif
    
    return flag

    …..and they are as flag returns a value of 1. But when I code something similar as a dummy strategy at ten decimal places the cross is not recognised and flag = 0. Below ten decimal places flag = 1 and the cross is recognised.

    if barindex = 0 then
    a = -0.0000000001
    endif
    
    if barindex = 1 then
    a = 0.0000000001
    endif
    
    if a crosses over 0 then
    flag = 1
    endif
    
    buy at -close limit
    
    graph flag
    
    #113679 quote
    robertogozzi
    Moderator
    Master

    It depends on what you used as a term to identify a CROSSOVER, if you write:

    IF close CROSSES OVER MyMA THEN

    is because you want CLOSE to cross over. If HIGH does, but CLOSE doesn’t, then it’s not a crossover (the reverse for LOW), which, instead, would be true if you had written:

    IF high CROSSES OVER MyMA THEN

    As for decimals, I never happened to check that, but I think it uses ALL decimal places you see on your chart.

    #113680 quote
    Vonasi
    Moderator
    Master

    As for decimals, I never happened to check that, but I think it uses ALL decimal places you see on your chart.

    I assumed the same until I ran the test in my post just before yours. It seems that the ProOrder engine does not recognise the same cross overs that the ProBuilder engine does.

    #113682 quote
    robertogozzi
    Moderator
    Master

    Data showed on the chart seems to consider only 5 decimals.

    x-22.jpg x-22.jpg
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Does the back-tester only calculate from whole numbers?


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
VPT PRT @vpt-prt Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by robertogozzi
6 years, 2 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 11/23/2019
Status: Active
Attachments: 1 files
Logo Logo
Loading...