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

RE: [Metastockusers] Fixed period exit



PureBytes Links

Trading Reference Links

Here's some code I have been using. The main innovation (at least for me)
was the use of two Init variables.

You'll need to check that its giving you the number of days you expect. 

The approach I took was to first count the number of days between the last
two entry signals. I ended up having to use two Init variables in order to
catch the first signal on the chart. So for a given entry signal (SignalIn)
and Init variable, the bar difference between the last two entry signals can
be calculated as follows:

BarDiff1:=ValueWhen(1,SignalIn OR Init OR Init+1,
Ref(BarsSince(ROC(Cum(SignalIn OR Init OR Init+1),1,$)>0),-1))+1;{this will
make sense if you plot the component parts.}

Then if I add this to the bars between now and the most recent entry signal
I can test to see if the total is less than the time stop bars (TmStopL). If
it is, then I ignore the most recent signal.

Long=If(BarDiff1<TmStopL,(BarsSince(SignalIn OR Init)+BarDiff1),
BarsSince(SignalIn OR Init))<TmStopL ;

This only works for one repeat of the entry signal before an exit(more than
one is very rare for the system I'm using this for), but you could use the
same principal to expand the code. It is also long only, but is easily
adapted.

Let me know if you find any problems with it.

My experience with stops in system tester has not been good - I much prefer
to hard code all stops wherever possible.

Andrew



-----Original Message-----
From: david castley [mailto:drc1939@xxxxxxxxxxxx] 
Sent: Tuesday, January 18, 2005 5:16 AM
To: Metastockusers@xxxxxxxxxxxxxxx
Subject: Re: [Metastockusers] Fixed period exit


Andrew - thanks for the reply. The repeating entry signal is indeed causing
problems. Would you know how to overcome this? Thanks, David
----- Original Message ----- 
From: Andrew Tomlinson <mailto:andrew_tomlinson@xxxxxxxxxxx>  
To: Metastockusers@xxxxxxxxxxxxxxx 
Sent: 17 January 2005 20:46 PM
Subject: RE: [Metastockusers] Fixed period exit


Assuming you are trying to avoid using PREV, you can experiment with the
Alert() function. Alert(EntrySignal,Bars) will hold true for the specified
number of bars after the entry signal.

However, the coding can get trickier if there are other exits involved or if
the entry signal can repeat before an exit can occur. I am working on a time
stop coding which will ignore a repeated entry. It's easy with PREV, tougher
without.

Andrew


-----Original Message-----
From: drc13uk [mailto:drc1939@xxxxxxxxxxxx] 
Sent: Monday, January 17, 2005 1:41 PM
To: Metastockusers@xxxxxxxxxxxxxxx
Subject: [Metastockusers] Fixed period exit




I have been trying, mainly with the Barssince function, to code a 
system exit at a fixed period, say 5 days, after entry, with no 
success. i had hoped that - BarsSince( "entrycondition" >=5) - as the 
exit would work, but it doesn't. Can anyone please help? many thanks, 
David.







Yahoo! Groups Links











  _____  

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
<mailto:Metastockusers-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe> 
	  
*	Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> . 





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