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

ActiveTrendLine Function



PureBytes Links

Trading Reference Links

> Subject: EL Help - Coding Trendlines
> Date: Wed, 21 Jan 1998 16:39:23 -0500
> From: "Jay Poswolsky" <jaytradr@xxxxxxxxxxxxx>
> To: <omega-list@xxxxxxxxxx>
> 
> I've been trying to code an EL system that would  exit positions when the
> price penetrates a trendline.  This is often an effective way of keeping
> your profits.  I am unable to follow the examples in Omega's EL book and
> would very much appreciate someone posting the code to incorporate
> Trendlines in an intraday system.
> 
> Thanks to all in advance,
> 
> Jay Poswolsky
> Dans un courrier daté du 20/01/98 05:

Jay, I think this is what you want.
{ActiveTrendLine}
Inputs: OwndPref(NumericSimple);
{*********************************************************************************
>From Omega Documentation
OwnedPref = 1 = first created by current analysis technique
            2 = first created by user or other thechnique
            3 = first created by all techniques
Note: Input values other than 1, 2 or 3 will cause the function to
assume an input value of 3. 
**********************************************************************************}
Vars: BeginDate(0), EndDate(0), ReturnValue(0), LoopControl(FALSE),
RefNum(0);

LoopControl = False;     
RefNum= TL_GetFirst(OwndPref);              
ReturnValue = 0;
While LoopControl = False and RefNum >= 0 begin          
               BeginDate = TL_GetBeginDate(RefNum);
               EndDate = TL_GetEndDate(RefNum) ;
               if Date >= BeginDate and Date <= EndDate
                   then begin
                   ReturnValue = TL_GetValue(RefNum,Date,1600);
                   LoopControl = True;
                   end;
               if LoopControl = False then
                   RefNum=
TL_GetNext(RefNum,OwndPref);                                                              
             end;
ActiveTrendLine = ReturnValue;



Regards,

Michael