indicator compare price real vs backtest

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #107021 quote
    Paul
    Participant
    Master

    just a test to compare the visual differences real- vs backtest price.

    Even in this case below, when buying higher then in the backtest, I want to maintain its exit-scenario i.e. when backtest gain >= 0.25%. The only way is manual interference.

     

    // dax 1min
    
    once enterdate= 20190909
    once entertime=090000
    
    once closedate=enterdate
    once closetime=155500
    
    // backtest price
    once BTbuyprice=12209.4
    once BTsellprice=0
    
    // real live price
    once RLbuyprice =12215.2
    once RLsellprice=0
    
    // check when trade starts
    if date=enterdate and time=entertime then
    TradeOn=1
    endif
    // check when trade ends
    if date=closedate and time=closetime then
    TradeOFF=1
    endif
    
    if TradeOn then
    if TradeOff=0 then
    if (RLbuyprice>0 and RLsellprice=0) and (BTbuyprice>0 and BTsellprice=0)  then
    BTpositionperformance=((close/BTbuyprice)-1)*100
    RLpositionperformance=((close/RLbuyprice)-1)*100
    Offset=RLpositionperformance-BTpositionperformance
    elsif (RLbuyprice=0 and RLsellprice>0) and (BTbuyprice=0 and BTsellprice>0) then
    BTpositionperformance=((close/BTsellprice)-1)*100
    RLpositionperformance=((close/RLsellprice)-1)*100
    Offset=RLpositionperformance-BTpositionperformance
    endif
    endif
    endif
    
    if TradeOn=1 and TradeOFF=1 then
    RLpositionperformance=0
    BTpositionperformance=0
    TradeOn=0
    TradeOff=0
    Offset=0
    endif
    
    return BTpositionperformance as "BTpositionperformance",RLpositionperformance as "RLpositionperformance", Offset as "Offset %"
    
    #107037 quote
    Nicolas
    Keymaster
    Master

    Sorry I don’t understand, what do you mean exactly?

    #107218 quote
    Paul
    Participant
    Master

    As example, the backtest had 3 trades today and all won. Say the total is 100%. The 3 winning live trades produced 62% compared to the backtest. I wondered how could I prevent such differences.

    Working with % for the breakeven and trailing-stop, it’s black & white and if the real paid price with slippage & spread difference too much from the backtest price it could influence results, in a good or bad way especially in small ranging markets or with big retracements.

    I use excel to compare sometimes the real vs backtest trades and as experiment coded this comparison-indicator. I thought maybe this could be the basis from something more, but it’s not.

    It’s in part unavoidable and more visible in short term trading.

    #107313 quote
    Nicolas
    Keymaster
    Master

    oh ok! I got it. You are right to say that the results may differ a lot when trading on shorter timeframes, especially because of slippage and spread. I’m afraid there is no easy way to simulate it.

    If you are using market orders, you could try using pending stop orders with a random +/- points value around the close.

    #107366 quote
    Paul
    Participant
    Master

    I think it’s an often overlooked issue and I realised that because of a post in another thread.

    Thanks for the tip. I will give it a try!

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

indicator compare price real vs backtest


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Paul @micky75d Participant
Summary

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

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