• Home
  • Products
    • AutoTrader Web
      • Login
      • Product Information
      • User Guide
      • Offers
    • AutoTrader
    • Global Instruments
  • Services
    • Software Development
    • Stock Brokers
    • Freelancers
  • Help
    • Documentation
    • Knowledge Base
    • Blog
    • FAQ
      • AutoTrader Web
      • AutoTrader
  • Login
  • Company
    • About Us
    • Contact Us
    • Terms & Conditions
  • Home
  • Products
    • AutoTrader Web
      • Login
      • Product Information
      • User Guide
      • Offers
    • AutoTrader
    • Global Instruments
  • Services
    • Software Development
    • Stock Brokers
    • Freelancers
  • Help
    • Documentation
    • Knowledge Base
    • Blog
    • FAQ
      • AutoTrader Web
      • AutoTrader
  • Login
  • Company
    • About Us
    • Contact Us
    • Terms & Conditions
home/Knowledge Base/AutoTrader
Popular Search:Getting Started

Orders fired from AmiBroker do not reach AutoTrader

408 views August 17, 2020 stkadmin 1

This problem is mostly faced by traders who are new to AmiBroker programming. They copy code to place orders from sample afl into their own afl. The code looks like below:

if ( LastValue(Buy) == True )
{
	placeOrder(AT_ACCOUNT, AT_EXCHANGE, AT_SYMBOL, 
		"BUY", "MARKET", AT_PRODUCT_TYPE, 
		AT_QUANTITY, buyPrice, defaultTriggerPrice(), True);
}

The problem is that the IF condition written before placeOrder functions might not match with your afl’s buy/sell condition. If you remove if block & just keep the placeOrder function then you will see order being fired every time your strategy runs.

Solution

First and foremost, you need to understand the responsibility:

  • If the placeOrder() function is being invoked from your code, then it is our responsibility
    • In this case, the problem is with AutoTrader
  • If the placeOrder() function is NOT being invoked from your code, then it is your responsibility
    • In this case, the problem is with your strategy code

How to find whether placeOrder*() is being invoked?

If you are new to AmiBroker, please refer to AmiBroker Strategy Debugging. You need to understand that we are API providers, we provide functions & you as a developer need to use them at appropriate places. So the solution is to make sure that the condition inside if block matches your buy/sell condition. You can take developer’s help if needed. This is a development related issue (caused by lack of afl programming knowledge) & it cannot be covered by support. You can also use _TRACE function to print log messages and understand the code execution workflow. See below:

_TRACE("Outside Place Order IF Block");
if ( LastValue(Buy) == True )
{
	_TRACE("Inside Place Order BUY IF Block");
	placeOrder(AT_ACCOUNT, AT_EXCHANGE, AT_SYMBOL, 
		"BUY", "MARKET", AT_PRODUCT_TYPE, 
		AT_QUANTITY, buyPrice, defaultTriggerPrice(), True);
}

if ( LastValue(Sell) == True )
{
	_TRACE("Inside Place Order SELL IF Block");
	placeOrder(AT_ACCOUNT, AT_EXCHANGE, AT_SYMBOL, 
		"SELL", "MARKET", AT_PRODUCT_TYPE, 
		AT_QUANTITY, sellPrice, defaultTriggerPrice(), True);
}

Now check AmiBroker log window (Menu: Window -> Log).

  • Enable both Internal & External Trace Output
  • Check all 3 tabs highlighted below for any signs of error

Use bar replay feature or AmiBroker or run your strategy on live data. Make sure it is being run over a price movement which should generate an order as per your logic (Example, run it over an area where signal is generated.)

If you see the message from _TRACE statement here, then the problem is with AutoTrader. Please report it to our support team. If you do not see anything, then the problem is with your strategy code.

AmiBroker Log Window
AmiBroker Log Window
Tags:AmiBrokerAutoTrader

Was this helpful?

1 Yes  No
Related Articles
  • AmiBroker does not save timeseries data
  • Kite session expired
  • Unable to read license (AT-ERR-004)
  • Previous 2 login attempts to AliceBlue failed (AT-ERR-011)
  • AutoTrader License Error
  • Opening handshake response is not ‘101 switching protocols’
Leave A Comment Cancel reply

AutoTrader
  • Orders fired from AmiBroker do not reach AutoTrader
  • Kite session expired
  • Unable to read license (AT-ERR-004)
  • Previous 2 login attempts to AliceBlue failed (AT-ERR-011)
  • AutoTrader License Error
  • Opening handshake response is not ‘101 switching protocols’
View All 20  
Popular Articles
  • Upstox: Something went wrong
  • User Blocked Contact System Administrator
  • AB1007: Your user id or password is invalid
  • Kite: Invalid CAPTCHA values
  • Login failed: Invalid username or password
KB Categories
  • AmiBroker
  • AutoTrader
  • AutoTrader Web

© 2022 Stocks Developer. All Rights Reserved.