[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: opt this it works.



PureBytes Links

Trading Reference Links

I've tested this further and it seems o.k. 

in the indicator builder place this as the formula to test against 
the optimized formula to see if it does what you want. change the z 
value which is the periods length to compare the time lengths with 
the optimized system.

z=3;

lowslope=((z * (Sum( Cum(1) * Low, z))) - (Sum( Cum(1), z) * ( Sum
(Low, z))))/
((z * Sum(( Cum(1)^ 2), z)) - ( Sum(Cum(1),z)^2 ));


Graph0=Min(Low,
Min( Ref(Low,-1) + 1 * (lowslope ),
Min( Ref(Low,-2) + 2 * (lowslope ),
Min( Ref(Low,-3) + 3 * (lowslope ),
Min( Ref(Low,-4) + 4 * (lowslope ),
Min( Ref(Low,-5) + 5 * (lowslope ),
Min( Ref(Low,-6) + 6 * (lowslope ),
Min( Ref(Low,-7) + 7 * (lowslope ),
Min( Ref(Low,-8) + 8 * (lowslope ),
Min( Ref(Low,-9) + 9 * (lowslope ),
Min( Ref(Low,-10) + 10 * (lowslope ),
Min( Ref(Low,-11) + 11 * (lowslope ),
Min( Ref(Low,-12) + 12 * (lowslope ),
Ref(Low,-13) + 13 * (lowslope ))))))))))))));


now replace the complete z variable code lines with this,


z=IIf(c>0,1,0) +IIf(c>0,1,0)+IIf(c>0,1,0); (e.t.c.)


( this is only to be used as a test for comparing against the 
original formula) as close is always > than 0 .
this would be a 3 period length, ( to increase the period value 
add +IIf(c>0,1,0) to increase the period by 1 ( for every true it 
adds an extra 1 to the periods time. 



z=IIf(L<Ref(L,-1),1,0) +IIf(L<Ref(L,-2),1,0)+IIf(L<Ref(L,-3),1,0)+IIf
(L<Ref(L,-4),1,0)+IIf(L<Ref(L,-5),1,0)+IIf(L<Ref(L,-6),1,0)+IIf(L<Ref
(L,-7),1,0)+IIf(L<Ref(L,-7),1,0)+IIf(L<Ref(L,-8),1,0)+IIf(L<Ref(L,-
9),1,0)+IIf(L<Ref(L,-10),1,0)+IIf(L<Ref(L,-11),1,0)+IIf(L<Ref(L,-
12),1,0)+IIf(L<Ref(L,-13),1,0);

Aa=((z * (Sum( Cum(1) * Low, z))) - (Sum( Cum(1), z) * ( Sum(Low, 
z))))/
((z * Sum(( Cum(1)^ 2), z)) - ( Sum(Cum(1),z)^2 ));

Lowslope=Aa;


Graph0=Min(Low,
Min( Ref(Low,-1) + 1 * (lowslope ),
Min( Ref(Low,-2) + 2 * (lowslope ),
Min( Ref(Low,-3) + 3 * (lowslope ),
Min( Ref(Low,-4) + 4 * (lowslope ),
Min( Ref(Low,-5) + 5 * (lowslope ),
Min( Ref(Low,-6) + 6 * (lowslope ),
Min( Ref(Low,-7) + 7 * (lowslope ),
Min( Ref(Low,-8) + 8 * (lowslope ),
Min( Ref(Low,-9) + 9 * (lowslope ),
Min( Ref(Low,-10) + 10 * (lowslope ),
Min( Ref(Low,-11) + 11 * (lowslope ),
Min( Ref(Low,-12) + 12 * (lowslope ),
Ref(Low,-13) + 13 * (lowslope ))))))))))))));

cheers: nirvana.





--- In amibroker@xxxx, "nirvana1x" <nirvanaiam@xxxx> wrote:
> is this similar to what you are asking. in the z= formula for 
> every true it adds 1 to the projection band so if (IIf(L<Ref(L,-
> 1),1,0) +IIf(L<Ref(L,-2),1,0) these 2 days were true it would 
change 
> the periods in the lowslope formula to 2.
> 
> 
> z=IIf(L<Ref(L,-1),1,0) +IIf(L<Ref(L,-2),1,0)+IIf(L<Ref(L,-3),1,0)
+IIf
> (L<Ref(L,-4),1,0)+IIf(L<Ref(L,-5),1,0)+IIf(L<Ref(L,-6),1,0)+IIf
(L<Ref
> (L,-7),1,0)+IIf(L<Ref(L,-7),1,0)+IIf(L<Ref(L,-8),1,0)+IIf(L<Ref(L,-
> 9),1,0)+IIf(L<Ref(L,-10),1,0)+IIf(L<Ref(L,-11),1,0)+IIf(L<Ref(L,-
> 12),1,0)+IIf(L<Ref(L,-13),1,0);
> 
> Aa=((z * (Sum( Cum(1) * Low, z))) - (Sum( Cum(1), z) * ( Sum(Low, 
> z))))/
> ((z * Sum(( Cum(1)^ 2), z)) - ( Sum(Cum(1),z)^2 ));
> 
> Lowslope=Aa;
> 
> 
> Graph0=Min(Low,
> Min( Ref(Low,-1) + 1 * (lowslope ),
> Min( Ref(Low,-2) + 2 * (lowslope ),
> Min( Ref(Low,-3) + 3 * (lowslope ),
> Min( Ref(Low,-4) + 4 * (lowslope ),
> Min( Ref(Low,-5) + 5 * (lowslope ),
> Min( Ref(Low,-6) + 6 * (lowslope ),
> Min( Ref(Low,-7) + 7 * (lowslope ),
> Min( Ref(Low,-8) + 8 * (lowslope ),
> Min( Ref(Low,-9) + 9 * (lowslope ),
> Min( Ref(Low,-10) + 10 * (lowslope ),
> Min( Ref(Low,-11) + 11 * (lowslope ),
> Min( Ref(Low,-12) + 12 * (lowslope ),
> Ref(Low,-13) + 13 * (lowslope ))))))))))))));
> 
> below is the 14 period projection bands which when compared to 
> your original formula looks similar.
> 
> 
> lowslope=((14 * (Sum( Cum(1) * Low, 14))) - (Sum( Cum(1), 14) * ( 
Sum
> (Low, 14))))/
> ((14 * Sum(( Cum(1)^ 2), 14)) - ( Sum(Cum(1),14)^2 ));
> 
> 
> 
> 
> Graph0=Min(Low,
> Min( Ref(Low,-1) + 1 * (lowslope ),
> Min( Ref(Low,-2) + 2 * (lowslope ),
> Min( Ref(Low,-3) + 3 * (lowslope ),
> Min( Ref(Low,-4) + 4 * (lowslope ),
> Min( Ref(Low,-5) + 5 * (lowslope ),
> Min( Ref(Low,-6) + 6 * (lowslope ),
> Min( Ref(Low,-7) + 7 * (lowslope ),
> Min( Ref(Low,-8) + 8 * (lowslope ),
> Min( Ref(Low,-9) + 9 * (lowslope ),
> Min( Ref(Low,-10) + 10 * (lowslope ),
> Min( Ref(Low,-11) + 11 * (lowslope ),
> Min( Ref(Low,-12) + 12 * (lowslope ),
> Ref(Low,-13) + 13 * (lowslope ))))))))))))));
> 
> 
> 
> cheers: nirvana.
> 
> 
> 
> 
> --- In amibroker@xxxx, "E Winters" <e.winters@xxxx> wrote:
> > Posted earlier, but may be useful again:
> > For those interested in using the scripting capabilities of 
> Amibroker, but
> > do not know how scripting works, there are a series of 12 free 
> lessons.
> > Lesson 1 is at the following website:
> > Part 1:
> > http://www.winscriptingsolutions.com/Articles/Index.cfm?
> ArticleID=16355
> > 
> > Lessons 2-12 can also be reached by clicking on the related 
> articles link on
> > the web page above.
> > Regards,
> > Ed
> > 
> > ----- Original Message -----
> > From: "spxer" <t.willett@xxxx>
> > To: <amibroker@xxxx>
> > Sent: Sunday, April 28, 2002 9:27 AM
> > Subject: [amibroker] Re: opt this
> > 
> > 
> > | Hey, Lou and Herman. I appreciate your help. It has gotten way 
> over
> > | my capabilities. I read the help files on VBscripting, 2 times, 
> and
> > | didn't understand a word of it. If anyone figures it out, 
please 
> e-
> > | mail me as I don't watch this site reglarly. Thanks, Terry
> > |
> > |
> > | --- In amibroker@xxxx, "Lou Howard" <loul@xxxx> wrote:
> > | > Hi Herman, thanks for trying. What Terry is trying to do is
> > | actually append a section of code containing AFL functions to a 
> prior
> > | line of code. The code to be appended is:
> > | > Min(Ref(L,-3) +3* LinRegSlope(L, 5)
> > | > and as you can see, this would be easier done in AFL but I 
don't
> > | know how to call the LinRegSlope() function from VBScript. 
Also,
> > | the "3" in "Min(ref(L,3) etc" needs to be incremented. In 
> earlier e-
> > | mails there was a "work-around" for loops done in AFL but I 
cannot
> > | find them (tried searching Yahoo and got every e-mail ever 
> written).
> > | So, it boils down to being able to do a loop in AFL or coding 
the 
> AFL
> > | function in VBScript but again, I don't know the formula for
> > | LinRegSlope so am stopped both ways. If I remember correctly, 
AFL
> > | functions can be called from "objects" in VBScript but that 
will 
> take
> > | some more reading to verify and learn how to do it. Kind of an
> > | interesting problem and an important 'next step' for me. Let 
us 
> know
> > | if you have any further thoughts on it.
> > | >
> > | > Best Regards - loul
> > | > ---------------------
> > | >
> > | > >>...Perhaps some kind soul will take pity on a couple of
> > | floundering
> > | > mud-fish with advice on "for next loops" and or function 
calls
> > | from
> > | > VBscript...>>
> > | >
> > | > In it's simplest form:
> > | >
> > | > // example in VBScript
> > | > <%
> > | > myArray = AFL("close")
> > | > sum = 0for i = 0 to UBound( myArray )
> > | > sum = sum + myArray( i )
> > | > next
> > | > %>
> > | >
> > | > There is a nice section in the AB help on this, it will 
show 
> you
> > | how to do
> > | > basic looping in several examples. Search for: AFL 
Scripting 
> Host
> > | >
> > | > It may look complicated at first. The best way to get 
started 
> is
> > | to copy an
> > | > example, test it out and then change ONE small line at a 
time.
> > | Testing
> > | > whether everything still works as you go along. It is just
> > | amazing what you
> > | > can "program" without knowing how to program :-) all it 
takes 
> is
> > | some
> > | > patience.
> > | >
> > | > Looping IS THE THING to know and the sooner you learn it the
> > | better. It will
> > | > remove many of the stumbling blocks that are repeatedly 
> discussed
> > | on this
> > | > list.
> > | >
> > | > Take care and good luck,
> > | > Herman.
> > | >
> > | > -----Original Message-----
> > | > From: Lou Howard [mailto:loul@x...]
> > | > Sent: Saturday, April 27, 2002 7:40 PM
> > | > To: amibroker@xxxx
> > | > Subject: Re: [amibroker] Re: opt this
> > | >
> > | >
> > | > Terry, have you heard the expression "Open mouth and insert
> > | foot"? Well, I
> > | > just did it. I thought I'd write you a short code and 
solve 
> all
> > | your
> > | > problems but the problem is, it is not practicable. The 
> lines of
> > | code you
> > | > have use AFL functions which I haven't learned to handle 
from
> > | VBscript yet
> > | > (I understand that they can if one knows how). The 
> alternative
> > | is to do
> > | > 'for next loops' in AFL. There is a work-around that was 
in 
> the
> > | e-mails but
> > | > when I searched Yahoo, I got every e-mail that has been 
> written.
> > | > (apparently a lot of "for's" and "next's"). Also found 
> nothing
> > | on the
> > | > subject at AmiBroker. Perhaps some kind soul will take 
pity 
> on a
> > | couple of
> > | > floundering mud-fish with advice on "for next loops" and or
> > | function calls
> > | > from VBscript. If I recall correctly, the function calls 
must
> > | come from or
> > | > to an "object" but I haven't gotten to that yet. I was just
> > | thinking, there
> > | > are some pretty bright people on this forum, how does TJ 
stay
> > | ahead of all
> > | > of them? Will work on it as soon as I get a little more 
time.
> > | >
> > | > loul
> > | >
> > | > ---------------------------------------------------------
> > | >
> > | >
> > | >
> > | > Lou, I don't know anything about VBscript. Thanks, Terry
> > | >
> > | > --- In amibroker@xxxx, "Lou Howard" <loul@xxxx> wrote:
> > | > > Hi Terry -
> > | > > Well, I'm just starting out in this stuff but it seems 
that
> > | > the 'lines of code' in incremented by the 'input variable', 
> i.e.,
> > | > 2,3,4, etc. This sounds like a loop that can be executed 
from
> > | > VBscript using the variable as both a counter and insertion 
> into
> > | the
> > | > formula. Does this sound right?
> > | >
> > | >
> > | > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > | Service.
> > | >
> > | >
> > | >
> > | > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > | Service.
> > |
> > |
> > |
> > |
> > |
> > | Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/
> > |
> > |