I wrote a formula for over sold CCI after a MACD crosses zero (hist) to alarm only once after each cross. If I leave the chart open it only shows one event...if I reboot the program it shows all the events (which is what I want). So after a cross how do I get the program to reset for the next event??? MK
Alex
(1) File attached ( I hope)
(2) Only this file is attached to all 21 stocks on a PAGE
(3) When I load the page the numbers are wrong.
(4) The program determines the number of days since
the last touch of the Upper BB and Lower BB
(5) Key = Then I reload each chart separately I get the
RIGHT answer.
Larry
I think the attached revision of the script does what you asked.
As far as I have seen in my tests it works both on historical and in real time.
Alex
Question?
(1) Were your modifications do to your understanding how
the "study.getValue(BollingerStudy.UPPER" works ?
(2) Or is it how Java Programming works in general ?
(3) Or did you just try and guess a solution?
Larry
The revision has more to do with the construct than with specific syntax.
The way the efs now works is the following. At the beginning of every new bar it checks if the prior high/low were higher/lower than the corresponding Upper/Lower BB. If they were it starts the count from 1. It will maintain this number (even if the current bar takes out the Upper/Lower BB) until it checks again at the open of the following bar and then repeats the process either starting the count again at 1 or adding to the count.
Alex
Alex
(1) First I want to thank you for your help in learning this
new language. Have programmed since 1969, but every new
language has it's walls. And you have helped me get over those
walls.
(2) Now back to bb.efs
(3) I plotted LASTBBBOT and noted that the counting worked fine
until the last bar. Today I changed the margin from 5 to 3 and
sure enough the counting worked fine until it added 3 at the last
bar.
(4) Then I added "setComputeOnClose()"
(5) That fixed every thing.
(6) see new efs attached.
Here are 21 charts with BB.EFS
This shows how looking at the days from last touch of BB Upper
and BB Lower lines, one can tell the direction of the market.IMHO.
Examples on how EFS files are used in actual looking at the market seem to be missing from these boards. IMHO.
Larry
Using setComputeOnClose() is essentially the same as using getBarState() ie it waits for a new bar to verify the conditions.
The main difference is that with setComputeOnClose the whole efs is computed on a new bar hence the BB in this case plots one bar behind (ie not in real time).
With getBarState() instead you can isolate the section(s) that you want computed on a new bar leaving everything else to function in real time.
With regards to the count, in your efs you will have the first bar after high/low above/below the BB bands numbered as 0 even if its high/low has not taken out the BB bands whereas with mine it will behave as explained in my prior message.
Alex
Alex
(1)Is there code that will give the "total bars" on the chart
at the beginning of MAIN?
(2)I would then use "If Statement" to do
y = mx+b only at the last bar
I'm sure there is a simple way round this but I've been wrestling with it but can't seem to solve it...
I am trying to create a band along bottom of chart that signals the following: Lower Band shows blue when Stochastic (10,3,1) is moving UP and red when same stochastic is moving DOWN. On the band just above this I want similar thing but for a Stochastic(30,10,1)
The problem I am having is that I want it to do this in real time - not setComputeOnClose. But what happens is that when the bar changes, the color on each band is not always accurate and I have to reload, which defeats the purpose of the thing.
The other problem is that I need it to only look back 100 bars, because if it does longer than this it really slows my system down.
Comment