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

[RT] Bars_Price_Since_Pvt: -- Refinements



PureBytes Links

Trading Reference Links

Hello all

Thanks to Clyde Lee and his precious contribution to the list(s), I take 
the opportunity to offer a little bit. Enclosed you will find two 
studies- variations based on Clyde's work, a picture of what they look 
like and the code in text form should any of you would like to check for 
yourselves.

Basically, it is Clyde's work with more bells and whistles; all 
parametrical that allow us to choose how we want the info displayed.
It is about two studies. The first deals with Cumulative Volume (see 
code below) and the other adds some filters to the way info is treated 
and displayed. Those of you who have a more responsive and smoother 
algorithm than T3Average (Mark Juric's Adaptive Average, for instance) 
are encouraged to use it.

It took me some time to prepare it and I give it to you with all my 
appreciation. I hope you welcome it.

Regards
Zarifis Dimitroulis

***************************************************************************

{Indicator:  Bars-Price_Since_Pvt

 Purpose:  Display the number of bars and/or the price difference since the
           last detected pivot using Swing_Lee_Simple.
           Note that if both elements are to be plotted on the same graph
           it will be necessary to use the ScalPric parameter
           (which is a multiplier for the price difference computed)
           to get the price range and bar range to be approximately the 
same.
           For the QQQ that value is around 20;

 Author:         Clyde Lee, Copyright SYTECH Corporation 2002

 Permission:    This application may be used/distributed for non commercial
                purposes by including above information/credit.

Comment:    Zarifis Dimitroulis made a few changes-modifications to the 
original code provided by Clyde Lee.
            Namely, the Swing_Lee function changed to series to include 
variable time length... FourPeriod and Hilbert come to mind.
            Also, better graphics have been added to make look better.
            However, should one prefer to revert back to the original 
code, one must select KeepCode=True
            else the detailed graphics and the auto adjust for ScalePric 
take place.

Zarifis Dimitroulis Nov, 14 2002
}

Input:     NBars(13),       {Number of bars to be used by 
Swing_Lee_Simple to pick pivot points.                      }
           ScalPric(1),     {Scaling factor to apply to price to put in 
same range as the bars plot if doing both.    }
           DoPlots(2),      {-1=CumVol, 0=bars, 1=price, >1=both price 
and bars and CumVol if selected                }
           KeepCode(False),
           Smooth(True),
           PlotCumV(True),
           SmoothCV(True),
           Normal_V(True),    {A re-scaled Volume may be a better choice 
since every security is a different case by itself.
                                However, if unscaled Volume is prefered, 
then set Normal_V to False.}
    ShowHelp(True);

Vars:    Direct(0), HoldPrice(0), HoldBars(0), StepBack(0),
         PlotBars(0), PlotPrice(0), BarsSD(0), PriceSD(0), X1(0), 
CumVol(0), HoldVol(0);

If ShowHelp then begin
    Commentary(" Comment: Zarifis Dimitroulis made a few 
changes-modifications to the original");
    Commentary(" code provided by Clyde Lee. Namely, the Swing_Lee 
function changed to series");
    Commentary(" to include variable time length... FourPeriod and 
Hilbert come to mind."+NewLine);
    Commentary(" Also, better graphics have been added to make look 
better. However, should ");
    Commentary(" one prefer to revert back to the original code, one 
must select KeepCode=True.");
    Commentary(" Else, the  detailed graphics and the auto adjust for 
ScalePric take place. ");
    Commentary(" Regarding Cumulative Volume, there is provision for 
auto rescale");
    Commentary(" since every security is a different case by itself. If 
that is not what ");
    Commentary(" you want, set Normal_V to False."+NewLine);
    Commentary(" Enjoy.");
end;

{Direct = Swing_Lee_Simple(NBars,false);} {ZaF's modification to include 
a variable time span ... see Hilbert}
Direct = Swing_Lee_Series(NBars,false);

StepBack=0;

If Sign(Direct)<>Sign(Direct[1]) and Direct[1]<>0 then begin        { * 
* * change of trend * * * }
    StepBack=AbsValue(direct);
    HoldBars=CurrentBar-StepBack;
    If Direct>0
        then HoldPrice=L[direct]
        else  HoldPrice=H[direct];
    CumVol=0;
    HoldVol=Volume[AbsValue(Direct)];
    if SmoothCV then HoldVol=Average(HoldVol, Nbars);
End;

If Direct<>0 and Direct[1]<>0 then begin                        { * * * 
trend continuation * * * }
  For Value1=StepBack downto 0 begin
    If Direct>0 then Value9=L[Value1] else Value9=H[Value1];
        PlotPrice=(Value9-HoldPrice);
        PlotBars =(CurrentBar-Value1-HoldBars)*Sign(Direct);
            If Normal_V=True then
            if Direct>0 then CumVol=CumVol+iff(HoldVol<>0, 
Volume/HoldVol, 0)
                else CumVol=CumVol-iff(HoldVol<>0, Volume/HoldVol, 0)
            else
            if Direct>0 then CumVol=CumVol+Volume
                else CumVol=CumVol-Volume;

If KeepCode=False then                         {a multiplier of 1.5 is 
added for better appearance}
If PlotPrice<>0 then X1=1.5*AbsValue(PlotBars)/AbsValue(PlotPrice) else 
X1=1.5*AbsValue(PlotBars)
else
X1=ScalPric;

    If DoPlots>1 then begin
{        PlotPrice=PlotPrice*ScalPric;}
        PlotPrice=PlotPrice*X1;
            If KeepCode=False and Smooth=True then 
PlotPrice=T3AverageFast(PlotPrice, 0.5*NBars);
            If KeepCode=True and Smooth=True then 
PlotPrice=T3AverageFast(PlotPrice, 0.5*NBars);

            Plot1(PlotPrice,"PR");
            Plot2(PlotBars, "BR");
            if PlotCumV then Plot3(CumVol, "CumVol");
        End
        Else If DoPlots=0 then begin
{            PlotPrice=PlotPrice*ScalPric;}
            PlotPrice=PlotPrice*x1;
            If KeepCode=False and Smooth=True then 
PlotPrice=T3AverageFast(PlotPrice, 0.5*NBars);
            If KeepCode=True and Smooth=True then 
PlotPrice=T3AverageFast(PlotPrice, 0.5*NBars);

            Plot1(PlotPrice,"PR");
            Plot2(0,"BR");
            if PlotCumV then Plot3(CumVol, "CumVol");
        End
        Else If DoPlots=1 then begin
            Plot2(PlotBars, "BR");
            if PlotCumV then Plot3(CumVol, "CumVol");
        End
        Else If DoPlots=-1 then begin
            Plot3(CumVol, "CumVol");
      End;

    End;

End;

*************************************************************************
*************************************************************************
{Indicator:  Bars-Price_Since_Pvt

 Purpose:  Display the number of bars and/or the price difference since the
           last detected pivot using Swing_Lee_Simple.
           Note that if both elements are to be plotted on the same graph
           it will be necessary to use the ScalPric parameter
           (which is a multiplier for the price difference computed)
           to get the price range and bar range to be approximately the 
same.
           For the QQQ that value is around 20;

 Author:         Clyde Lee, Copyright SYTECH Corporation 2002

 Permission:    This application may be used/distributed for non commercial
                purposes by including above information/credit.

Comment:    Zarifis Dimitroulis made a few changes-modifications to the 
original code provided by Clyde Lee.
            Namely, the Swing_Lee function changed to series to include 
variable time length... FourPeriod and Hilbert come to mind.
            Also, better graphics have been added to make look better.
            However, should one prefer to revert back to the original 
code, one must select KeepCode=True
            else the detailed graphics and the auto adjust for ScalePric 
take place. There is also provision for
            a cutoff of information of choppy areas of the graph.

Zarifis Dimitroulis Nov, 14 2002
}

Input:  NBars(13),           {Number of bars to be used by 
Swing_Lee_Simple to pick pivot points.                    }
        ScalPric(1),          {Scaling factor to apply to price to put 
in same range as the bars plot if doing both. }
        DoPlots(2),           {0=bars, 1=price, >1=both);                
                                            }
        KeepCode(False),
        Smooth(True),
        CutOff(False),
        CutOffCh(0.5),
        ShowHelp(False);

Vars:   Direct(0), HoldPrice(0), HoldBars(0), StepBack(0), PlotBars(0), 
PlotPrice(0),
        BarsSD(0), PriceSD(0), x1(0), x21(0), x22(0), Condition1(False), 
Condition2(False);

{Direct = Swing_Lee_Simple(NBars,false);}         {ZaF's modification to 
include a variable time span ... see Hilbert}

Direct = Swing_Lee_Series(NBars,false);
StepBack=0;

If ShowHelp then begin
    Commentary(" Comment: Zarifis Dimitroulis made a few 
changes-modifications to the original");
    Commentary(" code provided by Clyde Lee. Namely, the Swing_Lee 
function changed to series");
    Commentary(" to include variable time length... FourPeriod and 
Hilbert come to mind."+NewLine);
    Commentary(" Also, better graphics have been added to make look 
better. However, should ");
    Commentary(" one prefer to revert back to the original code, one 
must select KeepCode=True.");
    Commentary(" Else, the  detailed graphics and the auto adjust for 
ScalePric take place. ");
    Commentary("  Also, there is provision for the CutOff Channel width 
as a multiplier ");
    Commentary(" of the StdDev.");
end;

If Sign(Direct)<>Sign(Direct[1]) and Direct[1]<>0 then begin  { * * * 
change of trend * * * }
    StepBack=AbsValue(direct);
    HoldBars=CurrentBar-StepBack;
    If Direct>0 then HoldPrice=L[direct] else  HoldPrice=H[direct];

            if Plotbars>0 then x21=Average(PlotBars, 
NBars)+CutOffCh*StdDev(PlotBars, NBars);
            if Plotbars<0 then x22=Average(PlotBars, 
NBars)-CutOffCh*StdDev(PlotBars, NBars);
End;

If Direct<>0 and Direct[1]<>0 then begin                 { * * * trend 
continuation * * * }
  For Value1=StepBack downto 0 begin
        If Direct>0 then Value9=L[Value1] else Value9=H[Value1];
        PlotPrice=(Value9-HoldPrice);
        PlotBars =(CurrentBar-Value1-HoldBars)*Sign(Direct);

            If KeepCode=False then             {a multiplier of 1.5 is 
added for better appearance}
                begin
                if PlotPrice<>0 then 
x1=1.5*AbsValue(PlotBars)/AbsValue(PlotPrice) else 
x1=1.5*AbsValue(PlotBars);
                end
            else
            X1=ScalPric;
            end;

            PlotPrice=PlotPrice*x1;
            Condition1=cutoff=true;
            Condition2=(plotbars<0 and x22>plotbars) or (plotbars>0 and 
x21<plotbars);

        If DoPlots>1 then
            begin
                If KeepCode=False and Smooth=True then 
PlotPrice=T3AverageFast(PlotPrice, 0.5*NBars);
                If KeepCode=True and Smooth=True then 
PlotPrice=T3AverageFast(PlotPrice, 0.5*NBars);

                if PlotPrice>0 then begin
                        if condition1=false or (condition1=true and 
condition2=true) then begin
                            Plot1(PlotPrice,"PR");
                            Plot3(0, "PR");
                        end;
                    end
                else begin
                        if condition1=False or (condition1=true and 
condition2=true) then
                            begin
                                Plot1(0,"PR");
                                Plot3(PlotPrice, "PR");
                            end;
                    end;
                if condition1=False or (condition1=true and 
condition2=true) then
                        begin
                            if PlotBars>0 then Plot2(PlotBars, "BR") 
else Plot4(PlotBars, "BR");
                        End;
            End
        Else If DoPlots=0 then
            begin
                If KeepCode=False and Smooth=True then 
PlotPrice=T3AverageFast(PlotPrice, 0.5*NBars);
                If KeepCode=True and Smooth=True then 
PlotPrice=T3AverageFast(PlotPrice, 0.5*NBars);

                if PlotPrice>0 then
                    begin
                        if condition1=False or (condition1=true and 
condition2=true) then begin
                            Plot1(PlotPrice,"PR");
                            Plot3(0, "PR");
                        end;
                    end
                else begin
                        if condition1=False or (condition1=true and 
condition2=true) then begin
                            Plot1(0,"PR");
                            Plot3(PlotPrice, "PR");
                        end;
                    end;
                        if condition1=False or (condition1=true and 
condition2=true) then Plot2(0,"BR");
            End
        Else If DoPlots=1 then
                    begin
                        if condition1=False or (condition1=true and 
condition2=true) then
                            begin
                                if PlotBars>0 then Plot2(PlotBars, "BR") 
else Plot4(PlotBars, "BR");
                                Plot1(0,"PR");
                            End;
                    End;
End;


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Share the magic of Harry Potter with Yahoo! Messenger
http://us.click.yahoo.com/4Q_cgB/JmBFAA/46VHAA/zMEolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
realtraders-unsubscribe@xxxxxxxxxxxxxxx

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


Attachment: Description: ""

Attachment: Description: "ZD_BARSP.ELA"