Help with position size calculation

Forums ProRealTime English forum ProOrder support Help with position size calculation

Viewing 8 posts - 1 through 8 (of 8 total)
  • #104609

    Ok, so in the previous post I though I had resolved the issue, but I hadn’t.

    Im trying to understand how PRT calculate position size based on the following code. This is an example with a recent trade take on SP500.

    here are the parameters:

    Here is the position size function with Nicolas wrote in his blog

    This gives me a value of 0.7

    which is then passed to the Buy command

    In the backtest given the above parameters this opens a position of 224 per point which is insanely large! I have no idea where it is getting this number from. The value should actually be 70 = 70 * StopLossS (5.95) = 419 = 1% of equity.

    Can anyone explain to me what Im doing wrong here and why PRT is opening such large positions with the above code?

     

     

     

     

    #104631

    How could that work?  You cannot assign values to PointValue and pipsize, since they are system constants.

    Moreover pipsize is 1, not 0.01.

    #104633

    With this code:

     

    you can see the values retained, using GRAPH.

     

    1 user thanked author for this post.
    #104655

    Thanks Roberto. I was not aware that I couldn’t assign values to the constants. I used to programming in R where you can do just that and have a console that allows you to check each calculation the the code is making. For the S&P500 I used the information in the attached screen shot – where ‘tick size = 0.01’ (which I assumed to be equivalent to ‘pip size’) and ‘point size = 1’ which I assumed to be equal to ‘PointValue’ in the code.

    The screenshot you put up show the position size function is calculating the correct position size – so I cannot understand why in some instances I get positions being opened with up to 3x the designated max risk. Attached also is a screenshot from yesterday of the code opening a position on the DAX – note the Stoploss implies a risk of the £1500 with an account size of £36000 – this is a lot more than 1% risk. Obviously its not possible to trade this outside of demo until these kinds of glitches can be understood. In your experience with trading with algos on PRT are these kinds of inconsistencies typical?

     

     

    #104659

    Well… in the past there were more errors/inconsistencies using DEMO accounts with IG. Recently some have been worked out but still some reamain.

    You’d better address PRT/IG typing Ctrl+M from the platform.

    #104696

    Hi Rodger Dodger,

    your code and your sample calculation do not match, I think.

    The value should actually be 70 = 70 * StopLossS (5.95) = 419 = 1% of equity.

    So, 70 = 419 and how does this match your code?

     

    #104710

    Im not sure I follow Derek.

     

    If I have a stop of 5.95 points then I should be opening a position of 70 per point which would lead to 419 loss which is equal to 1% of total equity. If you remove the pipsize multiplier at the end of the position size function you get 70.

     

    I thin that the position size function is working correctly and the problem is with either PRT or IG as on rare occasions I will get a position opened that has >3x the designated max risk. I have contacted IG and they in conjunction with PRT are looking into it. I will update on here when/if a solution is reached.

    #104783

    If possible can you post the full code plus a screenshot from when that trade occured in the backtest? It should be possible to reproduce this result.

Viewing 8 posts - 1 through 8 (of 8 total)

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