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

Re: [EquisMetaStock Group] Re: referencing position entry date



PureBytes Links

Trading Reference Links

Hi Andrew

> This is interesting. Are you proposing putting the Init at a later stage in
> the code process, or are you repeating Init with a different definition,
> i.e. in this case
>
> Init:= Cum(SignalIn>=-1)=1
>
> BarDiff1:=ValueWhen(1,SignalIn OR Init,
>   ValueWhen(1+1,1,BarsSince(SignalIn OR Init))+1);BarDiff1;
>
> Init:= Cum(BarDiff1>=-1)=1;
>
> Thus a multi-stage code might have several levels of Init?


If you can get away with placing the Init later then do so. In you example you needed it where it 
was, but any definition doesn't need to be set in stone.

The variable can have a totally different definition second time around, or just a small variation 
on the original. You could also include the original definition in the second one, as follows.

 Init:= Cum(Init>=-1)=2;

or you could use

Init:= Cum(SignalIn>=-1)=2;

The MetaStock top-to-bottom processing sequence allows you to change a variable definition as often 
as you like. Only the most recent definition is used by following code, and an earlier definition is 
used prior to the change. The cycle is repeated on every bar across the chart.

If possible you should strive for just one level of init. It saves space for one thing. However 
there are times when the original definition is no longer adequate for one reason or another. 
There's no law that says you can't progressively modify Init, or any other variable for that matter. 
If you need to break the 20-variable limit then the simplest approach is to re-use those variable 
names that have already accomplished their purpose and are no longer required. The same variable 
name can be used for something quite different.

This is what I do with Trade Equity - the "I" variable (Init) is used for one thing, then it's used 
for Init, then it's used for something else again. In practice you can only do this a limited number 
of times, but in theory it makes a nonsense of the 20-variable limit.

> What I usually do is to list all my variables at the beginning of the code
> (e,g, elements of entry and exit code) and then include as many as make
> sense into one big Init statement.

No Problem there as long as you don't overlook N/A bars that are introduced subsequently. The code 
you started with is an exception in that the Init occurred on the first bar. Most often it will be 
several bars into the chart, and probably vary from chart to chart. The thing to keep an eye out for 
with longer Init periods is the introduction of an extra N/A bar (after Init) that has the potential 
to mask out the original Init active signal. Believe me, it happens. Cross(), PREV and Ref() are the 
usual culprits.

Are you still with me?


Regards

Roy
www.metastocktips.co.nz





------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> 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/