Click here to Login

How to set order type of a trading system programmatically

Updated on 2011-11-08 03:37:11

Share |

Order types can be specified in the "Update Trading System" form by updating the fields just above buy, sell, short and cover rules controls.

Buy using limit order at tomorrow (limit = close)

Here are the trading order types that are available in QuantShare:
Market at open
Market at close
Limit order
Stop order
Stop limit order

To change an order type using QL (QuantShare Language):

- Select "Create trading system using the formula editor" tab
- Type the next lines to associate a limit order to buy signals

SetSimTiming(_Buy, _Limit, 0);
BuyPrice(close * 0.99, 10);

The "SetSimTiming" function allows you to specify an order type to associate with a signal type. Here, we associate limit order type to buy signals. We set "0" in the third parameter to indicate that we want to execute the order tomorrow (signal date + 1).

The "BuyPrice" function allows you to specify the limit or/and stop price of an order. Here, we indicate that the limit price is 1% below the close price and that the order is valid for 10 days only. After this period, the order is automatically removed.

To get the list of available fields in a parameter, click on this parameter then use the CONTROL+SPACE shortcut.

no reviews (Log in)

Other how-to articles

How to get trading orders from a portfolio programmatically

How to optimize the stop limit of a trading system

How to add a metric in the trading system simulation report

How to optimize an indicator in your trading system

How to generate buy/sell signals from a trading system

How to add custom position-based metrics to your trading system

How to optimize the number of positions in a trading system

How to create a trading system

How to debug a trading system using the money management tool

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2024
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Follow us on Google+
RSS Trading Items

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.