PureBytes Links
Trading Reference Links
|
<SPAN
class=578433711-03022004>Hi Dimitris, thanks for replying, but I don't think I
understand your answer. It seems like you're showing me the benefits of putting
the stochastic transformation into a separate function, but you're preaching to
the choir. I *know* why I want to do that, that's why I it *was* written as a
function in the code I sent. I've had that StochasticTransform function in my
standard #include file for a long time; I just made it part of the code itself
so people could se the whole thing in one place.
<SPAN
class=578433711-03022004>
<SPAN
class=578433711-03022004>But none of that has to do with the problem I'm seeing.
Did you run the code I provided and look at the resulting charts, before and
after un-commenting out those lines I suggested? Please do try it; there's
something going on that I don't understand, and I'd love your
comments.
<SPAN
class=578433711-03022004>
<SPAN
class=578433711-03022004>Anyone else try this?
<SPAN
class=578433711-03022004>
<SPAN
class=578433711-03022004>Dave
<BLOCKQUOTE
>
<FONT face=Tahoma
size=2>-----Original Message-----From: DIMITRIS
TSOKAKISDave,Suppose we want to create the Stoch
transformation for various arrays, say MACD() and Signal().The first
method is analytic, you have to repeat 4 lines per
arraya1=Signal();t=14;H1=HHV(a1,t);L1=LLV(a1,t);st=100*(a1-L1)/(H1-L1);Plot(st,"StochSignal",1,1);a1=MACD();t=14;H1=HHV(a1,t);L1=LLV(a1,t);st=100*(a1-L1)/(H1-L1);Plot(st,"StochMACD",2,1);The
function method will give the same result in an elegant form.Define first
the st-function steps and then apply for any array.//The Stochastic
transformationfunction
st(array,t){H1=HHV(array,t);L1=LLV(array,t);return
100*(array-L1)/(H1-L1);}Plot(st(Signal(),14),"StochSignal",1,1);Plot(st(MACD(),14),"StochMACD",2,1);The
advantage of the function method is obvious.Dimitris TsokakisPS: Note
here that this st-function is a pseudo-stochastic, since the arrays do not
have HLC. Expect saturated values for both 0 or 100 limits.--- In
amibroker@xxxxxxxxxxxxxxx, "Dave Merrill" <dmerrill@xxxx>
wrote:> I'm seeing a weird problem that I think may be the result
of something I> don't understand about variable scoping. Check this
out:> > ----------------------> function
StochTransform(array, period) {> local
LowValue;> LowValue = LLV(array,
period);> return 100 * (array -
LowValue) / (HHV(array, period) - LowValue);> }> >
Diff = Signal(12, 26, 9);> StochDiff = StochTransform(Diff, 5);>
> //JunkIgnored = StochTransform(C, 14);
// <<< ENABLING THIS CHANGES Diff,> WHY???>
//JunkIgnored = StochTransform(Diff, 14); //
<<< BUT THIS DOESN'T> ---------------------->
> First enter it into IB as given above, look at the chart, then
enable the> first of the two commented out lines at the bottom.
Notice that Diff (blue> histogram) changes drastically. Now enable
the second one and not the first,> and things go back to
"normal".> > I don't get this at all. It seems like it must be
due to interaction between> the two calls to StochTransform, and in
fact, if you create a copy of the> function called StochTransform2,
and call that the second time, no problem.> Guessing further from
the fact that using the same value for the 'array'> parameter in
both cases also prevents the problem, most likely the conflict> is
with the reuse of that formal parameter when the function is called
the> second time.> > I've never seen this behavior
before, and I don't understand it. Among other> things, if it's
really true that you can't call the same function more than> once
without interactions like this, a lot of code I've written that I>
thought worked, didn't. Or is there some simple stupid bug in this test
that> I'm missing?> > Ideas? Tomasz?> >
Dave
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|