LogoLogo
  • Welcome to AMP Futures (USA) Help
  • Trading Platforms
    • Quantower
      • Shortcuts
        • Overview
      • Getting Started
        • What's new
        • Installation
        • First start
        • Add Exchanges-Symbols
          • Add New Micro Crude Oil (CME) Symbol - MCLE
        • Platform update
        • Backup & restore manager
        • Reset settings to default
        • You have found a bug. What’s next?
      • General Settings
        • Main Toolbar
        • Workspaces
        • Single Panel
        • Link panels
        • Binds
        • Group of panels
        • Templates
        • Set as Default
        • Symbols lookup
        • Table management
        • Setup Actions & Advanced filters
        • Alerts
        • General settings
      • Data-Feed Connections
        • Connection to CQG (AMP Futures)
          • Errors with CQG
      • Analytics Panels
        • Chart
          • Chart Overview
          • Chart Types
            • Tick chart
            • Time aggregation
            • Renko
            • Heiken Ashi
            • Kagi
            • Points & Figures
            • Range bars
            • Line break
            • Volume Bars
            • Reversal Bars
          • Chart Settings
          • Chart Trading
          • Chart overlays
          • Technical indicators
            • Channels
              • Donchian Channel
              • High Low Indicator
              • Round Numbers
              • Highest High
              • Lowest Low
              • Bollinger Bands
              • Bollinger Bands Flat
              • Price Channel
              • Keltner Channel
              • Moving Average Envelope
            • Moving averages
              • Exponential Moving Average
              • FYL Indicator
              • Linearly Weighted Moving Average
              • McGinley Dynamic Indicator
              • Modified Moving Average Indicator
              • Pivot Point Moving Average Indicator
              • Regression Line Indicator
              • Simple Moving Average Indicator
              • Smoothed Moving Average Indicator
              • Guppy Multiple Moving Average Indicator
              • Trend Breakout System Indicator
              • Triple Exponential Moving Average Indicator
            • Oscillators
              • Aroon Indicator
              • Moving Average Convergence/Divergence
              • Awesome Oscillator
              • Accelerator Oscillator
              • %R Larry Williams
              • Momentum
              • Rate of Change
              • Relative Strength Index (RSI) Indicator
              • Commodity Channel Index
            • Trend
              • Average Directional Movement Index (ADX) Indicator
              • Ichimoku Cloud Indicator
              • Directional Movement Index (DMI) Indicator
              • ZigZag
            • Volatility
              • Average True Range
              • Standard deviation
            • Volume
              • Delta Flow
              • Delta Rotation
              • Level2 indicator
          • Drawing Tools
          • Volume Analysis Tools | Volume Profiles | Footprint chart | VWAP
            • Cluster chart
            • Volume profiles
            • Time statistics
            • Time histogram
            • Historical Time & Sales
          • OHLC
          • Power Trades
          • VWAP | Volume Weighted Average Price
          • Anchored VWAP
        • Watchlist
        • Time & Sales
        • Price Statistic
        • DOM Surface
        • Option Analytics
        • TPO Profile Chart
      • Trading Panels
        • Multiple Order Entry
        • Order Entry
          • Algo Order Types
          • OCO (Multi-Level)
          • OCO (Post Fill)
          • Order Types
        • DOM Trader
          • How to setup DOM for Scalping
        • Market depth
        • Trading simulator
        • Market Replay
      • Portfolio Panels
        • Positions
        • Working Orders
        • Trades
        • Orders History
        • Synthetic Symbols
        • Historical Symbols
      • Information Panels
        • Account info
        • Symbol Info
        • Event Log
        • RSS
        • Reports
      • Miscellaneous
        • Symbol Mapping Manager
        • Live Support
        • Market Heat map
        • Stat matrix
        • Exchange times
        • Quote Board
        • Browser
        • Excel and RTD function
          • Changing RTD Throttle Interval in Excel
        • Quantower Telegram Bot
      • Quantower Algo
        • Introduction
        • Install for Visual Studio
        • Strategy runner
        • Simple Indicator
        • Simple strategy
        • Input Parameters
        • Built-In indicators access
        • Custom indicators access
        • Level2 data
        • Access Volume analysis data from indicators
        • Indicator with custom painting (GDI)
        • Access Chart from indicator
        • Using markers with indicators
        • Using Clouds in Indicator
        • Adding a custom indicator to Watchlist
        • Downloading history
        • Access to trading portfolio
        • Trading operations
        • Example: Simple Moving Average
        • Access to advanced aggregations
        • Access to symbol/account additional fields
      • Customization
        • Localization
      • FAQ
        • General Errors
