Support Board
Date/Time: Mon, 25 Nov 2024 01:38:57 +0000
[Programming Help] - How to exchange position info with Ctrader (C#)
View Count: 228
[2024-04-15 18:32:07] |
tomas262 - Posts: 141 |
I am trying to connect to CTrader platform - that is transfer Long / Short / Flat positon information from ACSIL study Would you suggest the simplest way to exchange that info with C# code (ctrader)? Both platforms are running on the same Windows station. My amateur idea is to share information via some local file stored. Is that fast enough (write c++ / read c#)? I believe there are simple and better ways that this Thank you very much for giving a hint what to study Date Time Of Last Edit: 2024-04-15 18:38:53
|
[2024-04-15 21:30:59] |
tomas262 - Posts: 141 |
For now solved this simply by this code s_SCPositionData PositionData;
int posResult = sc.GetTradePosition(PositionData); if (lastPositionData == -1 || lastPositionData != PositionData.PositionQuantity) { // Write values to a file // Open a file for writing std::ofstream outFile("position_data.txt"); if (!outFile.is_open()) { std::cerr << "Failed to open file for writing." << std::endl; return; } // Write position quantity to file outFile << PositionData.PositionQuantity << std::endl; // Close the file outFile.close(); lastPositionData = PositionData.PositionQuantity; } lastPositionData is a int persist var so the value is written into the file only when a change happens on the Ctrader side I simply use StreamReader executed OnTick() to check the value and open a corresponding position Date Time Of Last Edit: 2024-04-15 21:31:41
|
To post a message in this thread, you need to log in with your Sierra Chart account: