Strategyprofit on fixed tp

Forums ProRealTime English forum ProOrder support Strategyprofit on fixed tp

Viewing 15 posts - 16 through 30 (of 32 total)
  • #210307

    How can 1.5% TP be reached if the trade was lost?

    For the next trade to come.

    Then it must be applied toWINNING trades, AFTER a losing one?

    #210524

    How can I explain it what should be coded.

     

    If I lose 1 trade, then the position size should be calculated, which leads to the capital growing by 1% when the take profit of the trade is reached.

     

     

    Example

    Capital = 100%
    1.trade ordersize = 1
    Trade won, capital = 100.2%
    set capital 100.2% to capital 100%

     

    Capital = 100%
    2nd Trade Ordersize = 1
    2.trade won, capital = 100.7%
    set capital 100.7% to capital 100%

     

    capital = 100%
    3rd Trade Ordersize = 1
    3. trade lost, capital = 99.2%

     

    capital 99.2%
    4th trade calculate order size for the 4th trade so that when the take profit of the trade (1.5%) is reached, the capital rises to 101%.
    4th trade lost, capital = 88.9%

     

    capital 88.9%
    5th trade calculate order size for the 5th trade so that when the TakeProfit of the trade (1.5%) is reached, the capital rises to 101%.
    5th trade won, but capital only 99.1%

     

    capital 99.1%
    6th trade calculate order size for the 6th trade so that when the TakeProfit of the trade (1.5%) is reached, the capital rises to 101%.
    6th trade won, capital 100.4%
    set capital 100.4% = 100%

     

    capital = 100%
    7.Trade Ordersize = 1
    ……

     

     

     

    general:
    as long as capital > capital [1] should capital = 100%
    as long as capital < last 100% order size is to be calculated in such a way that with this order size and with reaching the TakeProfit of the trade here = 1.5% the capital rises on 101%.

     

    Translated with http://www.DeepL.com/Translator (free version)

    #210525

    correction

    general:
    as long as capital > last 100%  should capital = 100%
    as long as capital < last 100% order size is to be calculated in such a way that with this order size and with reaching the TakeProfit of the trade here = 1.5% the capital rises on 101%.

    #210527

    Then it must be applied toWINNING trades, AFTER a losing one?

    No … BUT, John by now made it clear. I suppose it is clear to you too now, Roberto ?
    It is the goal to always trade as much in order to get back to a set level (this is the 101% for John).

    Maybe superfluously :

    set capital 100.4% = 100%

    This is now the new base line, as if the Trading System just started. Thus, we act as if we made no profit by resetting all to zero (meanwhile having that 1% in the pocket).

     

    For John : John, IMHO this is nothing for someone who is not involved really apart from finding it great to help others (Roberto) to solve until the end (when it works). This is because it will require numerous if not infinite re-iterations, you (John) always finding new culprits to solve (Roberto always helping).

    In your Martingale-like idea this will be very soon about more protective means, because your backtest will show more and more loss because that is the way it’s setup (please trust me). So my biggest tip I can give you is : First make a strategy which is winning (and recognize that your idea is about Money Management and nothing more) and then apply this system, which is difficult to do yourself (coding stuff and such).


    So … Roberto may come up with something which does what you want. Next it goes way under – which is upon something which is a Strategy (unvisible to us) – which next must be turned into something winning or else it is only extra losing.

     

    Edit : I did not read the “correction” post from John, at composing my previous post.

    #210585

    I came up with this code:

    let me know whether I understood your request correctly, or not.

     

     

    1 user thanked author for this post.
    #210686

     

    Hello Roberto-

    A big thank you for being on the road for me again and doing work.
    It looks quite excellent, but it seems to me to be a bug that I can’t program away. But we are already very close to the solution.

    With lines 28-33 we at myProfit set > 0 the equity to 100%. Clear.

    But we also need to check whether myProfit >0 and the new capital exceeds 100%. We must not set the capital to 100% after each trade won, but only when we have won the trade and the last reached 100% are exceeded!

    I think I have caught all imaginable combinations with the following example.

     

    Example

    Capital = 100%
    1st trade ordersize = 1
    Trade won, capital = 100.2%
    set capital 100.2% to newCapital 100%

    newCapital = 100%
    2nd Trade Ordersize = 1
    2.trade won, capital = 100.7%
    set capital 100.7% to newCapital 100%

    newCapital = 100%
    3rd Trade Ordersize = 1
    3. trade lost, capital = 99.2%
    // do not set to 100%

    newCapital 99.2%
    4th trade calculate order size for the 4th trade so that when the take profit of the trade (1.5%) is reached, the capital rises to 101%.
    4th trade lost, capital = 88.9%
    // do not set to 100%

    newCapital 88.9%
    5th trade calculate order size for the 5th trade so that when the TakeProfit of the trade (1.5%) is reached, the capital rises to 101%.
    5th trade won, but capital only 99.1%
    // do not set to 100%

    newCapital 99.1%
    6th trade calculate order size for the 6th trade so that when the TakeProfit of the trade (1.5%) is reached, the capital rises to 101%.
    6th trade won, capital 100.4%
    set capital 100.4% to newCapital = 100%

    newCapital = 100%
    7th Trade Ordersize = 1
    7th trade lost, capital = 99.5%

    newCapital 99.5%
    8th trade calculate order size for the 8th trade so that when the TakeProfit of the trade (1.5%) is reached, the capital rises to 101%.
    8th trade won, TakeProfit is reached, capital now 101%
    set capital 101% to newCapital = 100%

    newCapital = 100%
    9th Trade Ordersize = 1
    ….

    #210839

    This version seems to be working fine, let me know if some glitches are still left:

     

    1 user thanked author for this post.
    #210898

    Hello Roberto.

    Thank you for your work. Your code unfortunately does not work yet in the sense I wanted. It is hard for me to express correctly and for you it is guaranteed not easy to understand me. Therefore I ask you, that we create the code piece by piece. Maybe the other one from here can help too.

    The task is: We code a money management system for a trading system that works with time stop.

    We first hide everything else. We only want to calculate the position size needed to increase the initial capital in 1% when the trade reaches the TakeProfit of 1.5%.

    Can you code this or is someone else from here trying first.
    (It has time, Rome was not built in a day either. Maybe weekend to weekend. I look in once every 2nd,3rd day).)

     

     

    #210900

    Ok, there you go:

     

    1 user thanked author for this post.
    #210937

    Hello Roberto.
    You did it in seconds! Thank you very much!

    But it is not what you are looking for! Line 15 comes too early!
    We do not check yet whether the StrategyProfit > StrategyProfit[1] is! !!

    No, we want to calculate only first the position size, which is needed to increase the Capital by 1%, if the TakeProfit of the trade of 1.5% is reached.
    It is (first) (completely) irrelevant whether StrategyProfit>StrategyProfit[1] is.

    I am very sorry that we have misunderstood each other so far.

     

    #210941

    StrategyProfit > StrategyProfit[1]  just tells us when 1.5% is reached.

    There’s only 1,5% target profit, why should any profit be less than that?

     

    1 user thanked author for this post.
    #210943

    Because we work with a time stop! Time stop!!

    The takeprofit is reached rather in few cases

     

    #210945

    We work with a time stop, the TakeProfit is not always necessarily reached. Therefore, we would like to develop a money management system that allows us to continuously increase our capital.

    Step 1
    For a first trade we calculate the position size so that when the trade reaches the TakeProfit of 1.5% our capital increases by 1%.

    Step 2
    After this first trade we check if the capital is bigger than the 100% we started with or if the capital has become smaller.

    Step 3 if after the first trade the capital is > capital [1].
    We set the (now new, bigger) capital = 100% capital and calculate the position size for increase of this (new 100%) capital by 1% as in step 1.
    We do this again and again as long as after a trade the newcapital > newcapital [1].
    So as long as NewCapital>NewCapital[1], we set NewCapital= 100% Capital after each trade and start with step 1.

    Step 3 for the case that after the first trade the capital is < capital[1].
    Now it becomes complicated.
    Let’s calculate the position size so that with the next trade when we reach the TakeProfit of the trade 1.5% the capital[1] (!!!) increases by 1%.
    And
    We do this again and again until at some point the nth capital is > the last 100% capital[1].
    Then we set this NewCapital[n] = 100% capital and start step 1.

    Clear?
    Question?

    Can you programm it?

    #210954

    see attached to step 3

    some trades lost in a raw, means some trades below the 100% line in a raw

    #210956

    see to step 3 too

    attached

Viewing 15 posts - 16 through 30 (of 32 total)

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