Setting the Basket/Combined Profit Target
Forums › ProRealTime English forum › ProOrder support › Setting the Basket/Combined Profit Target
- This topic has 7 replies, 2 voices, and was last updated 6 years ago by David.
-
-
10/04/2017 at 12:47 PM #48188
On IG PRT currently the:
1SET TARGET $PROFIT 10is set for each individual position that is opened within a system and not as a basket/combined positions.
A potential solution for this as suggested by Nicolas (here) is:
123IF ONMARKET THENSELL AT positionprice+10*pointvalue LIMIT // 10pips/10PointsENDIFWhen I had tried this it didn’t work. When I start a strategy it get’s “Rejected”. It’s opens but shortly after it get’s closed with the response from PRT being:
The limit level you have requested is too far from the current market level. The maximum limit distance from the current market level for this market is 9973.350 per point
The IG Markets transaction list showed the positioned opened at 1.32965 – in summary it didn’t work so I tried:
123IF ONMARKET THENSELL AT positionprice+(0.001*pointvalue) LIMIT // 10pips/10PointsENDIFThis seemed to work but still each position was set to hit profit target of 10 pip/point of profit each at a combined level to make it 20pip/point. Then 1 more attempt:
123IF ONMARKET THENSELL AT positionprice+((0.001*pointvalue)/COUNTOFPOSITION) LIMIT // 10pips/10PointsENDIFThis seems to work – hope it’s helpful for others and feel free to make suggestions or improvements.
10/06/2017 at 8:50 AM #48391Thanks David, but while $PROFIT is a target in the money account, the solution you propose is set to exit on points basis.
Also, even with IG, POSITIONPRICE is the whole basket average price of all opened orders on market.
The limit level you have requested is too far from the current market level. The maximum limit distance from the current market level for this market is 9973.350 per point
I must admit that I’m totally lost about this error … still trying to understand where the first code is failing.. ?! Are you on a limited risk account?
10/06/2017 at 9:12 AM #48393Nicolas I guess you’re pointing out that I’m mixing the concept of $PROFIT with PointProfit but at this stage there is no way to set PointProfit and this means when some uses this approach they have to be aware of this and take this in consideration on the instrument they trade and size etc…?
So If you trade EURUSD set it to: SELL AT positionprice+((0.001*pointvalue)/COUNTOFPOSITION) LIMIT
mini = USD $10
standard = USD $100What would be another way to make this work to set an actual SET TARGET $PROFIT BASKET?
I’m not on a limited risk live account (but I did this on a demo which might be limited risk?), regardless I don’t think it is related in this example because how it came up with “9973.350”, and the Order List showed 2.32711 while the actual open price was 1.32965
10/06/2017 at 9:23 AM #48396oh! got it now.. it wasn’t clear to me what you were looking to do at the first glance. Your solution is a good one, another one would be to calculate the basket floating profit and take decision from it:
12//floating profitfloatingprofit = (((close-positionprice)*pointvalue)*countofposition)/pipsize //actual trade gains10/06/2017 at 9:32 AM #48397I have used the floatingprofit but the downside with that approach is that we have to wait for the Bar to Close which is dependent on timeframe to check that the profit target is met and sadly sometimes an opportunity to take profit is missed especially when higher volatility shows because the price moves away by the time the Close happens also floatingprofit can be a slight issue with spread because PRT cannot account for it. Thanks for the suggestion.
02/16/2018 at 5:04 AM #62873I’ve been doing some testing with this code block.
123IF NOT ONMARKET THENBUY 1 CONTRACT AT MARKETENDIFOPTION 1
This will only set the Sell Limit after 1 bar of the trade starting with no Sell Limit set until the 2nd bar1234IF NOT ONMARKET OR COUNTOFPOSITIONS = 1 THEN// 0.001 = 10 points // 0.0001 = 1 pointSELL AT positionprice+((0.001*pointvalue)/COUNTOFPOSITION) LIMITENDIFOPTION 2
This will set the SELL LIMITS based on the SET TARGET pProfit when the trade starts 1st bar and but note if 2 positions are opened it requires 1 bar after the second position has opened to set the basket/combined limit properly because it still keeps SET TARGET pProfit on the 1st position until the 2nd bar of the 2nd position opening. But then the potential issue with this that 2 of the SELL LIMITS are different and 1 might get hit within the bar but the other might not so the system is back to having 1 position open.12345678IF NOT ONMARKET OR Amnt = 1 THENSET TARGET pProfit 10ENDIFIF Amnt > 1 THENSET TARGET pProfit 0SELL AT positionprice+((0.001*pointvalue)/COUNTOFPOSITION) LIMITENDIF02/16/2018 at 8:49 AM #62889How are you increasing your “Amnt” variable? If you increase it each time you open a new position with BUY instruction, then there’s no need to wait until the next bar to know how many positions are opened. Without the whole code, it is difficult to get a complete view of your problem.
02/16/2018 at 9:23 AM #62892The Amnt variable is just
1Amnt = COUNTOFLONGPOSITIONSSo what you’re stating is correct in theory “if you increase it each time you open a new position with BUY instruction, then there’s no need to wait until the next bar to know how many positions are opened.” but it’s not the case in the demo environment. I will provide sample code and I will try to provide a video later to show how it treats the positions.
-
AuthorPosts
Find exclusive trading pro-tools on