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

Barnes Mountain Valley system



PureBytes Links

Trading Reference Links

Message text written by INTERNET:omega-list@xxxxxxxxxx
>
Greetings....does anyone have the Easy Language code for the Mountain
Valley System described in High Impact Day Trading by Robert M.
Barnes...Thank you
<

I coded this up some time ago and don't recall if it is all debugged.  As I
recall, I was trying to use it intraday and the results were not very good.

If anyone uses this and/or revises it, please let me know about
results/revisions.

No warranty, blah, blah, blah.

Regards,
Paul Weston, CTA
Helios Consulting, Inc


===========================================================================
==

{ 
        Mountain Valley Vers 1.0

        Based on N new highs (lows) by M Magnitude

        Stop

        Copyright 1996, Helios Consulting, Inc.

10/24/96        Add Start and Ending Date

        
}

Input: Count(4), Mag(12), StrtDate(960101), EndDate(991231)  ;

Vars: FirstBar(0), ThisBar(0), StopLow(0), StopHigh(0), 
                NewHigh(0), NewLow(0), NewHighCount(0), NewLowCount(0),
                LocalNewHigh(0), LocalNewLow(0), LNHCount(0), LNLCount(0),
                Trend(0), PrintSW(0),
                CurrJul(0), StrtJul(0), EndJul(0) ;


{ * * * * * * * * * TEST FOR START DATE * * * * * * * * * * * * * * * *}
CurrJul = DateToJulian(CurrentDate)     ;
StrtJul = DateToJulian(StrtDate)        ;
EndJul  = DateToJulian(EndDate) ;

If CurrJul >= StrtJul  and  CurrJul <= EndJul
        THEN BEGIN      ;


{ * * * * * * * * TEST FOR DAY CHANGE * * * * * * * * * *}
If Date of Yesterday  <> Date of Today
        then begin;
                FirstBar = CurrentBar;
                end;
ThisBar = CurrentBar - FirstBar + 1;    {Number of bars since start of day}


{Print(Date:6:0, Time:5:0 );}

PrintSW = 1     ;

{ - -- - - - - - - TIME WINDOW & ENTRY POINTS - - - - - - - - - - - - - -
-}
IF TimeToMinutes(Sess1EndTime) - TimeToMinutes(Time) > 90 
        then BEGIN;             {Don't trade this many minutes before
close}

If ThisBar = 1                          {Set up initial conditions}
        then begin;
        NewHigh = Close;
        NewLow = Close;
        NewHighCount = 0;
        NewLowCount = 0;
        LocalNewHigh = Close;
        LocalNewLow = Close;
        LNHCount = 0;
        LNLCount = 0;
        Trend = 0;
        end;


IF TREND = 0 THEN BEGIN;                                {Look for new trend
to start}

If Close - NewHigh >= Mag points                        {Test for new
significant high close}
        then begin;
                NewHigh = Close;
                LocalNewLow = Close;
                LNLCount = 0    ;
        end     ;
        
If Close - LocalNewHigh >= Mag points   {Test for local new high close}
        then begin      ;
                LocalNewHigh = Close;
                LNHCount = LNHCount + 1 ;
                If PrintSW = 1 then
                        Print(Date:6:0, Time:5:0, " NH ", Trend:2:0,
Close:2:4,                              LNHCount:2:0  );
                If LNHCount >= Count
                        then begin      ;
                        Buy ("LNHCnt") next bar on the open;
                        Trend = 1       ;
                        end     ;
        end     ;

If NewLow - Close >= Mag points                 {Test for new significant
low close}
        then begin      ;
                NewLow = Close  ;
                LocalNewHigh = Close    ;
                LNHCount = 0    ;
        end     ;

If LocalNewLow - Close >= Mag points
        then begin      ;
                LocalNewLow = Close     ;
                LNLCount = LNLCount + 1 ;
                If PrintSW = 1 then
                        Print(Date:6:0, Time:5:0, " NL ", Trend:2:0,
Close:2:4,                                                     
LNLCount:2:0  );
                If LNLCount >= Count
                        then begin      ;
                        Sell ("LNLCnt") next bar on the open    ;
                        Trend = -1      ;
                        end     ;
        end     ;

END;    {of trend = 0}


If Trend = 1 THEN BEGIN;                                        {In uptrend
- look for reversal}
        
If Close - NewHigh >= Mag points                {Test for new high close}
        then begin      ;
                NewHigh = Close ;
                NewHighCount = NewHighCOunt + 1 ;
                NewLow = Close  ;
                NewLowCount = 0 ;
        end     ;

If NewLow - Close >= Mag points         {Test for new low close}
        then begin      ;
                NewLow = Close  ;
                NewLowCount = NewLowCount + 1   ;
                If PrintSW = 1 then
                        Print(Date:6:0, Time:5:0, " TNL ", Trend:2:0,
Close:2:4,                                                     
NewLowCount:2:0  );
                If NewLowCount >= Count
                        then begin      ;
                        Sell ("NLCnt") next bar on the open     ;
                        Trend = -1      ;
                end     ;
        end     ;

END;    {of uptrend testing}


If Trend = -1 THEN BEGIN        ;                               {In
downtrend - look for reversal}

If NewLow - Close >= Mag points
        then begin      ;
                NewLow = Close  ;
                NewLowCount = NewLowCount + 1   ;
                NewHigh = Close ;
                NewHighCount = 0        ;
        end     ;

If Close - NewHigh >= Mag points
        then begin      ;
                NewHigh = Close ;
                NewHighCount = NewHighCount + 1 ;
                If PrintSW = 1 then
                        Print(Date:6:0, Time:5:0, " TNH ", Trend:2:0,
Close:2:4,                                                     
NewHighCount:2:0  );
                If NewHighCount >= Count
                        then begin      ;
                                Buy ("NHCnt") next bar on the open      ;
                                Trend = 1       ;
                        end     ;
        end     ;

END;


                




{ - - - - - - - - - - -   EXIT CRITERIA - - - - - - - - - - - --  - - -}
{ExitLong ("AMA Low") StopLow STOP;}

{ExitShort ("AMA High") StopHigh STOP ;}



END;            {End of closing time window}


END;    {of date window}