Position size variable to calculate £ per point

Forums ProRealTime English forum ProOrder support Position size variable to calculate £ per point

Viewing 6 posts - 1 through 6 (of 6 total)
  • #123041

    Hi all, I am very new to PRT coding. I am struggling with the ‘position size’. This is based on the equity of 10,000 and risk of 0.01, giving the max risk per trade. The variable is the number of pips between the entry pice and the stop.

    I would like to divide the max risk per trade by the variable to calculate the £’s per point .
    However the formula i have written PRT does not seem to be returning a variable for the position size.

    Positionsize= round(Equity*Risk)/SL

    Appreciate any thoughts on this. Thank you and please find code attached.

    #123056

    LG Mcgavin – Welcome to the forums. Your topic is strategy related and not indicator related so you posted it in the wrong forum. I have moved it to the ProOrder forum. Please try to post in the correct forum with any future topics.

    #123097

    Hi Vonasi,

    Thank you and my apologies.

    #123123

    You can’t use TRADEPRICE in a calculation for position size. TRADEPRICE returns the price of the last trade whether that is opening a position or closing a position. You can’t know an opening price until you actually have opened a position. You should use CLOSE to calculate your position size and hope that there is not a massive gap to the open of the next candle when your order will actually be filled and then TRADEPRICE updated.

    Also in your code you calculate using SL before SL has a value so on the first run through the code you are dividing by zero.

    1 user thanked author for this post.
    #123155

    I wrote the code below a couple of years ago based on a Van Tharp blog, I had it in a number of my strategies but I no longer use it, hopefully someone can make use of it.  I extended it to do prices in .25 increments, no idea what the constant TF does it came from the original.

     

    2 users thanked author for this post.
    #123230

    Thank you Vonasi that explains why PRT is not returning a value. Auto Strategist thank you for the code above to reference. Cheers!

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

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