Capital curve as an indicator?

Forums ProRealTime English forum ProOrder support Capital curve as an indicator?

Viewing 10 posts - 1 through 10 (of 10 total)
  • #222475

    Capital curve as an indicator?

    I have an old problem that I am still struggling with.

    I want to change my long conditions if after a trade my capital is smaller than the highest capital ever reached with this strategy.
    (current capital of the strategy is smaller than the all-time high of the capital of the strategy).

    My starting capital was 10,000 euros.
    My all-time high in capital was 14,700 euros with this strategy.
    After a losing trade, the current capital is 14,100 euros. After another losing trade 13.800, after a third losing trade 13.500 and so on.

    HowI can use the all-time-high in capital as a condition in this way?
    As long as my current capital is less than the all-time-high of my capital, then Longcondition 1
    alternatively
    if my current capital is greater than the all-time-high of my capital then Longcondition 2

    For the all-time-high you could also use the highest capital level of the last 100 trades, so that quite simplified, analogous to an indicator, the code would be (the code is not correct, it should serve to understand my question)

    #222482

    This version is for the highest Equity in ALL trades:

    This version is for the highest Equity in the last 100 (or less, if not yet 100) trades:

     

     

    3 users thanked author for this post.
    #223092

    Hello Roberto.

    Thank you for the coding, that really helps me, if I understood it correctly at all.

    From the 2 offered codes above, I took the first simpler one right away and the Cross EMA 20 over EMA 50 as entry condition.

    As a result, from my understanding, it looks like the following, but no trades are triggered.

    Can you correct my errors?

     

     

     

    #223095

    I think you need to get it going first, so try

     

    1 user thanked author for this post.
    #223196

    Yes, thanks, that works now.
    The code as below now does what it should.

    #223221

    Hello Roberto, hello Grahal, hello et al

    I went back here to pick up the idea that when the take profit of the trade (2%) is reached, the highest capital ever reached increases by 1% at the same time.

    In other words
    In a trading system, we increase the position size so that when the trade reaches its target profit, the highest capital ever achieved grows by 1%.

    This is especially interesting for systems with a time stop (e.g. defparam flatafter = 210000). Here the target profit is not always reached and therefore the highest capital ever reached does not grow by 1% despite a won trade, or a new highest capital ever reached is not even formed.

    Ex.
    maxcapital = 10.000 Euro
    available capital = 8,600 euros
    Position size = 10.56
    Profit in trade = 20 Euro

    The task now is to calculate for the next trade what position size must be traded if the next trade (exceptionally) reaches its profit target and thus the highest capital ever reached grows by 1%.
    target profit trade = 2%
    target profit capital = 1% (12.100 auf 12.221)

     

    The question of this type of calculation has already been raised here and there and also by me.
    https://www.prorealcode.com/topic/again-moneymanagement-calculate/
    https://www.prorealcode.com/topic/strategyprofit-on-fixed-tp/

     

    I have worked through all the links above again and I have come to the following coding.
    But somehow I have the feeling that my coding cannot be correct.
    That’s why I’ve added the code below, including comments.

    The comment should show what exactly I want to get with the lines of code
    With comments marked with “**” I am unsure whether the intended result is get

    So please take my thoughts on board and confirm the code as correct or, more likely, correct it.

    Many thanks in advance.
    For this is no rush.

     

    1 user thanked author for this post.
    #223357

    I think you should:

    1. make the calculations about money management and lot size ONLY when Not OnMarket, to prevent data from being changed while a trade is open
    2. calculate the Capital increase only when STRATEGYPROFIT > STRATEGYPROFIT[1], which means a profit was reached, but only if TIME < the time used with FLATAFTER, or it will not be the real TP that has been reached.

     

    1 user thanked author for this post.
    #223462

    Hello Roberto.

     

    Thank you very much in advance.

    It will take me a little while to get to grips with it. I will be happy to come back.

     

    #223534

    Hello Roberto.

    Thankyou very much again! So many times you still helped me and you do it again and again and again… with heartpiece.
    But here I would like to contradict you – it doesn’t seem correct to me. Or I have misunderstood you again, so please excuse my mistakes.

    To point 1
    that I am in the market with several positions is excluded by cumulateorders = false
    Inserting this condition in the following way does not change anything. (line24, line34)

     +

    To point 2
    I do not see that the condition “Strategyprofit > Strategyprofit[1]” is useful. The additional strategy profit can also consist of 1 euro and does not change the calculation basis. The basis of calculation is the highest capital ever achieved. I would like to increase this highest capital ever reached by 1% via the position adjustment*, provided that the take profit is reached before the flattener.

    The adjustment can consist of an increase after a losing trade or a decrease after a winning trade that does not reach the take profit of 2% in the trade.

    Attached is another picture showing the Maxcapital graph.
    You can see that after the first trade, a new highest ever capital (=maxcapital) was reached. This highest value is now the calculation basis for the next trade. As long as there is no new highest capital, the position size is adjusted to this highest capital ever reached.
    Here in the picture a new highest capital cannot be seen and maxcapital is still a horizontal line, because the take profit in the trade of 2% has never been reached since then. See also the other screenshot.

    Dear readers, please note that this is not about the strategy (crossover 20 over 50) per se, but about money management.
    If there are difficulties in solving this problem, I see that it has not yet been dealt with (conclusively) here on Prorealtime. In this respect, it could make a contribution to the entire community.

    #223568
Viewing 10 posts - 1 through 10 (of 10 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login