Hi Team, I wonder if it is possible to close a trade automatically at a certain time, or after a certain time when the trade is openend after price hitting a stop order or is manualy opened?
If this is posible, can somebody teach me where to find this ordertype or how to code this?
Thank you
It is not possible to mix manual and auto trading. If a position is opened in an auto strategy then you can either close it manually or automatically. If a trade is opened manually then you can only close it manually.
If you want to open a trade in an auto strategy you can then check if price has dropped to or below a stop level and then set a flag so that you know it has done this. You can record the barindex or time when this occurs and then you then just need to count how much time has passed and/or check if a certain time is achieved and that the flag is set and then close the trade and reset the flag.
Something like this (not tested):
if (your long conditions) then
buy 1 contract at market
stopprice = close - 100 //set initial stop level
endif
if onmarket and not flag
stopprice = positionprice - 100 //set more accurate stop level
if low < stopprice then //stop level hit
flag = 1
myindex = barindex //record bar that stop hit
endif
if flag and barindex = myindex + 24 then
sell at market
flag = 0 //reset flag
endif
It is not possible fdor ProOrder to close trades opened/modified manually.
You can certainly close automatic trades opened at anytime, after N bars or at a specif TIME (and DATE, eventually) or when a price is hit.
Since all strategies are executed when a bar closes, you may need to use the MTF support to use a lower TF to be more accurate.
If your strategy runs on a 4-hour or Daily TF you can use a 1-minute TF to close/update that trade.
edit: Vonasi is superfast!!!
edit: Vonasi is superfast!!!
Marcel had to wait 44 minutes for my reply and 59 minutes for yours – I think we both need to up our game!
JackParticipant
Junior
Hello,
Can we do a stop loss or take profit on a portion of a position with the new prorelatime V11 ? (partial position closing)
Thanks
Jack
Can we do a stop loss or take profit on a portion of a position with the new prorelatime V11 ? (partial position closing)
Whether we can do this in live automatic trading or not is purely the decision of the broker. IG do not allow partial position closing at the moment and so we will all just have to wait until if and when they decide to allow it. The PRT platform is able to function already with partial position closing in back tests but if we put any strategy live it is not allowed as we are then trading both demo and live using the brokers server which does not allow it.
wait until if and when they (IG) decide to allow it.
Seems daft / not logical (not allowing) as we can do partial closures when manual trading with IG.
JackParticipant
Junior
What about with Interactive Brokers account + PRT ? are partial closing possible ?