Powered by GitBook
On this page
  • Placing orders
  • Modifying orders
  • Cancelling orders
  • Closing positions
  • Result of trading operations

Was this helpful?

  1. Trading Platforms
  2. Quantower
  3. Quantower Algo

Trading operations

Placing a different type of orders, modifying and canceling them using Quantower API

PreviousAccess to trading portfolioNextExample: Simple Moving Average

Last updated 4 years ago

Was this helpful?

A key part of each strategy is a trading algorithm it implements. In most cases it requires possibilities of placing a different type of orders, modifying and canceling them. In this topic, we will show you how to get access to this operations via .

Placing orders

As we wrote in the previous topic, class is the main entry point for all major functions and placing orders (as well as all other trading operations) are not the exception. The most flexible way of placing orders is using the method, that accepts object as input parameter. This object provides you with more than 15 parameters and using them you can customize your order request according to your needs. It is not necessary to fill all, usually, you will need only main, such as:

Parameter

Description

Account

An account for order

Symbol

A symbol for order

Side

Side of order: Buy or Sell

Price

Price for Limit or Stop Limit order

TriggerPrice

Trigger price for Stop or Stop Limit Order

Quantity

Amount of the order (in lots)

StopLoss

An instance of SlTpHolder object, where you can specify price or offset for Stop Loss order

TakeProfit

An instance of SlTpHolder object, where you can specify price or offset for Take Profit order

OrderTypeID

An ID of required order type. For most cases you will need only basic types, so you can use predefined constants: OrderType.Limit, OrderType.Stop, OrderType.Market and OrderType.StopLimit

And code example of using this method:

Core.Instance.PlaceOrder(new PlaceOrderRequestParameters(){    Account = this.account,    Symbol = this.symbol,    Side = Side.Buy,    Price = this.symbol.Bid - this.symbol.TickSize * 10,    TimeInForce = TimeInForce.Day,    Quantity = 2,    StopLoss = SlTpHolder.CreateSL(20, PriceMeasurement.Offset),    TakeProfit = SlTpHolder.CreateSL(10, PriceMeasurement.Offset),                       OrderTypeId = OrderType.Limit});

Another option to send order request is using the overloaded method, which accepts only basic order parameters. The shortest form will send Short or Long 1 lot position using a specified symbol and account:

Core.Instance.PlaceOrder(this.symbol, this.account, Side.Buy);

You can also add other parameters, for example if you want to place a Limit order just need to specify Price:

Core.Instance.PlaceOrder(this.symbol, this.account, Side.Buy, price: this.symbol.Bid - this.symbol.TickSize * 5)

Or Trigger price for Stop order:

Core.Instance.PlaceOrder(this.symbol, this.account, Side.Buy, triggerPrice: this.symbol.Bid - 5 * this.symbol.TickSize);

Modifying orders

Core.Instance.ModifyOrder(orderToModify, quantity: 5);

If you need to change the price of the order:

Core.Instance.ModifyOrder(orderToModify, price: this.symbol.Bid - 10 * this.symbol.TickSize);

Or, if you want, you can request changing all parameters simultaneously: quantity, time in force, price:

Core.Instance.ModifyOrder(orderToModify, quantity: 5, timeInForce: TimeInForce.GTC, price: this.symbol.Bid - 10*this.symbol.TickSize);

Cancelling orders

Core.Instance.CancelOrder(orderToCancel);

You can use also Cancel method of Order class as an alternative way:

Closing positions

Core.Instance.ClosePosition(positionToClose);

Or method Close from Position class:

If allowed by your current connection, you can request partial closing of position. Both ways of closing positions accept CloseQuantity parameter, which determines an amount that should be closed.

Result of trading operations

All trading operations return special object TradingOperationResult which contains information about the result of the processing request:

Parameter

Description

Status

Success if a request was sent to server or Failure if some problems occurred

Message

Text with detail information in case of errors

Using these set of trading functions you can simply create any algorithm for your trading strategy. In our further articles, we will cover more specific and practical cases, such as specifying parameters for advanced order types and creating universal trading logic, for different connections.

Once you created your order you can modify its parameters - use function in Core class for this. You can specify only parameter you want to change, for example, if you want to change Quantity of order:

As expected there is a function for canceling Order - . All you need to specify is Order object:

The closing of positions is very similar to canceling orders. Use method from :

Quantower API
Core
PlaceOrder
PlaceOrderRequestParameters
PlaceOrder
ModifyOrder
CancelOrder
ClosePosition
Core