Announcement

Collapse
No announcement yet.

squeeze indicator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • squeeze indicator

    I am new to esignal and have easy language doc and .eld files I found in TradeStation for a squeeze indicator that I have been using. I have found something similiar here but not quite, in my document there is more info used. I am trying to convert the easy language info below into a .efs file i can use here. Any help would be appreciated.

    {@@14439@@}
    {04/05/2006}
    //Updated by TradingDude, fixed "division by zero error"

    {02/16/2005}
    {Updated by Redlock}
    {
    Well, I have been working in this indicator. I have made a couple of changes:
    (1) that if the momentum changes direction, it changes color.
    (2) I have taken out the plotting of the alertline
    (3) have the dots plotted along the axis
    (4) Have changed the name of the indicator to BBSqueeze (cuts down on confusion).

    I think that you will find that it resembles what is on the TTM indicator.}

    {------------------------------------------------------------------}
    {mmillar, 05/12/2005
    For anyone interested I made a small change to the indicator(s) above.
    I found that the indicator displayed fine for ES, YM etc but screwed up for FX -
    this is due to the number of decimal places used by the symbol.
    I just added a multiplier so the indicator is normalised across all symbols.

    Add the following lines...
    Vars: LHMult(0);
    if ( barnumber=1 ) then Begin
    LHMult=pricescale/minmove;
    end;

    And modify the following line so that it includes the LHMult variable...

    Plot3(value2*LHMult, "NickmNxtMove", color);

    }

    { Bolinger Band Squeeze (BBS) Indicator }

    { A variation of an idea by nickm001 (Originally coded by eKam) that when Bollinger Bands (BB) fit inside
    the Keltner Channel (KC), a breakout is about to occur. It works on longer term charts, such as
    15 minute to daily charts.

    This code creates an indicator that plots the ratio of BB width to KC width. When BB and KC widths are
    the same, the ratio (BBS_Ind)is equal to one (1). When the BB width is less than the KC Width (i.e. BB
    fit inside KC), the BBS_Ind is less than one and a breakout is indicated.

    An Alert Line is provided to indicate the level at which the trader considers that the "sqeeze is on" and
    a breakout is eminant.

    Coded by Kahuna 9/10/2003

    Added by eKam: 9/10/2003
    The average of where price has been relative to the Donchian mid line and Exponential average of the
    same length is also plotted as an attempt to predict the direction of the breakout.

    Added 2/1/2005 For decreasing Delta bar....darker colors to highlight the change.}

    Inputs: {------------------------------------------------}
    Price(Close),
    Length(15), { Length for Average True Range (ATR) & Std. Deviation (SD) Calcs }
    nK(1.5), { Keltner Channel ATRs from Average }
    nBB(2), { Bollinger Band Std. Devs. from Average }
    AlertLine( 1 ), { BBS_Index level at which to issue alerts }
    NormalColor( Red ), { Normal color for BBS_Ind }
    AlertlColor( Blue ); { Color for BBS_Ind below alert line }


    Variables: {---------------------------------------------}
    ATR(0), { Average True Range }
    SDev(0), { Standard Deviation }
    BBS_Ind(0), { Bollinger Band Squeeze Indicator }
    alertTextID(-1),
    Denom(0),
    LHMult(0);



    if ( barnumber=1 ) then
    Begin
    If minmove <> 0 then
    LHMult = pricescale/minmove;
    end;

    if barnumber = 1 and alertTextID = -1 then
    alertTextID = Text_New(date,time,0,"dummy");

    {-- Calculate BB Squeeze Indicator ----------------------}
    ATR = AvgTrueRange(Length);
    SDev = StandardDev(Price, Length, 1);

    Denom = (nK*ATR);
    If Denom <> 0 then
    BBS_Ind = (nBB * SDev) /Denom;

    If BBS_Ind < Alertline then
    SetPlotColor(1, NormalColor)
    else
    SetPlotColor(1, AlertlColor);

    {-- Plot the Index & Alert Line -------------------------}
    Plot1(0, "BBS_Ind");

    {-- Plot delta of price from Donchian mid line ----------}
    value2 = LinearRegValue(price-((Highest(H, Length)+Lowest(L, Length))/2
    + xAverage(c,Length))/2,Length,0);

    var:color(0); color = yellow;

    if value2 > 0 then
    if value2 > value2[1] then
    color = green
    else
    color = darkgreen;

    if value2 < 0 then
    if value2 < value2[1] then color = red
    else
    color = darkred;

    Plot3(value2*LHMult, "NickmNxtMove", color);
    {plot3(value2,"BB Squeeze",color);}

    {-- Issue Alert when the Squeeze is On ------------------}
    if BBS_Ind crosses below AlertLine
    and Text_GetTime(alertTextID) <> time then
    begin
    text_setLocation(alertTextID, date, time, 0);
    Alert("BB Squeeze Alert");
    end;

    {-- Issue Alert when the Squeeze Releases ---------------}
    if BBS_Ind crosses above AlertLine
    and Text_GetTime(alertTextID) <> time then
    begin
    text_setLocation(alertTextID, date, time, 0);
    Alert("BB Squeeze Is Over");
    end;

  • #2
    Re: squeeze indicator

    Hi gopattio,

    There is a lot of code here so I cannot do all of it but I will get you started. Here is the first code snippet for handling the inputs:


    /*========================================
    REVISION HISTORY:
    04/05/2006
    Updated by TradingDude, fixed "division by zero error"
    _______________
    02/16/2005
    Updated by Redlock
    Well, I have been working in this indicator. I have made a couple of changes:
    (1) that if the momentum changes direction, it changes color.
    (2) I have taken out the plotting of the alertline
    (3) have the dots plotted along the axis
    (4) Have changed the name of the indicator to BBSqueeze (cuts down on confusion).
    I think that you will find that it resembles what is on the TTM indicator.}
    _______________
    mmillar, 05/12/2005
    For anyone interested I made a small change to the indicator(s) above. I found that the indicator displayed fine for ES, YM etc but screwed up for FX - this is due to the number of decimal places used by the symbol. I just added a multiplier so the indicator is normalised across all symbols.

    Add the following lines...
    Vars: LHMult(0);
    if ( barnumber=1 ) then Begin
    LHMult=pricescale/minmove;
    end;

    And modify the following line so that it includes the LHMult variable...

    Plot3(value2*LHMult, "NickmNxtMove", color);
    _______________
    Bolinger Band Squeeze (BBS) Indicator
    A variation of an idea by nickm001 (Originally coded by eKam) that when Bollinger Bands (BB) fit inside
    the Keltner Channel (KC), a breakout is about to occur. It works on longer term charts, such as
    15 minute to daily charts.

    This code creates an indicator that plots the ratio of BB width to KC width. When BB and KC widths are
    the same, the ratio (BBS_Ind)is equal to one (1). When the BB width is less than the KC Width (i.e. BB
    fit inside KC), the BBS_Ind is less than one and a breakout is indicated.

    An Alert Line is provided to indicate the level at which the trader considers that the "sqeeze is on" and
    a breakout is eminant.

    Coded by Kahuna 9/10/2003
    _______________
    Added by eKam: 9/10/2003
    The average of where price has been relative to the Donchian mid line and Exponential average of the
    same length is also plotted as an attempt to predict the direction of the breakout.
    _______________
    Added 2/1/2005 For decreasing Delta bar....darker colors to highlight the change.}

    USAGE:
    Price = price to be used; default value is Close
    Length = Length for Average True Range (ATR) & Std. Deviation (SD) Calcs; default value is 15
    nK = Keltner Channel ATRs from Average; default value is 1.5
    nBB = Bollinger Band Std. Devs. from Average; default value is 2
    AlertLine = BBS_Index level at which to issue alerts; default value is 1.
    NormalColor = Normal color for BBS_Ind; default value is red.
    AlertlColor = Color for BBS_Ind below alert line; default value is blue.

    COLORS AND STYLES:
    Place here the color scheme you wish to use as default, if you wish.
    1. Normal color for BBS_Ind is red.
    2. Color for BBS_Ind below alert line is blue.

    OBSERVATIONS:
    1. This study is normally evaluated on the close of each bar.
    *Change this if desired.

    ************************************************** */
    var aFPArray = new Array();

    function preMain() {
    var x;
    setPriceStudy(true);
    setStudyTitle("Squeeze Indicator");
    setShowTitleParameters( false );
    setShowCursorLabel(false); // supresses this study's label in cursor window
    setComputeOnClose(); // forces this study to only update on each new bar

    //initialize formula parameters
    x=0;
    aFPArray[x] = new FunctionParameter("price", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("Price");
    setDefault("close");
    }
    aFPArray[x] = new FunctionParameter("length", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("Length");
    setsetLowerLimit( 1 );
    setDefault(15);
    }
    aFPArray[x] = new FunctionParameter("nK", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("nK");
    setLowerLimit(0); //change this if nK can't = 0
    setDefault(1.5);
    }
    aFPArray[x] = new FunctionParameter("nBB", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("nBB");
    setLowerLimit(0);//change this if nBB can't = 0
    setDefault(2);
    }
    aFPArray[x] = new FunctionParameter("alertLine", FunctionParameter.NUMBER);
    with(aFPArray[x++]) {
    setName("Alert Line");
    setLowerLimit(0);//change this if can't = 0 setDefault(1);
    }
    aFPArray[x] = new FunctionParameter("normalColor", FunctionParameter.COLOR);
    with(aFPArray[x++]) {
    setName("Normal Color");
    setDefault(Color.red);
    }
    aFPArray[x] = new FunctionParameter("alertColor", FunctionParameter.COLOR);
    with(aFPArray[x++]) {
    setName("Alert Color");
    setDefault(Color.blue);
    }
    askForInput("Squeeze Indicator"); // force the script parameter menu to be displayed when the script
    // is first loaded.
    }

    function main(price, length, nK, nBB, alertLine, normalColor,
    alertlColor) {

    var ATR = 0; // Average True Range
    var SDev = 0; // Standard Deviation
    var BBS_Ind = 0; // Bollinger Band Squeeze Indicator
    var alertTextID = -1;
    var Denom = 0;
    var LHMult = 0;
    var pricescale = 1; // I placed this default value here but you need to set your own value here or as an input
    var minmove = 1; // I placed this default value here but you need to set your own value here or as an input
    // you need to decide if the above variables are global or local, If global, then place them before the function main(...) and remove from the main.
    if(getCurrentBarIndex() == 0) {
    if (minmove != 0} {
    LHMult = pricescale/minmove;
    } else {
    return;
    }
    }
    }

    The above should get you started. You can make the code more beautiful by aligning and spacing, I do see amajor problem. Your variable minmove and pricescale are not defined. You need to either input them or give them some initial value or...

    Hope this helps.
    Regards,
    Jane


    Originally posted by gopattio
    I am new to esignal and have easy language doc and .eld files I found in TradeStation for a squeeze indicator that I have been using. I have found something similiar here but not quite, in my document there is more info used. I am trying to convert the easy language info below into a .efs file i can use here. Any help would be appreciated.

    {@@14439@@}
    {04/05/2006}
    //Updated by TradingDude, fixed "division by zero error"

    {02/16/2005}
    {Updated by Redlock}
    {
    Well, I have been working in this indicator. I have made a couple of changes:
    (1) that if the momentum changes direction, it changes color.
    (2) I have taken out the plotting of the alertline
    (3) have the dots plotted along the axis
    (4) Have changed the name of the indicator to BBSqueeze (cuts down on confusion).

    I think that you will find that it resembles what is on the TTM indicator.}

    {------------------------------------------------------------------}
    {mmillar, 05/12/2005
    For anyone interested I made a small change to the indicator(s) above.
    I found that the indicator displayed fine for ES, YM etc but screwed up for FX -
    this is due to the number of decimal places used by the symbol.
    I just added a multiplier so the indicator is normalised across all symbols.

    Add the following lines...
    Vars: LHMult(0);
    if ( barnumber=1 ) then Begin
    LHMult=pricescale/minmove;
    end;

    And modify the following line so that it includes the LHMult variable...

    Plot3(value2*LHMult, "NickmNxtMove", color);

    }

    { Bolinger Band Squeeze (BBS) Indicator }

    { A variation of an idea by nickm001 (Originally coded by eKam) that when Bollinger Bands (BB) fit inside
    the Keltner Channel (KC), a breakout is about to occur. It works on longer term charts, such as
    15 minute to daily charts.

    This code creates an indicator that plots the ratio of BB width to KC width. When BB and KC widths are
    the same, the ratio (BBS_Ind)is equal to one (1). When the BB width is less than the KC Width (i.e. BB
    fit inside KC), the BBS_Ind is less than one and a breakout is indicated.

    An Alert Line is provided to indicate the level at which the trader considers that the "sqeeze is on" and
    a breakout is eminant.

    Coded by Kahuna 9/10/2003

    Added by eKam: 9/10/2003
    The average of where price has been relative to the Donchian mid line and Exponential average of the
    same length is also plotted as an attempt to predict the direction of the breakout.

    Added 2/1/2005 For decreasing Delta bar....darker colors to highlight the change.}

    Inputs: {------------------------------------------------}
    Price(Close),
    Length(15), { Length for Average True Range (ATR) & Std. Deviation (SD) Calcs }
    nK(1.5), { Keltner Channel ATRs from Average }
    nBB(2), { Bollinger Band Std. Devs. from Average }
    AlertLine( 1 ), { BBS_Index level at which to issue alerts }
    NormalColor( Red ), { Normal color for BBS_Ind }
    AlertlColor( Blue ); { Color for BBS_Ind below alert line }


    Variables: {---------------------------------------------}
    ATR(0), { Average True Range }
    SDev(0), { Standard Deviation }
    BBS_Ind(0), { Bollinger Band Squeeze Indicator }
    alertTextID(-1),
    Denom(0),
    LHMult(0);



    if ( barnumber=1 ) then
    Begin
    If minmove <> 0 then
    LHMult = pricescale/minmove;
    end;

    if barnumber = 1 and alertTextID = -1 then
    alertTextID = Text_New(date,time,0,"dummy");

    {-- Calculate BB Squeeze Indicator ----------------------}
    ATR = AvgTrueRange(Length);
    SDev = StandardDev(Price, Length, 1);

    Denom = (nK*ATR);
    If Denom <> 0 then
    BBS_Ind = (nBB * SDev) /Denom;

    If BBS_Ind < Alertline then
    SetPlotColor(1, NormalColor)
    else
    SetPlotColor(1, AlertlColor);

    {-- Plot the Index & Alert Line -------------------------}
    Plot1(0, "BBS_Ind");

    {-- Plot delta of price from Donchian mid line ----------}
    value2 = LinearRegValue(price-((Highest(H, Length)+Lowest(L, Length))/2
    + xAverage(c,Length))/2,Length,0);

    var:color(0); color = yellow;

    if value2 > 0 then
    if value2 > value2[1] then
    color = green
    else
    color = darkgreen;

    if value2 < 0 then
    if value2 < value2[1] then color = red
    else
    color = darkred;

    Plot3(value2*LHMult, "NickmNxtMove", color);
    {plot3(value2,"BB Squeeze",color);}

    {-- Issue Alert when the Squeeze is On ------------------}
    if BBS_Ind crosses below AlertLine
    and Text_GetTime(alertTextID) <> time then
    begin
    text_setLocation(alertTextID, date, time, 0);
    Alert("BB Squeeze Alert");
    end;

    {-- Issue Alert when the Squeeze Releases ---------------}
    if BBS_Ind crosses above AlertLine
    and Text_GetTime(alertTextID) <> time then
    begin
    text_setLocation(alertTextID, date, time, 0);
    Alert("BB Squeeze Is Over");
    end;

    Comment


    • #3
      Squeeze

      This is exactly what I have been searching hiogh and low for, how do I get hold of a down load file i.e. efs type file?

      Comment


      • #4
        Re: Squeeze

        Hi charliet,

        I am not sure what type of file you are looking for. Please clarify. Thanks.
        Regards,
        Jane

        Originally posted by charliet
        This is exactly what I have been searching hiogh and low for, how do I get hold of a down load file i.e. efs type file?

        Comment


        • #5
          File Availability

          Is there an efs file that I can download for the Bollinger Squeeze as per the code below. It is the indicator that alerts when the Bollinger Bands exit the Keltner channel. Further development has also included a histogram indicator.

          Comment


          • #6
            Re: File Availability

            Hi charliet,

            I don't believe that the specific code you are looking for exists on this site. However, there is code that may help you to the point that you can adapt it to your needs.

            If you right click on your chart and move the cursor to Formulas you will get a drop down box with a variety of built in studies. The fifth folder from the top is Bollinger. It contains a number of studies that may be useful. Also, TS Support has provided a code called BB_RSIAverage.efs which plots Bollinger bands, moving average and RSI. Perhaps you can adapt one of these to your needs.

            Re Keltner channels, there are three studies in the Library folder inside the formula folder. Also, check out this thread:

            http://forum.esignalcentral.com/show...ltner+channels

            I hope this helps.
            Regards,
            Jane


            Originally posted by charliet
            Is there an efs file that I can download for the Bollinger Squeeze as per the code below. It is the indicator that alerts when the Bollinger Bands exit the Keltner channel. Further development has also included a histogram indicator.

            Comment


            • #7
              Hi,

              Looks like someone has coded the Squeeze indicator and posted it to File Sharing. I found it by just by doing a search for "squeeze":

              http://share.esignal.com/groupconten...rs&groupid=852

              Comment


              • #8
                squeeze efs..

                i followed that link and downloaded the efs...it plots well. I was wondering if you canexplain the colorcodes...or maybe point me in the right direction to find out the explanation...thanks in advance.
                Pete

                Comment

                Working...
                X