
Re: Create Automated Trading System
Hi, sorry I missed the part regarding separate application.
OK, so if you have your own separate application you can go 2 ways.
1. Do some form of remoting/communication to have the OFxP and your application working together, similar to what bolo suggests. This will require more work and is possible (there are a few ways to do it).
2. Have you application logic running inside the OFxP.
There are a bunch of classes that do the trading, and PlatformManagedExpert does "wrap" them, to allow for a more simplified creation of expert.
What I guess you need to know is that each expert is run inside an "ExpertHost" that servers as its "SessionManager". So the expert can query its SessionManager to get all the possible SessionInfo's and create Expert Sessions with them. Now the process of creating sessions with the Session Manager is as follows:
[see IExpertSessionManager]
- Get DataSources
>> ArbiterClientId[] DataSources { get; }
for the selected Data Source get running Sessions:
>> SessionInfo[] GetSourceSessions({pass here the Id the of the source})
- Get Execution Sources
>> ArbiterClientId[] ExecutionSources { get; }
for the selected Execution Source get running Sessions:
>> SessionInfo[] GetSourceSessions({pass here the Id of the source})
When you have selected the proper Data Source and Execution Source you need, and the SessionInfo that they share (must both support the same Session), create an expert session:
>> ExpertSession CreateRemoteExecutionSession(ArbiterClientId dataProviderSourceId, ArbiterClientId? orderExecutionerSourceId, SessionInfo sessionInfo);
Once you have created the Session, you can access it also from here:
>> ReadOnlyCollection<ExpertSession> Sessions { get; }
Now your ExpertSession contains Data Provider and Order Execution Provider. Use the first to obtain the data (there is events inside for ticks etc), use the second to Execute Orders.
An expert may have many ExpertSessions and thus operate on multiple trading couples, brokers, etc. at the same time.
---
It is not mandatory to do this process, of creating expert session, by expert code, since there is UI that can allow to do all this by hand. This UI is used inside the ManualTradeExpertControl UI component, and applies the "CreateExpertSessionForm". So if you want to manually create a session for your expert, just create this form like this is done in the ManualTradeExpertControl class. It will take care of creating a session for you, and then your expert can directly use the created session.
Also I will not lay one more line of code before I put a wiki page on how all this is done and why, so that I do not need to describe it all again...
