• Ask a question
  • Spaces
    • TT® Platform
    • Autospreader®
    • Autotrader™
    • Charting & Analytics
    • Options
    • ADL®
      • ADL Samples
    • RTD
    • APIs
      • TT .NET SDK
      • TT API & XT API
      • TT REST API
    • Cryptocurrencies
    • Topics
    • Questions
    • Articles
    • Ideas
    • Badges
  • Sign in
  • Home /
  • ADL® /
avatar image
0
Question by hasanunsal · Nov 27, 2020 at 03:58 PM · ADL®

exit logic and managing trailing stop

hello all, i ve done my entry logic fine but having problem with my exit logic (please see attached) , which is basically a trailing stop of x ticks away. i ve researched the forum already but i couldnt get it to work.. i think i need to do virtualisation too. if anyone could help that would be much appreciated.. kind regards
hasan unsal

trailing-stop.png (294.4 kB)
Comment
Add comment
10 |1800 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by russelltromans-1 · Nov 27, 2020 at 06:18 PM

Below is a stripped back example of creating a trailing stop that only includes the blocks relevant to explaining the logic.
In the above example I use the Time & Sales block to feed my trailing stop calculation. As I do not wish to consider any data prior to receiving my first fill I have used a branch block to filter the data until I need to use it. The Branch Block references the Value Extractor labelled 'Active' (Formula: 'TRUE') which turns true after the buy order has achieved it's first fill. The Max and Min blocks are formatted to collect the trade data using a formula of '#tradePrice'.

When the first fill is achieved from the buy order a discrete message will be sent containing the fill information from the fills output. A value Injector is then used to inject the fill price into the Trade Price message field. We do this so that the value can be read by our Max and Min blocks down stream. The message then passes through the Max and Min blocks where they will extract your fill price as the trade price and use this as the basis of your trailing stop calculation. The discrete message then passes to the 'Active' Value Extractor which will output 'True'. The 'Active' Value Extractor will output a 'True' for the remainder of the algo, this is referenced by the branch block which will then allow all future trade data to pass through the Max and Min blocks.

I have used an IF THEN block to decide whether to use the Max or Min based on the trade direction. To achieve this I have formatted a Boolean block with a variable type of 'Order Side'. In this configuration the Boolean will output True for OTA algos initiated on the buy side or False for algos initiated on the sell side.Finally I have enable flip for sell on the subtract block to invert the sign should the trade be initiated on the sell side.


t-stop.png (146.2 kB)
Comment
Add comment Show 1 · Share
10 |1800 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image hasanunsal · Dec 02, 2020 at 03:33 PM 1
Share

thank you so much russell much appreciated! took me a while to understand the logic but i do now, all thanks to you. kind regards, hasan

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Community

Ask questions and share ideas about the TT® and X_TRADER® platforms.

First time here? See our Getting Started Guide and FAQs.

Follow

Follow this Question

Answers Answers and Comments

41 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

GeneratorBlock inside virtualised block 1 Answer

Search String on ADL Instrument - Option Underlying and Strike 1 Answer

Value Bucket Update Only on Matching Hole Value 2 Answers

Same Algo/Buy or Sell Entry as Alternative to Flip For Sell Logic 2 Answers

range value store,range 1 Answer

Trading Technologies Home - Legal - Privacy - Contact

© 2017 Trading Technologies International, Inc. All rights reserved.

Powered by AnswerHub

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • TT® Platform
  • Autospreader®
  • Autotrader™
  • Charting & Analytics
  • Options
  • ADL®
    • ADL Samples
  • RTD
  • APIs
    • TT .NET SDK
    • TT API & XT API
    • TT REST API
  • Cryptocurrencies
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Badges