Skip to content

Sggin1/ami_dll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AmiBroker Signal Sender Plugins

AmiBroker AFL plugins for sending signals/data to external applications via HTTP or TCP.

Author: sggin1/ak47 - Long-time AmiBroker user & supporter


Plugins Included

Plugin Protocol Use Case
HSend HTTP POST Web services, REST APIs, Flask/FastAPI/Node.js
TSend Raw TCP Lightweight receivers, custom scripts, low latency

Both plugins send to localhost:5000 by default.


Quick Start

AFL Usage

// HTTP - sends JSON payload
result = HSend("BUY,AAPL,100");

// TCP - sends pipe-delimited payload
result = TSend("BUY,AAPL,100");

// Returns: 1.0 = success, 0.0 = failure, -1.0 = no argument provided

Payload Formats

HSend (JSON):

{"timestamp":"143052.123","chartID":1,"payload":"BUY,AAPL,100"}

TSend (Pipe-delimited):

143052.123|1|BUY,AAPL,100

Installation

  1. Download or compile the DLL(s)
  2. Copy to your AmiBroker Plugins folder (e.g., C:\Program Files\AmiBroker\Plugins\)
  3. Restart AmiBroker
  4. Use HSend() or TSend() in your AFL formulas

Building from Source

Prerequisites

  1. MinGW-w64 (GCC 8.0+): https://www.mingw-w64.org/downloads/
  2. AmiBroker Development Kit (ADK): https://gitlab.com/amibroker/adk
    • Download Plugin.h from the ADK repository
    • Place it in the same folder as the source files

Compile Commands

# HSend (HTTP version)
g++ -shared -m64 -w -D_USRDLL -o HSend.dll HSend.cpp -lwinhttp

# TSend (TCP version)
g++ -shared -m64 -w -D_USRDLL -o TSend.dll TSend.cpp -lws2_32

Build notes:

  • -D_USRDLL flag required for proper dllexport
  • Removed unnecessary #pragma pack(push, 2) from source files (TY msm51)

Requirements

  • OS: Windows 7/8/10/11 (64-bit)
  • AmiBroker: Version 6.0+ with plugin support
  • Network: Port 5000 available on localhost
  • Receiver: Your own HTTP server or TCP listener on port 5000

Example Receivers

Python HTTP Server (for HSend)

from flask import Flask, request

app = Flask(__name__)

@app.route('/amibroker_signal', methods=['POST'])
def receive_signal():
    data = request.get_json()
    print(f"Received: {data}")
    return "OK", 200

if __name__ == '__main__':
    app.run(port=5000)

Python TCP Server (for TSend)

import socket

server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(('127.0.0.1', 5000))
server.listen(5)
print("Listening on port 5000...")

while True:
    client, addr = server.accept()
    data = client.recv(1024).decode()
    print(f"Received: {data}")
    client.close()

License

This project is provided as-is for the AmiBroker community.

ADK Notice: Building from source requires Plugin.h from the AmiBroker Development Kit, which is Copyright (C) 2001-2019 Tomasz Janeczko, AmiBroker.com and used under their royalty-free license.


Links

https://github.com/Sggin1/ami_dll

About

Two dll plugin for Amibroker 1) HTTP POST 2) Raw TCP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors