From AFL, you can create a text file whenever your code fires a signal. For example:
for(i = 0; i < BarCount; i++)
{
if(Buy[i])
{
//create text file code here using fputs
}
}
With regards to the API, there are two ways given by Amibroker to access the API. The first is the COM object mentioned above. You can access it directly in AFL, though it's not recommended - AmiBroker COM documentation. Using COM directly, I can't see how you can export signals generated, there doesn't seem to be a function related to getting signals from AFL.
The second is the ADK. You can write a C++ plugin (it'll go in the Amibroker plugin folder, and from there you can call the C++ method/s from within your AFL code). The advantage of this solution is you can write your AFL code in C++, and send trades from there. I've used the ADK before, it's not terribly difficult, but in the end, I decided to go another route.
Another option is to access the COM objects from external code from languages that support it by passing information to a DLL, same as the ADK solution, except, if you're not keen on C++, you can use whichever language you choose that has COM support. I use this option. In my AFL code, I have something similar to the following, where I'll call a C# dll and pass it the relevant arugments. From my C# code, I use REST to send the trade to MetaTrader.
for(i = 0; i < BarCount; i++)
{
if(Buy[i])
{
SendTrade(args);
}
}
I've given a previous answer on how to do this.
https://stackoverflow.com/a/37097609
There are other solutions you can use that pretty much work in the same way as the third solution I gave. I know people have created similar solutions in different languages, such as Java, Python, Ruby, etc. For C#, you can look at DotNet for Amibroker. He's ported the ADK into C#. It's paid. Another is AmiBroker .NET SDK. He's done the same thing as DotNet for AB - porting the ADK to C#, but his solution seems more suited to Data plugins. I could never get it to work for me.