Buy 2 shares and sell one with a little profit and one when indicators change
Forums › ProRealTime English forum › ProOrder support › Buy 2 shares and sell one with a little profit and one when indicators change
- This topic has 10 replies, 7 voices, and was last updated 8 years ago by Nicolas.
-
-
04/20/2016 at 11:11 PM #5727
Hi,
If I would want to:
Buy 2 shares and sell one with a little profit and one when indicators change, how can I code that?
Maybe something like this?:
12345678910111213141516IF c1>c2 THENBUY 2 SHARES AT MARKETENDIFIF "little profit" THENSELL 1 SHARES AT MARKETENDIFIF c1<c2 THENSELL "all" AT MARKETENDIFThis is an attempt to compensate for a not trending market, with a trend following system.
Thanks!
04/20/2016 at 11:15 PM #5728Maybe I can use:
1myCurrentProfit = STRATEGYPROFIT?
But if I want to define the profit in points?04/21/2016 at 8:38 AM #5735Hi simon, unfortunaly it is not possible to do partial close of the positions.
About STRATEGYPROFIT, it defines the profit in money but for closed trades, not them actually on market.
If you want to define the profit in points, you can make a loop through all the orders and make an addition of the whole actual profit:
for short position example
123456789tradeprofit=0if shortonmarket thenfor i=0 to countofshortshares-1 dotradeprofit=tradeprofit+(tradeprice(i)-close)nextendif04/21/2016 at 5:45 PM #576305/29/2016 at 2:19 PM #8313Hi!
How comes it’s not possible in PRT to partially close your position?
Many of my “manual” strategies use this, so it’s a bummer if it will never get implemented in ProOrder.Do you have any information if it might be possible in the future?
Cheers!
05/29/2016 at 2:25 PM #831505/29/2016 at 2:45 PM #831705/30/2016 at 12:25 PM #8359Hi there,
Same problem here, my strategy also employs partially closing of positions. I’ve tried to solve this by using a proprietary code for the stop loss and target profit without using the build-in commands “set stop loss” and set target profit”. But this only solves the problem partially since my timeframe of preference is the 1H, the positions don’t get closed at the preprogrammed desired levels due to the fact PRT doesn’t close the position until the nextbar open, so if this level differs a lot from the desired closing level then there will be a discrepancy between real trading and backtesting. This discrepancy becomes much smaller when trading the smaller timeframes.
Regards,
09/03/2016 at 6:04 PM #12637This is unfortunate wanted to forward test a strategy in my demo IG account and then suddenly realised that I could not because my strategy partially closes positions. I find especially with short positions on the SA TOP 40 index to take profits helps a lot in making short trades profitable.
09/06/2016 at 9:01 AM #1270009/06/2016 at 1:03 PM #12709Partial close of positions is only possible in paper trading. When you SELL or EXHITSHORT, every positions on market will be closed. I heard it would be possible in the future with the new IG API, but it’s only a “rumor” for now..
2 users thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on