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

Re: New sidewiner and pivots



PureBytes Links

Trading Reference Links

At 08:12 AM 5/12/2005, you wrote:

> Can someone convert these eld files to ela or els?

Here is the code for WOODIEPIVOTSAUTO. You can try to copy/paste into TS2000 and see if it will verify.

The code for SideWinder is locked.

Bob Fulks

------------------------------------------------------------------

Function: TL_Exist

inputs: TrendLineID( numericsimple ) ;
variables: NextID( 0 ) ;

Condition1 = false ;
NextID = TL_GetFirst( 3 ) ;

while NextID >= 0 
        begin
        if NextID = TrendLineID then
                begin
                Condition1 = true ;
                NextID = -2 ; { this short-circuits the loop }
                end
        else
                NextID = TL_GetNext( NextID, 3 ) ;
        end ;

TL_Exist = Condition1 ;


{ ** Copyright (c) 1991-2003 TradeStation Technologies, Inc. All rights reserved. ** 
  ** TradeStation reserves the right to modify or overwrite this analysis technique 
     with each release. ** }

{********************************************************************************
* Woodie Pivots - written by Abhijit Dey / adey@xxxxxxxxxx
* Date : 07/14/2003
* Kindly let me know your suggestions for improvements / bug reports.
* This code does not use Plot statements. So we avoid the chart "squishing" problem
* I am already aware of the following, and would add them later
  - Calculate them once a day & extend TL to right
* Menu option : View -> Easylanguage output bar; under "Print Log",
  today's values are printed
***** IMPORTANT - Use this indicator on Day session chart only *****
***** @ES.D or ESU03.D is fine; @ES or ESU03 is NOT fine       *****
***** Should work on hourly / minute / tick charts             *****
********************************************************************************}
input:
        {I suggest you leave this value to 10 or less;
         Any value entered which is more than 30 would be ignored;
         Drawing Trendlines is somewhat resource intensive. This default
         setting of 5 should suffice for everyday use}
        NumDaysToDrawPivots(1),

        {Pivot colors}
        PvColor(White), R1Color(Green), S1Color(Red), R2Color(Blue), S2Color(Magenta),
                
        {Do you want the Pv, S1, R1 etc. to be drawn next to the nines?}
        ShowPivotMarkers(false);

var:
        Pv(0), R1(0), S1(0), R2(0), S2(0),
        PvTextTLID(-1), R1TextTLID(-1), S1TextTLID(-1), R2TextTLID(-1), S2TextTLID(-1),
        FirstDateOnChart(0),
        TimeOfDaysFirstBar(0),
        NumDays(0), ArrayLocToUse(-1);

array:
        TLArray[30, 5](0);

{*******************************************************************************}
if(BarNumber = 1) then
begin
        FirstDateOnChart = Date;
        if(NumDaysToDrawPivots > 30) then
                NumDays = 30
        else
                NumDays = NumDaysToDrawPivots;
end;

if(Date <> Date[1]) then
begin
        TimeOfDaysFirstBar = Time;
        ArrayLocToUse = ArrayLocToUse + 1;
        if(ArrayLocToUse > NumDays - 1) then
                ArrayLocToUse = ArrayLocToUse - NumDays;
end;

