Error in back test product

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #33939 quote
    njames879
    Participant
    New

    Hi, I think that my back test product is showing an error.  I’d be interested in other people’s views as to whether I’m right, or whether I’m making some fundamental error.

    I’ve got a system that is really simple, though it works off a fairly complicated indicator.  Here’s the code

    Indicator1 = CALL "Basic system 1 + Bollinger"(close)
    // Conditions to enter long positions
    IF Indicator1 = 1 THEN
    BUY 1 CONTRACTS AT MARKET
    SET STOP pLOSS 27
    SET TARGET pPROFIT 30
    ENDIF
    // Conditions to enter short positions
    IF Indicator1 = -1 THEN
    SELLSHORT 1 CONTRACTS AT MARKET
    SET STOP pLOSS 27
    SET TARGET pPROFIT 30
    ENDIF

    So, the issue arises when an existing position is in place, and a signal is generated in the opposite direction to the existing position, (ie, i’ve got a long position and a signal is generated which says I should open a short position.   My intention was that, in this case, the system should simply close out the existing position and wait for the next opportunity.  However, the live system and pro-back test treat this differently.  Here’s a  case, (AUD/USD 5 minutes) where this happened. (first attachment).  When I ran this in live against an IG spreadbetting account, the system behaved as I would expect, the system opened a position at 11:05 and closed it out at 15:40, I’ve attached the transaction history, and you can see that the sell order is opened but immediately nets out against the long position and both then close.

    However!  when I run a pro-back test over the same period, it not only closes the long position, but it also opens a new short position, giving entirely different results to the live situation.  I’ve attached the picture of the pro-back test, and also the detailed results.

    Am I being stupid, or is this actually an error in pro-back test.

    Any input very gratefully received.

    PBT-1.jpg PBT-1.jpg PBT-2.jpg PBT-2.jpg PBT-3.jpg PBT-3.jpg PBT-4.jpg PBT-4.jpg
    #33947 quote
    Maz
    Participant
    Veteran

    Hiya. Without seeing the indicator code I can’t help. But one or two things are springing to mind.

    1. Make the logic robust by testing if on market / if longOnMarket / if not shortOnMarkrt etc just to avoid any ambiguity. Explicitly say when it is and when it is not allowed to flip direction. Try elsif where appluckable
    2. Avoid call. Import your indicator to the system code.
    #33967 quote
    Nicolas
    Keymaster
    Master

    Agree with Maz, you could also GRAPH Indicator1 in backtest to see how really the signals are read by your code.

    My first idea would be to completely include your indicator into your automatic strategy code and make new comparison.

    #33975 quote
    njames879
    Participant
    New

    thanks both.  I’ll try the ideas out.  much obliged for the input

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

Error in back test product


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
njames879 @njames879 Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by njames879
8 years, 10 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/29/2017
Status: Active
Attachments: 4 files
Logo Logo
Loading...