Position buildup on existing order

Forums ProRealTime English forum ProOrder support Position buildup on existing order

Viewing 14 posts - 1 through 14 (of 14 total)
  • #107224

    Hi all,

    I’m having a hard time to figure out a formula for the number of additional contracts I have to buy for an existing position.

    The idea is that each time the index drops 6 points from my last tradeprice (so with a limitbuy= TradePrice – 6) I add long to my existing position with my formula and that when it does I want to have a positionprice <= 10 points removed from the current close.

    My excell formula works just fine but when testing it in Prorealtime I see a slight difference that worsens over time when additional contracts are bought (results between my excell sheet and what prorealtime does are not the same).

    My guess is that I don’t account for the spread I have to pay in my excell formula, hence the difference between the number of contracts I have in my excell table and what the system does in virtual life testing.

    So my formula for buying additional contracts looks like this: (((PositionPrice-TradePrice-4)*countoflongshares)/10).

    This formula works just fine in excell like previously said but fails to come up with the same number of contracts when ran in prorealtime.

    This formula has been/ is being tested with the mini indice CAC40.

    Could you give me some insight/ explanation/ help?

    Much appreciated,

    #107225

    Could it be the difference between the close price that you are using in the calculation and the opening price of the next bar when you actually buy? In other words the gaps.

    #107226

    No, I use a limit order to buy the additional contracts.

    Like I said, maybe I fail to account for the spread I have to pay but then, I don’t know how to change the formula.

    I’ve tried all sorts of tweaking but to no avail…

    #107241

    Spread is not the problem I think as if you place a pending order to buy at x price then you will buy at x price (allowing for slippage). If you wanted to sell immediately then you would find that you can’t at x price any more as the price to sell is x – spread.

     

    #107256

    Well, if it’s not the spread, then I’m at a loss over what could be the issue here!

    I’ll keep looking, unless somebody else has a suggestion?

    #107261

    Maybe a rounding difference between the calculations in your Excel and PRT?

    Try using GRAPH or GRAPHONPRICE to show you the values in PRT for comparison.

    #107271

    Well it’s accurate till a hundredth which is the rounding up PRT applies..

    I’ll try that like you say.

    #107311

    How many bars elapsed since the first order is on market?

    #107323

    @Nicolas: the number of bars that elapsed since the opening of the first order is subject to the market. I can’t say, it’s variable.

    What I can say is that the number or additional contracts calculated by PRT does not change over time. Once calculated, it sticks to the number it has calculated.

    I’m really puzzled…

    #107341

    Do you calculate the new position size BEFORE adding an order? Code is read from top to bottom.

    #107345

    The new position size is calculated at the same time it adds a new limit order.

    So if the very first order has been placed (so on the market), the new position size will be calculated immediately at the next bar, as well as the level at which it will be bought at.

    Code is read from top to bottom.

    #107346

    Did you GRAPH the positionsize calculated? All the variables used and make the calculation by hand? The differences might come from one of the constant/variable that you are using in your formula.

    #107348

    I figured it out I think.

    It does come up with the same results with GRAPHONPRICE.

    Because I was impatient I wanted to test out whether the number of additional contracts would correspond with my excell sheet.

    In order to see this, I bought a random number of contract to get to the positionbuildup in my excell sheet but failed to take into account that 6 contracts bought at the same level and 6 contracts bought at different levels would not give me the same results with my formula, hence the difference.

    #107349

    Many thanks to both of you for the GRAPHONPRICE suggestion.

    Much appreciated!!

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

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