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

[EquisMetaStock Group] Re: converting metastock formula to c#



PureBytes Links

Trading Reference Links

--- In equismetastock@xxxxxxxxxxxxxxx, "Roy Larsen" <rlarsen@xxx> 
wrote:
>
> Hi Chellester
> 
> 
> I don't know that my answer is better than Prestons but this is 
what I was writing while he was writing his.
> 
> Cum(1) accumulates 1 for each bar of a chart, starting from the 
first loaded bar. On the first bar the value of Cum(1) will be 1, on 
the second bar it will be 2 and on the 200th bar it will be 200. 
> 
> So, summing Cum(1) for the first five bars will give the total of 
1+2+3+4+5 =15 on the fifth bar. Since there is insufficient data to 
calculate a 5-bar Sum() before the 5th bar the first 4 bars will 
return N/A rather than a legitimate value.
> 
> On the 6th bar the result of Sum(Cum(1),5) will be 2+3+4+5+6, which 
of course is 20. In other words the value of Sum(Cum(1),5) will 
increase by 5 on each subsequent bar.
> 
> Cum() is a very simple MS function but its simplicity should not be 
mistaken uselessness. It has many uses and here are just a few.
> 
> {Bar Count}
> Cum(1);
> 
> {Reverse Bar Count}
> LastValue(Cum(1))-Cum(1);
> 
> {Last Bar}
> LastValue(Cum(1))=Cum(1);
> 
> {First Bar}
> Cum(1)=1;
> 
> {Difference}
> {The "Event" variable an "N" constant must be defined before 
attempting to use in the following expression in a real formula}
> Cum(X) - ValueWhen( Nth, Event, Cum(X));
> 
> (First Valid Bar} 
> {of A, B, C, etc..., variables must be defined before attempting to 
use in the following expression in a real formula}
> Cum(IsDefined(A+B+C {etc...} ))=1;
> 
> 
> Regards
> 
> Roy
> 
>

Ok I kind of had the right idea, but not quite.  And I did wonder if 
the explanations you've given me would be the case - but it means I 
have absolutely no idea how to translate that for rewriting into c# 
as of course in Metastock you can elect how many periods to load at 
once, whereas going into a straight new database  - well I guess I'd 
just have to choose a static number and tell it to work back that far 
from the newest date, or have it as a variable I enter when I run the 
query.  Which of course means I'd have a different result everytime I 
changed the variable - which could throw my formulas right off - 
argghh.  So static would be best?
Does that sound about right?
(I don't know how that would look in C#, but that's not my problem, I 
just need to be able to the idea across to DH)




 
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/