Trade
Overview
TT Platform
Description
Task
Browser Access
Description
Task
Videos
TT Desktop
Description
Task
Videos
Reference
Workspace Windows
Description
Task
Videos
Widgets
Description
Task
Preferences
Description
Viewing Market Data
Time and Sales
Task
Reference
Description
Depth
Description
Task
Reference
Market Grid
Description
Task
Videos
Reference
Product Grid
Description
Task
Reference
Spread Matrix
Description
Task
Videos
Reference
Basic Order Entry
TT Order Types
Description
Task
Videos
Reference
Case Studies
TT Premium Order Types
Description
Task
Reference
Order Ticket
Description
Task
Use Cases
Reference
MD Trader®
Description
Task
Videos
Reference
Order Profiles
Description
Task
Reference
Routing Rules
Description
Task
Blocktrader
Description
Task
Videos
Reference
Trading Crypto on TT
Description
Task
Videos
Reference
Trading on B3
Order Management
Order Book
Description
Task
Reference
Floating Order Book
Description
Task
Reference
Fills
Description
Task
Reference
Positions
Description
Task
Reference
Orders and Fills
Description
Task
Reference
Audit Trail
Description
Task
Reference
Audit Query
Description
Task
Reference
Account List
Description
Task
Videos
Reference
Position Manager
Description
Task
Reference
Alert Manager and Alert Viewer
Description
Task
Videos
Reference
Account & User Restrictions
Description
Task
Reference
Balances
Description
Task
Reference
TT® OMS
Care Orders
Description
Task
Videos
Reference
Lock and Release
Description
Task
Bulking
Description
Task
Videos
Stitching and Splitting
Description
Task
Combining
Description
Task
Order Passing
Description
Task
Use Cases
Order Exceptions
Description
Task
Options
Options on TT
Description
Videos
Options Chain
Description
Task
Use Cases
Videos
Reference
Options Trade Monitor
Description
Task
Videos
Reference
Vol Curve Manager
Description
Task
Use Cases
Videos
Reference
Electronic Eye
Description
Task
Videos
Reference
RFQ Viewer
Description
Task
Videos
Reference
RFQ with Counterparties
Description
Task
Counterparty Manager
Description
Task
Strategy Creation
Description
Task
Use Cases
Reference
Options Risk
Description
Task
Videos
Reference
Options Risk Matrix
Description
Task
Videos
Reference
Watchlist
Description
Task
Videos
Reference
Expiration Manager
Description
Task
Volatility Calculator
Description
Task
TT Uncovered 2.0
Description
Task
TT Uncovered 3.0
Description
Task
QuikStrike
Description
Task
Spread Trading
Autospreader
Description
Task
Use Cases
Videos
Reference
Autospreader Rules
Description
Task
Videos
Reference
Hedge Manager
Description
Task
Videos
Reference
Trading in Yield
Description
Task
Use Cases
Reference
Aggregator
Description
Task
Videos
Reference
Algo Trading
Algo Dashboard
Description
Task
Videos
Reference
Template Manager
Description
Task
Order Management Algos (OMAs)
Autotrader
Description
Task
Reference
Videos
Excel integration with TT
Description
Task
Videos
Reference
Market-Making Algos
Analytics
Charts
Description
Technical Indicators
Task
Videos
Reference
Trader Analytics
Description
Task
Reference
ADL
ADL Overview
Introduction to ADL
Description
Task
Videos
Reference
ADL Basic Concepts
Description
Task
Reference
Building your first algo
Lessons
Advanced concepts
Description
Task
Case Studies
Jump blocks
Group blocks
Virtualized blocks
Library blocks
Trading Blocks
Discrete blocks
Arithmetic blocks
Basic blocks
Logic blocks
Miscellaneous blocks
Setup
Setup Overview
Getting Started
Description
Task
Videos
Reference
Supported Order Types and TIFs
Company Administration
Connections
Description
Task
Videos
Reference
Accounts
Description
Task
Videos
Use Cases
Reference
Users
Description
Task
Videos
Reference
Company
Description
Task
Reference
Order Tag Defaults
Description
Task
Account Administrators
Description
Task
TT Premium Services
Description
Task
TT Access
Description
Task
Advanced Features
Description
Risk Management
Risk Administration
Description
Task
Risk Limits
Description
Task
Videos
Reference
Pre-Trade Portfolio Risk
Description
Task
Reference
Order Cross Prevention
Description
Task
Videos
KRM Limits
Description
Task
TT® OMS
TT OMS Administration
Description
Task
Use Cases
Reference
Exchanges: Americas
B3
Description
Task
CBOE
Description
Task
Cboe FX
Description
Task
Reference
CFE
Description
Task
CME
Description
Task
Dealerweb
Description
Task
EBS Direct
Description
Task
EBS Market
Description
Task
Fenics
Description
Task
FMX
Description
Task
FMX_USTF
Description
Task
Goldman Sachs Commodity Blocks (GSCB)
Description
Task
Referece
ICE
Description
Task
MexDer
Description
Task
MIAX_FUT_CH
Description
Task
MIAX_FUT_NY
Description
Task
MX
Description
Task
Nodal
Description
Task
NFI
Task
Exchanges: EMEA
ATHEX
Description
Task
BIST
Description
Task
DGCX
Description
Task
EEX
Description
Task
EPEX SPOT
Description
Task
Reference
Eris
Description
Task
Eurex
Description
Task
Videos
Euronext
Description
Task
GFO-X
Description
Task
ICE_L
Description
Task
JSE
Description
Task
LME
Description
Task
LME NTP
Description
Task
LSE
Description
Task
MEFF
Description
Task
NDAQ_EU
Description
Task
NASDAQ_NED
Description
Task
Nord Pool
Description
Task
Reference
WSE
Description
Task
Exchanges: Asia/Pacific
ABX
Description
Task
ASX
Description
Task
FEX
Description
Task
HKEx
Description
Task
JPX
Description
Task
NSE
Description
Task
NZX
Description
Task
SGX
Description
Task
SGX GIFT
Description
Task
TAIFEX
Description
Task
TFEX
Description
Task
TFX
Description
Task
CoinFLEX
Task
Exchanges: Crypto
Coinbase
Description
Task
Kraken
Description
Task
FIX Support
FIX Ruleset
Description
Task
FIX Sessions
Description
Task
Secondary Accounts
Description
Task
Monitor
TT Mobile
TT Backtesting
APIs
TT REST API 2.0
Getting Started
API Reference
TT REST API 2.0 (UAT)
Getting Started
API Reference
TT .NET SDK
Getting started with TT .NET SDK
Creating the application framework
Working with instruments
Subscribing for market data
More about prices
An in-depth look at the Price class
Working with orders and fills
Handling trade subscriptions
Working with trade subscriptions
Working with Algos
Algo Server
TT Order Types
TT Premium Order Types
Advanced Concepts and Options
Appendix
TT CORE SDK
Getting Started with TT Core SDK
Creating Application Framework
Working With Instruments
Subscribing for Market Data
Working with Orders and Fills
Creating a TT Application Server
Appendix
TT Trade Surveillance
Overview
Using TT Trade Surveillance
Cluster View
Core Models
Market Abuse Models
Cross Product Models
Spoofing Models
Improperly Matched Trade Models
Market Rate Models
Trading Behaviors Models
Miscellaneous Models
Configurable Models
Reports
Wachlists
Reference
TT FIX Services
TT FIX General
Getting Started
FIX Message Structure
Session messages
TT FIX Order Routing
Overview
TT FIX message conversations
Supported application messages
TT FIX Market Data
Overview
TT FIX message conversations
Supported application messages
TT FIX Drop Copy Out
Overview
TT FIX Message Conversations
Supported application messages
Compliance Feed messages
TT FIX Drop Copy In
Overview
Supported application messages
TT FIX Gateway
Getting Started
FIX Message Structure
Components
Session messages
Price Gateway Messages
Order Gateway Messages
TT FIX Recovery
Overview
FIX Recovery Methods
Supported application messages
Compliance Feed Messages
MiFID II Support

