For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
2019-10-02: The community is currently in read-only mode

Extracting Analyzers in bt.anazylzer.Tradeanalyzer() Class



  • Dear BTR-Community and Support,

    I am looking for ways to implement my list of needed analyzers and was wondering, if the following was actually possible in bt.anazylzer.Tradeanalyzer() class, these are the ones i am still hanging on:

    Average Profit per Profit-Trade ( in Cash) & Average Loss per Loss-Trade ( in Cash)

    Max Proftis in Streak ( in Cash) & Max Losses in Streak ( in Cash)

    Max WinTrade ( in Cash) & Max LossTrade ( in Cash)

    Sadly the documentation on this class is weak (no clear syntax for the subclasses etc, just explained what can be done), but ive already checked out the sourcecode on github, so as examples on blogs (but still couldnt get to all needed information)



  • @Bayne really no one?

    If anyone Inderstands how the analyzers can be written it would be a very large help



  • @Bayne said in Extracting Analyzers in bt.anazylzer.Tradeanalyzer() Class:

    really no one?

    I've answered your other question about order sequence, and you didn't pay attention to that answer, asking it one more time in the same thread. What is the point to put an answer here (wich requires some concept building and maybe coding) but you might not even read it?

    Review how the built-in TradeAnalyzer is coded, copy it under different name and make small modifications to adopt new stats.

    TradeAnalyzer is here - github, code is self-explanatory and clean.

    By the way, based on the description built-in TradeAnalyzer already includes average profit and average loss trades as well as max profit and max loss trades.



  • @ab_trader Hey ab_trader,
    Dont worry, i didnt miss your answer. Just voted up now for your answer on the Question about Resampling, thank you.

    I think by "asking it one more time in the same thread." you mean the question asking for what is executed first, TakeProfit oder StopLoss order, when the triggering High and Low Price occour in the same Bar? Nope, sadly became no answer to this question, therefore i'd like ask a third time in the mentioned thread. But my bad if i didnt ask clear.

    "By the way, based on the description built-in TradeAnalyzer already includes average profit and average loss trades as well as max profit and max loss trades."

    I belive you and I sadly cant identify the searched subclassed because i'm a newbie with class architecture.

    I dont just understand the difference between
    - ProfitAndLoss Total/Average
    - Won/Lost Count/ Total PNL/ Average PNL / Max PNL
    - Long/Short Count/ Total PNL / Average PNL / Max PNL
    - Won/Lost Count/ Total PNL/ Average PNL / Max PNL
    - Length (bars in the market)
    - Total/Average/Max/Min
    - Won/Lost Total/Average/Max/Min
    - Long/Short Total/Average/Max/Min

    because all of them sound different to me. Even the duplicate line confuses me.
    What does "Total/Average/Max/Min" mean ? (probably something in relation to barslenght, because its written directly after it and the and the first 3 lines already seem to express the average/min/max profit of a trade...
    but that makes absolutely no sense to me, why should someone check the average, min and maximum bar lenght? (could it be the TradeDuration?)

    I know that PNL means profit and loss, but is that a shortcut or does it really contain the profit and loss in one number (dont see any sense in it (Could it be the final Account-Balance)? Otherwise whats the real subclass adress?

    Could you please bring a little more clear into the description, because its so confusing? (I just need to know about the 3 I mentioned in the question, because i was able to understand all the otherones without a problem)



  • @Bayne said in Extracting Analyzers in bt.anazylzer.Tradeanalyzer() Class:

    I think by "asking it one more time in the same thread." you mean the question asking for what is executed first, TakeProfit oder StopLoss order, when the triggering High and Low Price occour in the same Bar? Nope, sadly became no answer to this question, therefore i'd like ask a third time in the mentioned thread. But my bad if i didnt ask clear.

    Quite clear answer on how bt processes orders was given in that thread.

    Could you please bring a little more clear into the description, because its so confusing? (I just need to know about the 3 I mentioned in the question, because i was able to understand all the otherones without a problem)

    Why not to spend couple hours and run test, obtain all the numbers using built-in analyzer and figure out if it is suitable for your needs or not?

    Returning to your original post: Won/Lost Count/ Total PNL/ Average PNL / Max PNL results should give you values for your lines 1 and 3. Line two is not clear - what do you mean by streak?

    PNL is a profit/loss value: if PNL > 0, it is profit, otherwise it is loss. It can be related to trade or to the all trades.



  • @ab_trader
    My bad, I definetly misunderstood the term FIFO, now everything is clear, thank you

    By "Max Proftis in Streak ( in Cash) & Max Losses in Streak ( in Cash)" i mean
    When maximum winning Streak means, the the maximum amount of winning trades in a row, i am looking for the profit that came up by these trades.

    When maximum losing Streak means, the the maximum amount of losing trades in a row, i am looking for the loss that came up by these trades

    Edit: for the Short side: not to confuse with Drawdown, which also could includes some interruptions



  • @Bayne for streak PNLs you will need to add new code.

    As I mentioned above I would just take the existing code, modify it as required and add as analyzer using bt's common way.


Log in to reply
 

});