For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

Find out which condition was apart each trade

  • Evening,

    I was wondering there was an easy way to find out all the conditions surrounding a trade. For example; if I set a strategy to only take a position when a fast exceeds a slow MA; is there any way for me to attach that easily to the transaction log, a graph or perhaps a table?

    It would make it phenomenally easier to analyze which things are apart of the "Winners" and the "losers" trades.

  • administrators

    You can of course always access the value generated by an indicator (like a Crossover of fast/slow moving averages) and do whatever you want with it.

    This shows up automatically in the charts and can be automatically logged with a Docs - Writers

  • I would set a list of dictionaries. On each trade opening in notify_trade I would get trade.ref and write all required data as an item (dictionary) to the list. Then at the trade closing I would add trade.pnl using trade.ref as index or reference. At the very end save everything to .csv, open in excel and do whatever diagrams I want. Or transform to pandas DataFrame and play using pandas.

  • Can be actually written as an analyzer. Indicators you want to check can be added as parameters and it will be quite flexible to use with different strategies.

    Just thoughts. :)

Log in to reply