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

Re: [Metastockusers] Fwd: Setting A Flag



PureBytes Links

Trading Reference Links

 Hi Kevin

> Your flag works nicely. My reset is a long trade entry, effectively H >
> Resistance Level. The flag is being reset on that bar, i.e. the last bar on
> which the flag is set is the preceding bar. Is there an elegant way of
> delaying the flag reset until the bar after the trade entry? I could use
> Ref() in the system test of course......

I think this is where Heitor's suggested use of Alert() would be most helpful - to extend the flag 
signal by one bar. Once the "Flag" variable has been created you can modify it as per the extra line 
inserted in the code I originally suggested. This extra line of code simply modifies the first 
"Flag" definition by adding one bar to the trailing edge.

FlagSet:=Cross(RSI(14),70);
FlagReset:=Hour()<Ref(Hour(),-1);
Init:=Cum(FlagSet+FlagReset>-1)=1;
Flag:=BarsSince(Init+FlagSet)<BarsSince(Init+FlagReset);
Flag:=Alert(Flag,2);
Flag;

You could modify the variable by using a line such as the following , but I'd not recommend it. 
Using an indicator that requires past data to extend a signal forward is not a good idea, and this 
is because it introduces another invalid bar into the formula result. Alert uses the current bar 
only, so doesn't create an additional invalid bar.

Flag:=Flag OR Ref(Flag,-1);


Kind regards

Roy Larsen
www.metastocktips.co.nz
Free formulas and MS links




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/zMEolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

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

<*> To unsubscribe from this group, send an email to:
    Metastockusers-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/