if(Date > FirstDateOnChart and Date > JulianToDate(DateToJulian(Date) - NumDays)) then
begin
        for value1 = 0 to 4
        begin
                if(TL_Exist(TLArray[ArrayLocToUse, value1])) then
                        TL_Delete(TLArray[ArrayLocToUse, value1]);
        end;

        Pv = (HighD(1) + LowD(1) + OpenD(0)*2)/4;
        R1 = Pv*2 - LowD(1);
        S1 = Pv*2 - HighD(1);
        R2 = Pv + (R1 - S1);
        S2 = Pv - (R1 - S1);

        {Output today's values}
        if(Date = CurrentDate and Date <> Date[1]) then
        begin
                Print("Woodies pivots for " + ELDateToString(Date));
                Print("Pv = " + NumToStr(Pv, 2) + ", R1 = " + NumToStr(R1, 2) + ", S1 = " + NumToStr(S1, 2) + ", R2 = " + NumToStr(R2, 2) + ", S2 = " + NumToStr(S2, 2));
        end;

        TLArray[ArrayLocToUse, 0] = TL_New(Date, TimeOfDaysFirstBar, Pv, Date, Time, Pv);
        TL_SetStyle(TLArray[ArrayLocToUse, 0], Tool_Dotted);
        TL_SetColor(TLArray[ArrayLocToUse, 0], PvColor);
        if(LastBarOnChart) then
                TL_SetExtRight(TLArray[ArrayLocToUse, 0], true);

        TLArray[ArrayLocToUse, 1] = TL_New(Date, TimeOfDaysFirstBar, R1, Date, Time, R1);
        TL_SetStyle(TLArray[ArrayLocToUse, 1], Tool_Dotted);
        TL_SetColor(TLArray[ArrayLocToUse, 1], R1Color);
        if(LastBarOnChart) then
                TL_SetExtRight(TLArray[ArrayLocToUse, 1], true);

        TLArray[ArrayLocToUse, 2] = TL_New(Date, TimeOfDaysFirstBar, S1, Date, Time, S1);
        TL_SetStyle(TLArray[ArrayLocToUse, 2], Tool_Dotted);
        TL_SetColor(TLArray[ArrayLocToUse, 2], S1Color);
        if(LastBarOnChart) then
                TL_SetExtRight(TLArray[ArrayLocToUse, 2], true);

        TLArray[ArrayLocToUse, 3] = TL_New(Date, TimeOfDaysFirstBar, R2, Date, Time, R2);
        TL_SetStyle(TLArray[ArrayLocToUse, 3], Tool_Dotted);
        TL_SetColor(TLArray[ArrayLocToUse, 3], R2Color);
        if(LastBarOnChart) then
                TL_SetExtRight(TLArray[ArrayLocToUse, 3], true);

        TLArray[ArrayLocToUse, 4] = TL_New(Date, TimeOfDaysFirstBar, S2, Date, Time, S2);
        TL_SetStyle(TLArray[ArrayLocToUse, 4], Tool_Dotted);
        TL_SetColor(TLArray[ArrayLocToUse, 4], S2Color);
        if(LastBarOnChart) then
                TL_SetExtRight(TLArray[ArrayLocToUse, 4], true);

        if(ShowPivotMarkers) then
        begin
                if(PvTextTLID = -1) then
                        PvTextTLID = Text_New(Date, Time + BarInterval*2, Pv, "Pv")
                else
                        Text_SetLocation(PvTextTLID, Date, Time + BarInterval*2, Pv);
        
                if(R1TextTLID = -1) then
                        R1TextTLID = Text_New(Date, Time + BarInterval*2, R1, "R1")
                else
                        Text_SetLocation(R1TextTLID, Date, Time + BarInterval*2, R1);
        
                if(S1TextTLID = -1) then
                        S1TextTLID = Text_New(Date, Time + BarInterval*2, S1, "S1")
                else
                        Text_SetLocation(S1TextTLID, Date, Time + BarInterval*2, S1);
        
                if(R2TextTLID = -1) then
                        R2TextTLID = Text_New(Date, Time + BarInterval*2, R2, "R2")
                else
                        Text_SetLocation(R2TextTLID, Date, Time + BarInterval*2, R2);
        
                if(S2TextTLID = -1) then
                        S2TextTLID = Text_New(Date, Time + BarInterval*2, S2, "S2")
                else
                        Text_SetLocation(S2TextTLID, Date, Time + BarInterval*2, S2);
        
                Text_SetColor(PvTextTLID, PvColor);
                Text_SetColor(R1TextTLID, R1Color);
                Text_SetColor(S1TextTLID, S1Color);
                Text_SetColor(R2TextTLID, R2Color);
                Text_SetColor(S2TextTLID, S2Color);
        end;
end