1

I want to show the buy/sell signals that Amibroker generates on my website. I tried lot of things but I couldn't find a solution.

It would be even better if I can stream the charts to the website.

The problem is, I don't know how to access the API of Amibroker.(Do they even have it? It is mentioned in their features page, but have not seen any documentation regarding it).

Then, I am not sure how would I connect that to my web server.

halfer
  • 19,824
  • 17
  • 99
  • 186
cyberyod
  • 11
  • 1
  • 3
  • This post is far from a **StackOverflow promoted MCVE method** of posting the high quality Questions. Text states (*cit.:*) "Do they even have it?...not seen any..." but no evidence about deeper research or code. Update your Question to contain a fully representative MCVE for both the Ami/Web that can reproduce any problem you are asking the Community you to help diagnose and fix. **This is the StackOverflow preferred way** to constructively solve and discuss any kind of MCVE related issues. Anyway, **welcome to this great Community of knowledge** + feel free to contribute in our way forwards. – user3666197 Jul 02 '16 at 18:42
  • Sorry about that, I am kindof new here. I have removed that sentence. The code I tried are irrelavent here as it didn't work at all.(It is not about debugging.) What I need is an overall way on how to do it. – cyberyod Jul 02 '16 at 19:24

2 Answers2

1

Step 0: get the AmiBroker domain knowledge first

This is a point, you can do on your own, investing your own time, sweat and tears, or you can immediately outsource the core knowledge by hiring a domain expert.

enter image description here

If you opt to the former, start with the documentation. Both the software architecture and it's related tools are well depicted there.

enter image description here


Step 1: define your Project goals

Again, this step cannot be skipped. As you expect, one may sketch, polish and maintain one's own Project definition(s) or an outsourced Project Management is available for this sort of composite of {PM|QA|CM}-expertise.


Step 2: start with identified units of functionalities defined in (1)

Here one goes a trivial exporter unit code:

var oAB     = new ActiveXObject( "Broker.Application" );
var fso     = new ActiveXObject( "Scripting.FileSystemObject" );

    Ticker  = oAB.ActiveDocument.Name;
    file    = fso.OpenTextFile( Ticker + ".csv", 2, true );

var oStocks = oAB.Stocks;
    oStock  = oStocks( Ticker );

var Qty     = oStock.Quotations.Count;

for( i = 0; i < Qty; i++ )
{
     oQuote = oStock.Quotations( i );

  var oDate = new Date( oQuote.Date );

  file.WriteLine( oStock.Ticker       + "," + 
                  oDate.getFullYear() + "-" +
                  oDate.getMonth()+1  + "-" +
                  oDate.getDate()     + "," + 
                  oQuote.Close        + "," + 
                  oQuote.Open         + "," +
                  oQuote.High         + "," +
                  oQuote.Low          + "," + 
                  oQuote.Volume
                  );
}
file.Close();
oAB.Quit();

Step 3: Keep walking till you complete & integrate the set goals

It is that easy, once you both know-what & know-how.

halfer
  • 19,824
  • 17
  • 99
  • 186
user3666197
  • 1
  • 6
  • 50
  • 92
1

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.

Sethmo011
  • 575
  • 7
  • 20