Skip to content

PowerShell

Works in Windows PowerShell 5.1 and PowerShell 7.

All examples assume the EA is running on the same computer with default ports. Order examples are for demo accounts.

Terminal window
$api = "http://127.0.0.1:81"
$q = Invoke-RestMethod "$api/v1/quote?symbol=EURUSD"
"{0} bid {1} ask {2}" -f $q.SYMBOL, $q.BID, $q.ASK
Terminal window
$cal = Invoke-RestMethod "$api/v1/calendar?from_date=2026.10.26 00:00:00&to_date=2026.10.31 23:59:59&currency=USD"
$cal.EVENTS | Select-Object TIME, EVENT_NAME, EVENT_IMPORTANCE, ACTUAL_VALUE, FORECAST_VALUE, PREVIOUS_VALUE |
Export-Csv calendar.csv -NoTypeInformation
Start-Process calendar.csv
Terminal window
$list = Invoke-RestMethod "$api/v1/order/list"
foreach ($p in $list.OPENED) {
Invoke-RestMethod -Method Post "$api/v1/order/close?ticket=$($p.TICKET)"
}