Make 2 positions into 1

Forums ProRealTime English forum ProOrder support Make 2 positions into 1

Viewing 7 posts - 1 through 7 (of 7 total)
  • #115507

    Hello,

    What i would like help with is if my system opens up X amounts of positions i want them all to count as 1. Meaning when all of the positions is = to X amount of + pips/$  i want it to close all open positions.  The problem i have atm is that my system closes one of  the positions as soon as it hits TP and dont care if there is more then 1 position open.

    this is what is what im using atm to close my open positions if there is more then 1 open;

     

    #115514

    All open positions are always closed at one time. Whenever you place a SELL order ProOrder closes all positions in live trading, while ProBackTest allows closing partial positions.

    In case of multiple open positions there can only be one SL and one TP.

    #115516

    marcuscn – Please use the ‘Insert PRT Code’ button when posting code to make it more readable. I have tidied up your post 🙂

    Your code will close all positions at the close of a candle if price is extrapips above your average entry price. To close mid candle you need to calculate your desired exit prices for TP and SL and use LIMIT and STOP orders. Your code cannot know what your average entry price is until the close of the following candle which might lead to some issues however. You need to send these STOP and LIMIT orders every candle as they only last for one candle before being cancelled.

    Example for long positions:

     

    #115533

    thanks. this should work?

     

     

    #115537

    That will work as long as you are happy to close any long position only at the close of a candle. If you want to close mid candle then use my previous suggestion.

    #115538

    Okey, well i dont have a tp only trailing. But when i use ur code to close it dont work at all, maybe u can help me. I use this;

     

    #115552

    How you have coded it will not work in the candle that the position is opened on as there is no value for POSITIONPRICE when the decision to enter is made and if you add to a position then the new value for POSITIONPRICE is not known until the next candle is closed. To overcome this you have to assume that the open of the next candle is the same as the close of the candle where the decision to buy is made and place a pending limit order at the same time as you enter based on this value. Then use the actual POSITIONPRICE once it is known at the close of a candle when you are actually on the market and not looking to buy again.

    Something like this (not tested):

     

     

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

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