display reason entry & exit in the order list

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

    Is it possible in the the orderlist (and the closed positions list?) from a backtest to display why the trade exits if they are custom programmed?

    That would be use-full information, perhaps as an extra column.

    Screenshot-2019-04-29-at-13.37.52.jpg Screenshot-2019-04-29-at-13.37.52.jpg Screenshot-2019-04-29-at-13.38.06.jpg Screenshot-2019-04-29-at-13.38.06.jpg
    #97342 quote
    GraHal
    Participant
    Master

    from a backtest to display why the trade exits

    Sounds good! I’m intrigued.

    What would be an example reason?

    #97346 quote
    Vonasi
    Moderator
    Master

    The reason why a strategy exits is always the same – because your strategy sent an order to the market!

    The easiest way to find out which order is to run a back test version of the strategy which sets a flag every time an exit condition is met and then GRAPH the result.

    c1exit = 0
    
    if longonmarket and c1 then
    c1exit = 1
    sell at market
    endif
    
    graph c1exit

    For pending orders you have to work out if they were hit.

    sell at exitprice limit 
    pendingsellexit = 0
    
    if longonmarket and high > exitprice then
    pendingsellexit = 1
    endif
    
    graph pendingsellexit

    If you use SET TARGET PROFIT then you need to similarly check to see if your exit price was ever hit.

    To make it more accurate you really need to include some sort of spread in the calculations.

    #97348 quote
    Paul
    Participant
    Master

    In the charts I can see why it exits and your suggestion is also nice!

     

    But the purpose for the request is to have it displayed in the orderlist, just like the built-in exit profit/stoplos/trailing are displayed.

    If the strategy has 6 custom reasons to exit, those reasons would be nice to have a name in the orderlist. Not just “exit”.

     

    Although something minor I still thought worth mentioning.

    #97353 quote
    Vonasi
    Moderator
    Master

    But what if you had 100 reasons to exit? What if 50 of these reasons to exit were true at the time of exit? Would they need to add 100 columns? How would they know what conditions were met without you coding something into each strategy to say this is reason 1, this is reason 2…… this is reason 100?

    Often when I code a strategy I will add code that counts how many exits can be allocated to each reason and how much profit each reason would have made. This helps you see how over optimized each exit is.

    Paul thanked this post
    #97383 quote
    Paul
    Participant
    Master

    only one column was needed, or none if it was done like the built-in sl/pt/ts.

    But I see your point! If more exits where true it would be a problem.

    Thanks for the feedback!

    #98042 quote
    Nicolas
    Keymaster
    Master

    What we need is a textual log journal, it would be much easier to debug and understand the orders behavior! 🙂

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

display reason entry & exit in the order list


Platform Support: Charts, Data & Broker Setup

New Reply
Author
author-avatar
Paul @micky75d Participant
Summary

This topic contains 6 replies,
has 4 voices, and was last updated by Nicolas
6 years, 9 months ago.

Topic Details
Forum: Platform Support: Charts, Data & Broker Setup
Language: English
Started: 04/29/2019
Status: Active
Attachments: 2 files
Logo Logo
Loading...