Backtest optimization

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #191407 quote
    cgalasso
    Participant
    New

    Hi, I am trying to figure out the best use of backtesting … by my experience
    – when I use optimization variables (with ranges or fixed values), tick-by-tick setting is ignored
    – when I integrate the same variables in the code, tick-by-tick setting is taken in consideration
    am I doing something wrong? or is there a way to do optimization with tick-by-tick setting?
    Thank you !

    #191413 quote
    PeterSt
    Participant
    Master

    Just tick that box (always !!).
    🙂

     

    PS: Because that is so obvious … I know there is a situation that this checkbox does not show. But I forgot the situation …

    image_2022-04-08_113615.png image_2022-04-08_113615.png
    #191415 quote
    cgalasso
    Participant
    New

    Thank you Peter

    attached you see twice the same strategy once with optimization variables and the same strategy with the variables in the code.
    can it be, that there is a limitation in backtesting, this strategy combines Stop order for entry, stop loss and take profit, when entered

    SELLSHORT AnzLot SHARES AT SellLimit STOP
    set target pProfit AnzZiel
    set stop pLoss AnzLoss

    so it can happen, that entry an stop loss exit happens in the same 1h bar

    Screenshot-2022-04-08-114443.png Screenshot-2022-04-08-114443.png
    #191422 quote
    PeterSt
    Participant
    Master

    There is no limitation in Backtesting regarding this, but you MUST always imply Tick by Tick mode (your first curve shows exactly what happens when this is Off and indeed because of more than one trade in a bar). If you can’t find that checkbox then it depends what part of the system will run and whether that has Tick by Tick internally On or Off.

    In Live it will go wrong if you are careless about the proper backtesting regarding this. This is not related to the variables being in the code or as Optimization Parameters.

    ALWAYS watch the rightmost column in the Optimization Result list. If that does not show 0 (like in my example) the trades happens differently than backtesting shows. Backtesting will show super optimistic (like your second half of the screenshot) while the opposite is the result (first half).

    On a side note : your real result will be what the 2nd half shows. So you have some work to do.
    Hint : Your trailing/pending order does not survive your bar length. Thus the distance it too short.
    … so much for your profitable strategy … 🙁
    😉

    #191425 quote
    cgalasso
    Participant
    New

    Thank you Peter for your detailed answer.
    I absolutely understand and fully agree on what you explained
    … the strange thing is, that in fact the tick-by-tick flag is set in both cases … and results are so different

    I mean this is the only flag to set right? or is there another config to set?

    Screenshot-2022-04-08-135426.png Screenshot-2022-04-08-135426.png
    #191427 quote
    PeterSt
    Participant
    Master

    Haha, it is even more confusing than you think;

    What’s done under the hood (IIRC this also happens when you start PRT and have a Strategy running on your instrument(s) is that in that case Tick by Tick is switched off by PRT (this is a sheer bug). In that case, nice profit shows. Thus, when it does it wrongly (tick by tick mode is off), the wrong result shows and this result is infinitely better looking.

    So there is one devise only : Look explicitly at results with Tick by Tick  On (this means start it from the Editor and *NOT* from what you see below !!) and improve on the now poor results. The motto : you can do it. 🙂

    image_2022-04-08_140304.png image_2022-04-08_140304.png
    #191429 quote
    cgalasso
    Participant
    New

    Thank you, Peter, for for the detailed explanation !
    yes, this seems to be really tricky !

    #191432 quote
    PeterSt
    Participant
    Master

    really ticky

     

    🙂

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

Backtest optimization


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
cgalasso @cgalasso Participant
Summary

This topic contains 7 replies,
has 2 voices, and was last updated by PeterSt
3 years, 10 months ago.

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