Creating the exit order

On this page

In this section, you will create an exit order a number of ticks above the average open price you calculated in the previous Capturing fills data section. The exit order will use the accumulated fill quantity of the entry order as its order quantity and will add a number of ticks to the average open position as its order price.

This section covers:

  • Using Jump blocks to clean up the view of the algo.
  • Using arithmetic blocks to calculate an exit price based on fills data.

Configuring the exit order

To begin configuring the exit order:

  1. From the Blocks panel, drag and place an Order block to the right of the Avg Open Price block.

  2. In the Block Properties panel, make the following changes:

    • Set Name to Exit Order.

    • Set the Side parameter to Sell.

      Notice the block color changes to red, providing a visual indication that the block represents a sell-side order.
      Just like when you added the Entry Order block, adding the Order block caused a number of issues to be displayed in the Problems tab. As you complete your algo, these issues will be resolved.

  3. The Exit Order block needs an Instrument input, so connect the Instrument block output to the Exit Order block’s inst input port by clicking and dragging.

  4. As you can see, using an edge to connect the ports can make the algo look a little cluttered. You can use Jump blocks to clean up the display of the algo.

    • Right-click on the edge you just created, and select Convert to jump from the context menu.

      The edge is replaced by a green source Jump block that is connected to the Instrument block and a pink destination Jump block connected to the inst input port of the Exit Order block, both labeled with the name of the source Instrument block to indicate a connection between the two.

    • Reposition the two Jump blocks for a cleaner look and to leave room for completing the remaining connections to the Exit Order block.

  5. For your algo, you want to use the accumulated fill quantity for the exit order quantity. You will use Jump blocks for this connection as well.

    • Right-click the Fill Qty block’s red numeric output port and select Add jump block from the context menu.

      Notice a green Jump block is added with its label comprised of the block and port name (Fill Qty:accVal).

    • Right-click the Fill Qty:accVal Jump block and select Create destination block from its context menu.

      A pink destination Jump block labeled Fill Qty:accVal is added to the canvas near the source Jump block.

    • Move the destination Fill Qty:accVal block near the Exit Order block and connect it to the qty input port.

