Announcement

Collapse
No announcement yet.

Demand index

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

  • Demand index

    Is there a possibility to have this version of "Demand index" coded?

    Thanks

    (Formula above)
    Last edited by pbereau; 10-31-2006, 06:59 PM.

  • #2
    Formula

    This one is An Amibroker formula:

    It can be called a (19, 19, 30) Demand Index... 30 the demand index ma length...and 19 Buy/sell power length & Buy/sell moving average length...


    Details:
    Formula name: Demand Index
    Author/Uploader: Steve Wiser - slwiserr [at] erols.com
    Date/Time added: 2001-07-05 19:12:36
    Origin:
    Keywords:
    Level: medium
    Flags: system,exploration,indicator

    DISCLAIMER: Most formulas present in AFL on-line library are submitted by the users and are provided here on an "as is" and "as available" basis. AmiBroker.com makes no representations or warranties of any kind to the contents or the operation of material presented here. We do not maintain nor provide technical support for 3rd party formulas.

    Download formula file | Delete formula

    Description:
    Uses the demand index for a system test.

    Formula:
    /* Demand Index */
    /* Steve Wiser at [email protected] */
    /* Exploration, System and indicator */

    GraphMax=9;

    A=(H+L+2*C);
    B=ema((HHV(H,2)-LLV(L,2)),19);
    BuyP=
    /*{BuyPower}*/
    V/ema(V,19) * ((A>=Ref(A,-1)) +(A<Ref(A,-1)) / Exp((0.375 * (A+Ref(A,-1)) /B )
    *(Ref(A,-1)-A) / A));

    SellP =
    /*{SellPressure}*/
    V/ema(V,19) * ((A<=Ref(A,-1)) + (A>Ref(A,-1)) / Exp((0.375 * (A+Ref(A,-1)) / B
    ) * (A-Ref(A,-1)) / Ref(A,-1)));


    mabp=ema(BuyP,19);
    masp=ema(SellP,19); /*{smooth Selling Pressure}*/
    divsor=iif(mabp>masp,mabp,masp); /*{BP:SP ratio}*/
    divend=iif(mabp<masp,mabp,masp); /*{biggest=divisor}*/
    var2=1-(divend/divsor); /*{adjust ratio to plot
    in}*/
    var3=iif( (masp>mabp) , -var2 , var2 ) ; /*{range -100 to 100}*/
    var4=var3*100;
    Graph1 = var4;
    Graph1Style=5;

    var5=ma(var4,30);
    Graph2=var5;;
    Graph2Style=5;
    Graph2Color=6;

    /* Zero Line */
    Graph0=0;


    Buy=cross(var4,var5); /* originally var5 was a zero */
    sell=cross(0,var4);

    buy=exrem(buy,sell);
    sell=exrem(sell,buy);

    short=sell;
    cover=buy;

    Filter= (Buy == 1 or Sell == 1) ;
    numcolumns = 7;
    column0 = IIF(Buy == 1, 1, IIF(Sell == 1, -1, 0 ) );
    column0format = 1.0;
    column0name = "B/S";
    column1 = C;
    column1name = "Close ";
    column1format = 1.2;
    column2 = ma(v,17);
    column2name = "17 Ma Vol ";
    column2format = 1.0;
    column3 = ma(C,17)/ma(c,50);
    column3name = "% 17/50 ";
    column3format = 1.2;
    column3format = 1.2;
    column4= ma(c,17);
    column4name="17 C ma";
    column4format = 1.2;
    column4= ma(c,50);
    column4name="50 C ma";
    column4format = 1.2;
    Column5=ROC(var4,2);
    column5Name="ROC DI";
    Column5Format=1.2;
    Column6=***(1);
    Column6Name = "#Bars";
    Column6format = 1.0;

    /* End of Exploration Code. */



    Comments:
    Steve Wiser
    slwiserr [at] erols.com
    2001-07-06 03:56:13 The Demand Index, developed by James Sibbet,
    combines price and volume in such a way that it
    is often a leading indicator of price change.
    The Demand Index calculations are too complex,
    however, for this text. The calculations
    require 21-column accounting paper to calculate
    manually.

    This indicator is an interpetation of the
    MetaStock version.

    Comment


    • #3
      Here's the exact program

      Can it be done?

      Does we have the possibility to calculate HHV Highest High Value for the 2 last period highs (and LLV)?

      (A,-1) is the preceding value of A...


      /* Demand Index */


      A=(High+L+2*C);
      B=EMA((HHV(H,2)-LLV(L,2)),19);
      BuyP=
      /*{BuyPower}*/
      V/EMA(V,19) * ((A>=Ref(A,-1)) +(A<Ref(A,-1)) / exp((0.375 * (A+Ref(A,-1)) /B )
      *(Ref(A,-1)-A) / A));

      SellP =
      /*{SellPressure}*/
      V/EMA(V,19) * ((A<=Ref(A,-1)) + (A>Ref(A,-1)) / exp((0.375 * (A+Ref(A,-1)) / B
      ) * (A-Ref(A,-1)) / Ref(A,-1)));


      mabp=EMA(BuyP,19);
      masp=EMA(SellP,19); /*{smooth Selling Pressure}*/
      divsor=if mabp>masp then mabp else masp); /*{BP:SP ratio}*/
      divend=if mabp<masp then mabp else masp); /*{biggest=divisor}*/
      var2=1-(divend/divsor); /*{adjust ratio to plot
      in}*/
      var3=IIf( (masp>mabp) , -var2 , var2 ) ; /*{range -100 to 100}*/

      var4=var3*100;

      var5=EMA(var4,30);

      return array (var4, var 5) {variables to be plotted}
      Last edited by pbereau; 11-01-2006, 03:36 PM.

      Comment


      • #4
        pbereau,

        Depending on the urgency of having this study coded, you may want to consider enlisting the services of an EFS Consultant. These are not employees of eSignal, but rather programming consultants who are intimately familiar with EFS coding. They are fee based, so you may want to get some pricing before committing to a particular service. Hope this helps.

        Comment


        • #5
          Thanks

          But i have created this code...there are no syntax errors or any error messages but it doesn't plot!

          if someone can help and see what doesn't work in it...thank you!

          kind regards
          Attached Files

          Comment


          • #6
            The only complexity in this formula code is the addition of two Boolean values:



            (A>=Ref(A,-1)) + (A<Ref(A,-1))



            The two expressions on either side of the plus sign are relational expressions that the program evaluates to be either TRUE or FALSE. If the condition is TRUE, it is assigned the value of 1. if it is FALSE, it is assigned the value of 0. The results of these two assignments are then added together.



            Because these conditions are mutually exclusive, only one can be TRUE at any given time. Also, because of the nature of the expression, one of them will always be TRUE. Therefore, this section of code is always the equivalent of adding 1 plus 0.

            Any smart programmer here?

            Comment


            • #7
              Hi pbereau,

              Originally posted by pbereau
              Any smart programmer here?
              Well, evidently neither you nor I fit that description.



              The only complexity in this formula code is the addition of two Boolean values:

              (A>=Ref(A,-1)) + (A<Ref(A,-1))

              I do not believe your statement is entirely correct. You need to define what the Ref() function is and what it does in the context of JavaScript.

              Comment


              • #8
                Hi Steve

                I never have the pretention to be a smart programmer otherwise i will not ask for any help! lol

                You can see in the first posts i have already defined the REF function...it's just the precedent value of A.

                For example in Metastock this function is defined by:
                Ref(Data array, periods)

                References a previous or subsequent element in a Data array/
                ex. The formula "ref(Close, -12)" returns the closing price 12 periods ago.

                So Ref(A, -1) should return the value of A one (1) period ago!
                (I think it's the same definition in efs language so if not i will be glad to know the best way to write this)

                All the Best,

                Phil

                ps: If you have other questions you can pm me without any problem. Thanks for your help!
                Last edited by pbereau; 11-11-2006, 12:52 PM.

                Comment


                • #9
                  Hi Phil,

                  Originally posted by pbereau

                  You can see in the first posts i have already defined the REF function...it's just the precedent value of A.

                  For example in Metastock this function is defined by:
                  Ref(Data array, periods)

                  References a previous or subsequent element in a Data array/
                  ex. The formula "ref(Close, -12)" returns the closing price 12 periods ago.
                  I had downloaded the code and looked through your posts, but could not find the function. Regardless, I am presently quite overcommitted and cannot help much, if at all on this.

                  Regarding the close values, it is straightforward...

                  For example in eSignal this function is defined by: close( [ nBarIndex ][, sym() | inv() ] ) . The formula "close(-12) " returns the closing price 12 periods ago.

                  Please check this out in the Knowledgebase.



                  I located this in less than a minute. To do this, click the EFS Knowledgebase link under Handy Links: at the bottom of my post and search for close . The shortcut is available on the eSignal Learning and Product Training drop downs as well.

                  I hope this helps

                  EDIT

                  I found an efs entitled 'Demand Index' here



                  I hope this works for you.
                  Last edited by Guest; 11-11-2006, 10:33 PM.

                  Comment


                  • #10
                    I found an efs entitled 'Demand Index' here
                    Sorry but not the same "demand index" code!

                    I've already tested it!

                    Thanks!

                    Comment


                    • #11
                      looking for demand index as origanaly designed by james sibet

                      i am looking for the efs code for the demand index as created by james sibet and as available on metastock. i have seen a tweeked version but i would love to find the original. also i would love the code to use the total volume for all months for the future we are trying do calculate a demand index as james sibet intended it to be and not only the volume of the specif month. thanks

                      Comment

                      Working...
                      X