Issue with Inconsistent Backtesting Results

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #224097 quote
    hamidrm
    Participant
    New

    Hello

    I’m not sure what I’m doing wrong, as I’m not getting the expected entry in trades with this platform. Below is part of a larger strategy, but I’ve trimmed the code to simplify troubleshooting. If you notice, when the price touches the short moving average during a downtrend, the trade is not executed as expected. Please see the attached file. This is just one example among many occurrences. The platform’s time is set to UTC+1. Asset is US Crude $10 in 4Hrs time fame. The strategy involves executing a sell entry position when the long moving average is above the short moving average, and the price touches the short moving average. This should be done with a fixed stop loss and profit target

     

    defparam cumulateorders=false
    //////////////////////////////////////////Short Position Condition///////////////////////////////////////////
    
    MAS=ExponentialAverage[15](close)
    
    MAL=ExponentialAverage[55](close)
    
     
    IF MAS[1]<MAL[1]  THEN
    condition1Short=1
    ELSE
    condition1Short=0
    ENDIF
    
    
    
    IF ABS(High-MAS)<10*pipsize THEN
    priceTouched1=1
    ELSE
    priceTouched1=0
    
    ENDIF
    
    
    //// Conditions to enter short positions
    IF NOT ShortOnMarket AND condition1Short AND priceTouched1  THEN
    SELLSHORT 1 CONTRACTS AT MARKET
    SET STOP PLOSS 100*pipsize
    SET TARGET PPROFIT 100*pipsize
    ENDIF
    
    US-Crude-10.jpg US-Crude-10.jpg
    #224102 quote
    GraHal
    Participant
    Master

    Without seeing Cursor Details showing actual values how can we be sure ABS(HighMAS)<10*pipsize and is not > 10*pipsize on the bar inside the red ring?

    #224122 quote
    hamidrm
    Participant
    New

    @GraHal, correct me if I’m wrong, but in a backtesting environment, does the ProRealTime engine process data in CSV format, including open, close, high, and low prices, without executing trades minute by minute or tick by tick within the current candlestick?

    #224125 quote
    GraHal
    Participant
    Master

    Code on any / all Timeframes (TF) is read and executed at the end of each bar.  Trades are opened / closed at the open of the next bar.

    On a 4 Hour TF the conditions which exist at the end of 4 hours re HLOC are what would open / close a trade etc.

    If you want minute by minute execution then you would need to use a 1 minute TF or multi-timeframe (4 hour and 1 min)

    If above does not answer your question then please elaborate / ask again?

    #224185 quote
    hamidrm
    Participant
    New

    Thanks all good,

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

Issue with Inconsistent Backtesting Results


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
hamidrm @hamidrm Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by hamidrm
2 years, 2 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/22/2023
Status: Active
Attachments: 1 files
Logo Logo
Loading...