September 13, 2022 at 7:00 pm #69287
Hi Optuma group,
I am having problem with incorrect results in varying degrees when using Volume() in TIMESINCESIGNAL(), I will try to explain it as simply as I can.
I am trying to achieve a “one or high output” when volume has been > say 15000000 within the last 2 days.
The code I am using is as below –
tss5=TIMESINCESIGNAL(vol1 > 9000000) <= 2;
For AFI.au the above code shows correctly, if I change 9000000 to 15000000 the indicator displays incorrectly as per attached screen shots.
BKH.us shows incorrectly with both numbers ie – it shows a “one or high output” when it should be a “low”, even though the volume is mostly quite low – < 1000000.
What do I need to change to make this code work correctly?
Thanks for your help,
Cheers, BradSeptember 14, 2022 at 2:07 am #69303
I think you need to change the volume numbers as neither AFI or BKH have had volume above 15,000,000.
If you use this is will count how long it has been since > 500,000, ie 30 days for BKH. The Show Bar highlists within 2 days:12345vol1=VOLUME();tss5=TIMESINCESIGNAL(vol1 > 500000) ;tss5September 22, 2022 at 7:03 pm #69387
Thank you for your reply and I apologise for my late reply.
You wrote “I think you need to change the volume numbers as neither AFI or BKH have had volume above 15,000,000.“, this is precisely my point, with AFI.au for instance if I use vol1 > 500,000 my above supplied code shows correctly ie zero’s & one’s (blacks & greens), if I use vol1 > 997,000 the code shows mostly zero with a couple of one’s, and if I use vol1 > 15,000,000 the code shows all one or high (green) output when it should be all low or (black).
AFI.au doesn’t have volume of 15,000,000 on any day in its history, yet my above supplied code of –
tss5=TIMESINCESIGNAL(vol1 > 15000000) <= 2;
– shows an output indicating AFI.au has volume of greater than 15,000,000 every day when the maximum days volume is maximum days volume = 997,359 as per the attached screenshot.
What do I need to change to make this code show correctly?
Thanks for your help,
BradSeptember 22, 2022 at 9:00 pm #69393
Your script is counting how many days volume has been above 15,000,000 and return a true result if it is <= 2. As AFL has had 0 days above 15,000,000 your formula returns a true result (0 <= 2).
Does this do what you need?12345vol1=VOLUME();tss5=TIMESINCESIGNAL(vol1 > 15000000);tss5 > 0 and tss5 <=2September 23, 2022 at 9:11 pm #69403
Thank you again for your helpful reply.
Your suggested code was very helpful, but the resulting true was delayed by 1 day, so I added [-1] to the end of tss5=TIMESINCESIGNAL(vol1 > 15000000)[-1]; which seemed to help with that.
But your suggested code with my mod doesn’t always produce a true result at the correct time, particularly it seems with much higher volume than 15,000,000.
WHC.au and TSLA are 2 recent examples of that.
WHC.au shows some > 15m volume days true result but not others, ie 3/3/2022.
TSLA’s daily volume is much higher than 15m but shows no recent true result at all.
Just to recap what I wanted the code to achieve was –
If daily volume has been greater than 15,000,000 within the last 2 days, show a true output.
Is there a better way to achieve this?
BradSeptember 24, 2022 at 1:24 am #69405
Ah OK now I understand… TIMESINCESIGNAL is a running count since a condition was last true, so if the condition is currently true (ie TSLA’s volume > 15,000,000) then you will get a value of 0.
As you are only looking for 2 bars this is perhaps an easier way to do it, with Vol1 being the current bar and Vol1 the previous:1234Vol1=VOLUME();(Vol1 > 15000000) or (Vol1 > 15000000)September 25, 2022 at 5:35 pm #69417
I have only been “using within the last 2 bars” because it makes it easier to see of the code is working correctly.
Once I have a verified a correctly working script to achieve the above, I will use a longer time period, maybe 10-30 bars, which I will fine tune using visual checks and Backtesting.
I have used TIMESINCESIGNAL() many times, but haven’t experienced this amount of difficulty in making it work correctly.
Is there something unique about VOLUME() that has caused this?.
I am looking for this script to give a “true” output with likely a longer count than 2 bars from when a VOLUME() condition ie > 15M last occurred, probably 10-30 bars.
Thanks again for your help,
BradSeptember 28, 2022 at 2:07 am #69435
The TimeSinceSignal should work the same for all functions, so it’s a question of knowing what the function is doing and getting the logic right.
If you put TIMESINCESIGNAL(VOLUME()>15000000) in a Show View it will show the running total of the days since it last happened, as per this example for WHC:
The green bars show when it has been more than 20 days since a 15mill day (red arrows) ie a 20 day gap between red arrows:
As an aside, using a ‘higher than average volume’ signal rather then a discrete value would work better when comparing stocks, eg when volume is twice the 22 day average:123VOLUME()>(MA(VOLUME(), BARS=22)*2)September 28, 2022 at 9:11 pm #69437
Thanks for your help again Darren, I will revisit it again next week, there must be a solution, just a matter of finding it.
- You must be logged in to reply to this topic.