logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
KTP2  
#1 Posted : Wednesday, November 12, 2008 4:21:32 PM(UTC)
KTP2

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 2/2/2007(UTC)
Posts: 367

Was thanked: 1 time(s) in 1 post(s)

The MetaStock code for the Breakout_Range2, by Mark Vakkur, M.D. is as follows:

For the Custom Indicator
To create the custom indicator select Indicator Builder from the Tools menu, click New and enter the following code:

Name: Breakout_Range2
Formula:
     lb:=4; { number of periods in look back }
     event:=H > HHV(Ref(H,-1),lb);

     If(event AND (Ref(BarsSince(event),-1)>=lb), Ref(BarsSince(event),-1), 0 )

For the System
To create the system, select System Tester from the Tools menu, click New and enter the following code:

Name: Breakout_Range2 System
Enter Long:
     lb:=OPT1; { number of periods in look back }
     event:=H > HHV(Ref(H,-1),lb);

     If(event AND (Ref(BarsSince(event),-1)>=lb),1, 0 )

Stops:
   Inactivity:
      Positions: Longs
      Method: Percent
      Minimum Change: 10000
      Periods: OPT1

Optimization:
   Name: OPT1
   Minimum: 2
   Maximum: 20
   Step: 1

Note: to remove the optimization replace OPT1 in the formula and in the Inactivity stop with your desired look back period.

Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.