Determining the price for the exit order

All that is left to complete your algo is to determine the price of your exit order. You want to set your profit target at three ticks higher than the average open price, but allow the user to change the profit target.

To determine the exit order price:

  1. In the Blocks panel search field, type min and drag the Min Price Increment Field block to the canvas. Then change is Name to Tick Size.

  2. Like the Best Bid Field block you added in the entry logic, the Min Price Increment Field block also needs an Instrument connection. You will again use Jump blocks to connect the two blocks.

    1. Right-click on the green Instrument source Jump block and select Create destination block from its context menu.

    2. Move the new Instrument destination Jump block near the Min Price Increment block and connect the two blocks.

  3. Next, you will use a Number block to specify the number of ticks away from the average open price you want to use for the exit order. Add a Number block to the canvas and set its following block properties:

    • Set Name to Profit Ticks.

    • Set Default Value to 3.

    • Set Variable Type to User Defined.

  4. To determine the price of three ticks, you need to multiply the values of the Tick Size and Profit Ticks blocks.

    • In the Blocks Panel search field, type mult and drag the Multiply block to the canvas and change its Name to Profit.

    • Connect the Profit Ticks and Tick Size block outputs to the Profit block’s inputs.

      Notice the Profit block output shows the value of three ticks for the selected Instrument.

  5. Now you are ready to calculate the price for the exit order.

    1. Place an Add block between the Avg Open Price and Exit Order blocks; then rename it to Exit Price.

    2. Connect the Profit and Avg Open Price block outputs to the Exit Price block’s inputs.

      Notice the Exit Price block output does not show the result of adding the two blocks. Because the Avg Open Price block cannot calculate its values until the algo is running and fills are received, the output displays nan.

    3. Connect the Exit Price block output to the Exit Order block’s price input port.

Your algo is now complete and ready for testing.

Testing your completed algo

The Scalper algo can now be tested to verify that it is behaving as expected. For information on testing an algo, consult the Testing the entry logic section of this series.

To test the algo:

  1. Start the algo to place an entry Buy order at the Best Bid.

  2. When a fill is received, verify that an exit Sell order is placed three ticks above the average open price.

  3. Stop the algo and reset. You should also use the MD Trader to flatten your position.

  4. Increase the value of the Profit Ticks variable and start the algo.

  5. Verify that an exit order is placed at the newly designated number of ticks above the average open price when a fill is received.

  6. Stop the algo.

Conclusion

This basic scalper logic is now complete. From here the scalper’s order blocks can be virtualized so that the Scalper algo can run continuously and maintain position in queue, a stop order can be added to make this algo behave like a bracket order, the entry logic can be edited to make the Scalper algo an Order Management Algo (OMA) – and much more.