• 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 anonymouswhistleblower08 · Nov 25, 2020 at 07:23 AM · ADL®

Auto restart

Hi All, Have searched toe forums far and wide but unable to find the logic/method i require.

I have a basic ADL skill set at the moment and am self learning.

I have created a basic algo that if the Bid/Ask spread is greater than 1, i will offer the choice price if the offer is larger than the bid and vice versa for bids. If Equal nothing happens.

Once/if filled, the algo then works a tick or scratch if market moves.

I am wondering how to get the algo to repeat this process automatically for an indefinite amount of time once the sequence is completed. Currently i have to cancel the algo and restart it.

Have looked into loop blocks but cannot seem to understand the logic, have looked into reloads but not quite what i require.

I just want the algo to restart the entire process.

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

4 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by russelltromans-1 · Nov 25, 2020 at 11:23 AM

There are a number of ways in which you could approach this, below I will detail the most straight forward method of increasing the input quantity to initiate a new order.

To repeat or reload an Order Block you will need to increase it's input quantity to a number greater than the number of fills already achieved by that block. This is due to the 'block memory', each block calculates it's working quantity using the following equation, Input Qty - Fill Qty = Working Qty.

Below I have created a simplified example of this process that could be integrated into your existing logic.

We start by working a buy order for 5 lots. As this order begins to be filled we collect the fill information in a Value Accumulator which feeds the input quantity for our exit order. When the exit order is fully filled we then wish to rearm our entry, to do this we need to increase the input quantity to a number greater than 5 to overcome the block memory.

I have chosen to do this by taking a snapshot of the number of exit fills and adding this to the input quantity of my buy order. In doing so I will increase the input quantity to 10 allowing the Order Block to work an additional 5 lots. To ensure I do not perform this reload action too early I have created a condition for when to trigger my snapshot of the exit fills.

Here I compare the input quantity value to the number of cover fills I have achieved. When they are equal the Boolean value will output TRUE which will trigger my generator block which uses a mode of 'Bool True'. Finally I used a value extractor to take a snapshot of the 'Exit Fill Qty' which increases the input quantity of my buy order, initiating a new order.

The above logic can be adapted in numerous ways and enhanced to use things like time delays or more complex conditions around when to send the reload command.


reload-1.png (108.2 kB)
reload-2.png (59.7 kB)
Comment
Add comment Show 2 · 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 anonymouswhistleblower08 · Nov 25, 2020 at 06:27 PM 0
Share

Thanks for the very quick response. However there seems to be some formula issues with this logic. I have the EXACT same layout and blocks as you however am told by ADL that i must have a valid formula for the ValEx and the ValAccum's...

Not entirely sure why this is as my logic is the same as your example here

avatar image anonymouswhistleblower08 · Nov 25, 2020 at 07:09 PM 0
Share

Sorry, i am such a novice. i have created the formula in the Val blocks. I didnt know I had to do that. They are created and now my ADL keeps crashing... LOL. Will try again in the morning. Thank you so much for your help with the loop. Its been bugging me for the past week!!!

avatar image
0

Answer by anonymouswhistleblower08 · Nov 26, 2020 at 07:00 AM

Hi, have been playing around with the algo logic you shared and while i think i have the main parts of it drilled into my head, theres one issue i have now.

The ValAccum block, how am i formulating that in order to specify the fill quantity for the order to close the trade off? Im left hung in a simulated environment when using that block and not sure what formula i need to add in order to tell the order to close the trade the quantity of the initial fill...

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 russelltromans-1 · Nov 27, 2020 at 05:32 PM 0
Share

Both of the Value Accumulators use a value of '#fillQuantity' and the Value Extractor references the exit fill accumulator block with a formula of '@Exit Fill Qty' although this will be relative to the name you give the block.

avatar image
0

Answer by rolando · Dec 29, 2020 at 06:09 AM

The cleanest way to do what you want is to use virtualized blocks. Virtualized block is simply a block that is created everytime a discrete message is created. I created an example for you below:

Overview:

Inside the "virtual block"

Inside the exit strategy block is below:


2020-12-28-21-59-46-adl-simple-auto-reload.png (139.6 kB)
2020-12-28-22-00-05-adl-simple-auto-reload.png (102.4 kB)
Comment
Add comment · 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
0

Answer by rolando · Dec 29, 2020 at 06:10 AM

Inside the exit strategy block is below:



If you need the json file you can email me to get it as this board won't allow me to upload the .json file from what I can tell. my email is rolando@adlprogrammer.com

@anonymouswhistleblower08


2020-12-28-22-00-11-adl-simple-auto-reload.png (73.9 kB)
Comment
Add comment · 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

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

43 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 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