Simple Event for Position Open, Modify, Close?

 

Hi all,

Hoping you can help a newbie out here!

I'm trying to get some basic events fired off to a DLL I'm building for when a Position is Opened, Closed, and Modified, but its all pretty foreign to me, and it seems as though there isn't an 'easy' way to do it!

From what i'm reading, I _think_ need to use the TradeTransaction() event, and then check the action codes for for the Orders/Deals and somehow piece all of those together to assume my position? But when running some tests, the TradeTransaction runs off a lot of low level commands which I think i need to piece together to assume my position?

I've found some script to get all current positions, and thought maybe I just check the current positions every Tick, but thats not too elegant! 


Just wondering if i'm on the right track here before I waste days on end and half a head of hair! Or if anyone has come across a nice snippet of code that does this? Like the CTrade set of scripts?


Thanking you for any nuggets of wisdom here..


Cheers,


Andrew

 
Why complicate your EA? DLLs can not trade, they can't be used on most VPSs. Why write in two languages. Just learn the language.
 
William Roeder:
Why complicate your EA? DLLs can not trade, they can't be used on most VPSs. Why write in two languages. Just learn the language.

Couldn't agree more.. I am learning the language, but for speed, and for code re-use, i'm using a DLL as I use the same functions for cTrader... 

So for now, i'm trying to learn how to get the basic current status of positions for the DLL, and over time, as I become more confident, will move into this. Last thing I want to do is have the complication of DLLs, it does make things a messier... agreed.

Any help you can provide will be greatly appreciated! .. No biggie though, will figure it out at some stage! 

Reason: