I have coded up an algo that does accumulating volume at the ask and volume at the bid using the time and sales block and a state block set to "trade is take" and "trade is hit" then running into to 2 value accumulator blocks . What I would like to do is reset the accumulator blocks when there is a price change as described in the title , which is , If last traded price is greater than than the highest price 1 second ago . I know I need to use a value bucket block and a max block to capture the prices of what I need , but do not know how or what to put in the "Hole" or into "Key" or "value" columns and in what order it feeds to a max block. At the moment the TT delayed environment is down for maintenance so I cant experiment with what I have already , any help would be appreciated. Thx Tim
Answer by Damon · Apr 06 at 06:48 PM
Have you tried playing around with this kind of logic example....
Answer by Daniel · Apr 11 at 04:35 AM
I used VBs but may also try VA blocks.
Store Key Formula : Trade Price
Store Value Formula : Trade Quantity
I reset the VB using Max High - VB Price that is being collected in the Store Key Formula.
Basically, I'm running a 4 price rolling window ..dropping off the bottom VB value if a new price comes into a new high and vice versa if it makes a new low.
What I need to also add is a separate logic where I reset each VB(orVA) independently if no trades hit that price in over 3 seconds.
(We seem to be working on something similar, if you want to collaborate on logic,let me know!)
Answer by higgstim · Apr 11 at 11:23 AM
Thanks for reaching out , sure I wouldn't mind collaborating just let us know how , here is a screenshot of my experiments , which might help you in that it resets the value accumulator blocks ; "bid cumulate","ask cumulate" after the condition becomes true and after 3 seconds. The idea being , once a quantity threshold breach occurs usually , but not always it leads to a price change . So I want to cumulate volume and then reset it once the condition becomes true and to add a delay of 3 or 5 seconds as well , by using a generator block set to timeinterval. This comes back to the original post which is to look for a price change (price greater than price 1 second ago) to reset the accumulator blocks.
Answer by Daniel · Apr 11 at 02:36 PM
Take a 1000 ms interval snapshot of the Discrete Max High and compare it to the Last Trade Price.
If the LTP > the Discrete Max High Snapshot Value, then pulse the Generator and reset the VA blocks. You also have to reset the Discrete Max High because if the price goes down and never trades higher than the value of that Max Discrete High you will never be able to reset the VA blocks until a new high from when the algo was started!
Thanks for yours..gives me a few ideas.
(I thought that there might have been a way to send a private msg.
I'll figure out something for sharing contact info)
Answer by Daniel · Apr 11 at 06:19 PM
One thing I forgot...make sure you use a Sequence block to reset the values in the proper order so you can use the reference price before you wipe it or else it won't reference the correct price.
1) take a snapshot of the new high price value to use as your trade calc trigger
2) then reset the VA blocks
3) then reset the discrete max high price