Closing based on profit of all open positions

Forums ProRealTime English forum ProOrder support Closing based on profit of all open positions

This topic contains 10 replies, has 4 voices, and was last updated by avatar Nicolas 2 years, 12 months ago.

Currently, there are 0 users and 1 guest visiting this topic.
View all attachments
Viewing 11 posts - 1 through 11 (of 11 total)
  • #21679

    I was wondering if it is possible to use the total profit or loss as a way of deciding to exit the market or not.

    For example when the total profit of all open positions equals 100 then close all positions for the day?

    I’ve read the blog post about using strategyprofit and graphing an average of that as a variable but as far as I know that only applies to already closed positions, I was wondering if there as a way to track all positions that are currently open?


    Do you mean all positions of all running automated strategies or only of the current one?


    I mean just for the current strategy.

    So for example if the strategy cumulates orders (so there are several positions open at different levels) and the total profit of all positions reaches £100 then the strategy closes for the day


    Do the profit must be already banked or it could be floating profit with trades not closed?


    I mean the floating profit from unclosed trades


    It’s clear now, I have not tested this code snippet, but it should work, tell us if it’s ok: (major part of the code come from the Wing’s code here: )



    Thanks so much Nicolas!

    I’m trying to add this to my strategy now, I will let you know how it goes,just one question, the maths there looks like its right, but I am unsure why we divide by pipsize when working out the floating profit. is the calculation the same for CFDs and spread bets etc?


    The the problem with pro real time close takes as close at the end of the current bar.

    say I have profit 40 gbp or usd sometime during the middle of the of bar

    by the time bar closes profit my vanish and go to zero or -40


    is there any way to reference current price?



    You can always use the “server” trailing stop which operate between bars: SET STOP PTRAILING 10



    Good question rama!

    When we get multi-timeframe (PRT future release) then a conditions to exit with £x profit could run on 1 second TF whereas the main entry and exit conditions can run on, for example, 30 minutes TF … is this how multi-timeframe will work Nicolas … I’m hoping so! 🙂


    Yes GraHal, once I’ll be able to test it myself, I will tell you 😉

    1 user thanked author for this post.
Viewing 11 posts - 1 through 11 (of 11 total)

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