PureBytes Links
Trading Reference Links
|
Jaime,
a:= 0;
a:= PREV + 1;
a;
Problem is that the first value of a is 1 not 0. After the first bar
you do get an ascending value but it will start at 1 because the
variable is further defined as prev +1 in the second statement.
Preston
--- In equismetastock@xxxxxxxxxxxxxxx, "jaime" <xtal32768@xxx> wrote:
>
> Hi Preston,
>
> My formula set "a" to 0, yes, and then sets "a" to its previous
value
> plus 1. In a normal programming language, the variable holds the
last
> value set. That does not happen in this case.
>
> I believe the reason for this resides in the way MS executes the
> scripts. I believe MS takes one line of script and calculates the
> values for all the bars in the chart, then takes the next line of
> script and calculates the values for all bars again, and so on.
>
> What i was expecting MS to do was calculate all values of the
script
> for one bar, then advance to the next bar and calculate all values
> again for that bar.
>
> These 2 algorithms produce different results. In my example, MS
will
> calculate "a:=0" for all bars, then it will calculate "a:=ref(a,-
1)
> +1;" for all bars and the function ref(a,-1) will always return 0.
>
> Preston, i really appreciate your offer but i think it's not worth
> it. The code comments are not in English and it would take some
time
> to translate and prepare the code to show here.
>
> Thanks.
> Regards,
> Jaime
>
>
>
> --- In equismetastock@xxxxxxxxxxxxxxx, pumrysh <no_reply@> wrote:
> >
> > Jaime,
> >
> > Ron is correct.
> >
> > Your formula sets the a variable as 0 every bar.
> >
> > It is possible to translate other programs such as wealth-lab to
> > metastock...I have done it. Show us the code and we'll see what
we
> > can do.
> >
> > Preston
> >
> >
> >
> >
> >
> > --- In equismetastock@xxxxxxxxxxxxxxx, "jaime" <xtal32768@>
wrote:
> > >
> > > Hi Ron,
> > >
> > > Thank you for the reply.
> > > Take notice that i'm adding 1 to the previous value of a (in
> > theory).
> > > So, if in one bar the variable a is equal to 0, in the
following
> > bar
> > > it will add 1 and a equals 1. After another bar, i will add 1
> more
> > > and a should be equal to 2, and so on. That's the theory as
far
> as
> > i
> > > can understand MS.
> > > In practice thing don't happen that way. It seems that MS Will
> not
> > > consider the value of the variable that is plotted when the
> > function
> > > Ref() is used, it considers always the constant 0. I don't
know
> > why,
> > > it doesn't make sense to me and it limits even more the MS
Script.
> > >
> > > I cannot use the function Cum() because my goal is not
producing
> > an
> > > incrementing line. I just simplified my script so that i could
> > > explain the issue to you. My goal is to translate a small
program
> > > from wealth-Lab Developer to MS. Unfortunately i think it
won't
> be
> > > possible.
> > >
> > > Regards,
> > > Jaime
> > >
> > >
> > >
> > >
> > > --- In equismetastock@xxxxxxxxxxxxxxx, "Ron Berlin" <rsb_44@>
> > > wrote:
> > > >
> > > > Jaime-
> > > >
> > > >
> > > > Your code sets a to the constant 0 (zero). You then add 1
to
> it
> > to
> > > get the
> > > > constant 1. That's what you are plotting. Try setting a to
3.
> > > You'll get a
> > > > plot of 4.
> > > >
> > > > You're looking for
> > > > CUM(1);
> > > > Which is a bar counter increasing from left to right.
> > > >
> > > > Ron
> > > >
> > > >
> > > > >From: "jaime" <xtal32768@>
> > > > >Reply-To: equismetastock@xxxxxxxxxxxxxxx
> > > > >To: equismetastock@xxxxxxxxxxxxxxx
> > > > >Subject: [EquisMetaStock Group] Indicator Help
> > > > >Date: Tue, 24 Apr 2007 21:37:11 -0000
> > > > >
> > > > >Hi,
> > > > >
> > > > >I'm trying something with Metastock and its behavior is not
> > what i
> > > > >expected. When i create an indicator with the following
code:
> > > > >
> > > > >a:= 0;
> > > > >a:= Ref(a,-1) + 1;
> > > > >a;
> > > > >
> > > > >MS plots a straight line with the value 1. I was expecting
a
> > line
> > > > >increasing by +1 in each bar. Anyone knows why this happens?
> > > > >I'm using MS Pro 8.0.
> > > > >
> > > > >Thank you,
> > > > >Jaime
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/equismetastock/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:equismetastock-digest@xxxxxxxxxxxxxxx
mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|