backtest error using Pivots

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #116672 quote
    ullle73
    Participant
    Senior

    Hi, im using this code to take the crossover/under R1/S1-pivots. Using standard setting (High + Low + Close)/3.

    But if you look at the attached picture, you can see it takes a pos waaaay before even reaching the R1.

     

    Anyone know why?

     

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    // Conditions to enter long positions
    indicator1 = 2*((DHigh(1) + DLow(1) + DClose(1))/3) - DLow(1)
    c1 = (close CROSSES OVER indicator1)
    
    IF c1 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    // Conditions to enter short positions
    indicator2 = 2*((DHigh(1) + DLow(1) + DClose(1))/3) - DHigh(1)
    c2 = (close CROSSES UNDER indicator2)
    
    IF c2 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    // Stops and targets
    SET STOP pLOSS 9
    SET TARGET pPROFIT 12
    
    #116676 quote
    GraHal
    Participant
    Master

    No Image attached

    #116678 quote
    ullle73
    Participant
    Senior
    #116680 quote
    ullle73
    Participant
    Senior

    weird how i attached it two times without it showing, well there it is 🙂

    #116686 quote
    GraHal
    Participant
    Master

    Have you tried using Cursor Details to analyse / compare price levels and Indicator Levels?

    It appears to be entering trades correctly (Close is > Indicator 1)  … see the re arrow heads on attached.

    Ull.jpg Ull.jpg
    #116688 quote
    GraHal
    Participant
    Master

    Here’s a Short … all looks good??

    Ull-2.jpg Ull-2.jpg
    #116706 quote
    ullle73
    Participant
    Senior

    well, yes, some trades it gets right, but look at my picture, you can see it takes the trade way off the line? not even close to the line

    #116722 quote
    Vonasi
    Moderator
    Master

    Use GRAPH to plot the value of your pivot calculation to compare with that of the indicator on your chart.

    I note that you posted on a Monday so your strategy pivot calculation will be using the Sunday data for its calculation which will mean that the lines are very close together. Perhaps the indicator on the chart is using Friday data?

    #116723 quote
    Nicolas
    Keymaster
    Master

    Sunday data or not (as Vonasi said). Custom trading hours on your chart? OHLC instruction with a “D” (Dclose, Dlow, ..) use real (official) and standard market hours for the instrument, not the custom ones displayed on your chart.

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

backtest error using Pivots


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
ullle73 @jonas_rydqvist Participant
Summary

This topic contains 8 replies,
has 4 voices, and was last updated by Nicolas
6 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/13/2020
Status: Active
Attachments: 3 files
Logo Logo
Loading...