Increase position size after certain number of trades

Forums ProRealTime English forum ProOrder support Increase position size after certain number of trades

Viewing 15 posts - 1 through 15 (of 19 total)
  • #73823

    Hi.

    I want to test some ideas but I can’t do the programming. I tried ideas from the forum but still, nothing works the way I want. If anyone can code this it would be great as I can’t figure out how to do ‘it.

    I want to be able to increase the size after each trade regardless of the result and not to depend on the size of the account.

    And, if somehow is possible to increase the size after a certain number of trades it would be even greater. Something like – first 5 trades to have size 1, next 5 trades – size 2 and so on.

    Many thanks.

    #73824

    Topic moved to the ProOrder Support Forum.

    Please try to post in the correct forum to get the best possibility of an answer 🙂

    #73825

    Not tested.

    #73826

    Hi,

    Many thanks for the quick reply.

    It is increasing the size but sometimes there are 4 trades at a certain value while other times there are 6 or 7 trades on the same value. Attached is the list of closed trades.

    I tried your code with a simple strategy:

    Any idea what I’m doing wrong?

    Many thanks.

     

    #73828

    somehow it didn’t take the list of trades last time

    #73833

    It is because you do not have the condition IF NOT ONMARKET in your IF statement. CUMULATEORDERS = FALSE stops more than one position from being opened but if the conditions are met while a position is open then 1 is still added to trade count but no position is opened.

    Try this:

     

    #73834

    Now it’s better but still few things are acting strangely.

    If I start with tradecount of 1 on 5 min chart it starts with a size of 15, with a tradecount of 3 it starts with a size of 5 and it does trade 6 times with the similar quantity.

    The issue will be now the starting quantity, 16 units it’s a little bit too much for my account now.

    However, backtesting looks interesting.

    Many thanks again.

    #73847

    That seems odd. I don’t have my platform open at the moment but will try to test it later when I do.

    I have changed the title of your topic to something more relevant then ‘help needed with code’ to help others forum users to know what is being discussed.

    #73875

    Now it’s live on the demo account, and actually, the number of trades open is correct, it seems that last night I didn’t realize that on the list it shows for each position the open and close of the trade.

    The only problem now is the size, on one minute it started with a size of 24.

    I will do few versions more and let them trade live on the demo to see how they are doing on different timeframes.

     

    #73883

    I’ve run my own tests and I am to be honest completely flummoxed!

    I changed everything and nothing made any difference. I changed your entry condition and from what that told me it appears that the IF NOT ONMARKET is being completely ignored so when the first trade is actually opened the values of PositionSize and TradeCount have already been modified. I think it is a weird bug.

    Unless someone else can come up with a theory I would suggest posting a question in the Platform Support forum with a link to here and also send in a problem ticket to PRT.

    Here is my image using a different entry criteria and it can be seen from graphing positionsize and tradecount that positionsize starts very high and tradecount is already set to 4 even though no trades have previously been opened.

    Screenshot_2-4

    #73886

    What happens with a “defparam preloadbars=0”?

    1 user thanked author for this post.
    #73887

    with a “defparam preloadbars=0” it’s working well.

    Many thanks to all. Now it’s time to see how it’s performing on the live demo accounts.

    thanks again

    #73889

    What happens with a “defparam preloadbars=0”?

    That is a good workaround but surely it should not be doing anything prior to the start time of the strategy and if it is doing something then it shouldn’t be ignoring an instruction in the code?

    #73903

    Sometimes while preloading bars, the strategy is already doing things with variables even if the backtest period has not started, so that’s why you get weird values in your graph window.

    Forcing ProBacktest to not load bars before when the strategy should start can change everything 🙂

    #73905

    Forcing ProBacktest to not load bars before when the strategy should start can change everything

    Maybe we all need to start including that in every strategy just in case then!

Viewing 15 posts - 1 through 15 (of 19 total)

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