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?:
IF c1>c2 THEN
BUY 2 SHARES AT MARKET
ENDIF
IF "little profit" THEN
SELL 1 SHARES AT MARKET
ENDIF
IF c1<c2 THEN
SELL "all" AT MARKET
ENDIF
This is an attempt to compensate for a not trending market, with a trend following system.
Thanks!
Maybe I can use:
myCurrentProfit = STRATEGYPROFIT
?
But if I want to define the profit in points?
Hi 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
tradeprofit=0
if shortonmarket then
for i=0 to countofshortshares-1 do
tradeprofit=tradeprofit+(tradeprice(i)-close)
next
endif
Hi!
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!
It’s due to broker convention limitations actually. This is a must have you are right. I don’t know when it will be available sorry.
Hello
to solve this problem the only Way I found is to run two times the same algorithme with two different take profit …
Hi 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,
This 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.
Nicolas I thought this partial close (x units) objective could be achieved with the floatingprofit code?
Partial 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..