Hello, yes it can be coded. But the point 4 is not possible, since positions cannot be half-cut.. partial closing is currently not possible with IG. There are no problem to code point 1 to 3 though! 🙂
This is also an usual question/request, like many others things : hard trailing stop, stoploss from indicator, etc.. Maybe I should make a code snippets library .. but I don’t know well how to add it on the website for everyone to be clear.