what is the proper way to check strategy performance

All posts which do not fit into any other sections of the forum.

Moderator: admin

what is the proper way to check strategy performance

Postby jetaro » Tue Nov 22, 2016 9:17 am

so I have several strategies running, whats the best way to see which are performing well and which are not?

this seems to be a tedious task when there is 30 plus closed positions. I can't easily tell which position was opened by which strategy. Is there an easy way to do this?

Do I need to add some code to the strategy to make it easier?

thanks!
jetaro
 
Posts: 28
Joined: Wed Aug 24, 2016 8:45 am


Re: what is the proper way to check strategy performance

Postby Loggy48 » Fri Nov 25, 2016 2:52 pm

Either (a) write out the results from closed tables into different log files from the different strategies or (b) set the CustomID when opening a trade according to the strategy name, which is copied into the OQTXT field in the closed trades table (the close order CustomID is copied into CQTXT BTW)

It depends on how much coding you want to do but while (a) is easier, you still need to write out the profit from each trade, which you can do to a .csv file direct from the strategy.
Loggy48
 
Posts: 79
Joined: Tue Jun 24, 2014 8:39 am
Location: Manchester, UK

Re: what is the proper way to check strategy performance

Postby jetaro » Fri Nov 25, 2016 10:03 pm

That is so awesome, thanks Loggy that's exactly what I was looking for.
jetaro
 
Posts: 28
Joined: Wed Aug 24, 2016 8:45 am

Re: what is the proper way to check strategy performance

Postby Loggy48 » Mon Nov 28, 2016 7:17 am

Happy to help, @jetaro.

The CustomID doesn't seem to be specified in the online DB order table definitions - it appears as QTXT but you can't set that (get an error if you try) but it is defined in the trades table as QTXT, not CustomID!

You can use it not only to compare strategies by incorporating the strategy name but also to compare the performance for different timeframes, settings etc by adding an appropriate code to the CustomID string. Adding a randomly generated string to the CustomID you can run the same strategy with the same settings etc and ensure that each run will only handle the trades it has started.

If you change the CustomID when you are handling a different sort of request (changing the stoploss for example), this is not percolated althongh the most recent (eg) StopOrderID is included in the trades table, this is not added to the closed trades table and the entry in the trades table will be removed on closing.

Lastly you can copy table entries to SQLITE (sqlite.org) which has a Lua interface. Google "persistent storage site:fxcodebase.com". This has the speed and flexibility advantage that you are storing everything locally do complex SQL calls that will be more compact at least and probably faster than conding in Lua. You don't need mysql or anything as complex - SQLITE is perfectly adequate.

Fun, ain't it?
Loggy48
 
Posts: 79
Joined: Tue Jun 24, 2014 8:39 am
Location: Manchester, UK

Re: what is the proper way to check strategy performance

Postby Loggy48 » Tue Dec 06, 2016 6:24 am

@jetaro - the initiation of the random text should be in a "startup" section of [Ext]Update rather than in Prepare otherwise it *appears* to be called each time and therefore generates a new random string, thus defeating the whole idea! I don't know why - I thought Prepare is only called once.

BTW @Apprentice, @Julia there are quite a few errors in the table definitions.

For example in the Orders table, http://www.fxcodebase.com/documents/Ind ... rders.html, not only is there no QTXT where CustomID is the correct entry, but it is OrderType rather than Type (as in the trades table) and, within that, it is OM and CM for Open/Close at Market. There are probably others throughout the trading tables and it would be useful to sort the entries alphabetically as well.

We all end up finding these out by comparing with the many useful examples of indicators and strategies but perhaps when you have nothing better to do it would be a good idea to check the definitions against the coding. :)
Loggy48
 
Posts: 79
Joined: Tue Jun 24, 2014 8:39 am
Location: Manchester, UK


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 4 guests