The existence of Promises also means that it's possible to use Javascript
Scripts are automatically run inside an async function. Therefore, it's possible to write code such as the following:
var result = await Framework.pSendOrder({"tradingAction": FXB.OrderTypes.FLATTEN});
Framework.EndScript();
It's not necessary to declare an async function and then pass execution into that:
async function MyAsyncFunction()
{
var result = await Framework.pSendOrder({"tradingAction": FXB.OrderTypes.FLATTEN});
Framework.EndScript();
}
MyAsyncFunction();