//+------------------------------------------------------------------+ //| Broker.mqh | //| Gunther Schulz | //| https://github.com/khramkov/MQL5-JSON-API | //+------------------------------------------------------------------+ #property copyright "Gunther Schulz" #property link "https://github.com/khramkov/MQL5-JSON-API" //+------------------------------------------------------------------+ //| Fetch positions information | //+------------------------------------------------------------------+ void GetPositions(CJAVal &dataObject) { CPositionInfo myposition; CJAVal data, position; // Get positions int positionsTotal=PositionsTotal(); // Create empty array if no positions if(!positionsTotal) data["positions"].Add(position); // Go through positions in a loop for(int i=0; i