Announcement

Collapse
No announcement yet.

Uptick - Downtick

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

  • Uptick - Downtick

    Hello,
    I am trying to write my first, simple, code. Pretty much a 3 line MA with the 3 studies based on Upticks - Downticks.

    I have tried to write it in the formula wizard with no luck. I figure I should be able to take the code for a 3 line MA and just subsitute the formula Uptick - Downtick. The editor wont recognize Uptick or Downtick and I cant find a list, nor can tech support, that lists out such things in the correct syntax.

    Any help to point me in the right direction would be greatly appreciated.

    Regards,
    Gaddock

  • #2
    Hello Gaddock,

    To find all of our EFS references and documentation, please visit our EFS KnowledgeBase.

    For charting or coding studies based on Upticks - Downticks we have several symbols available.

    $TICK NYSE Cumulative Tick
    $TICKI Dow Jones Industrial Tick
    $TICKQ NASDAQ Cumulative Tick

    These can also be used as the source for a moving average if you need to plot the study on a chart symbol other than the Tick symbols. Here's a basic code example.

    PHP Code:
    function main() {
        var 
    myMA1 sma(10close(sym("$TICK")));
        
        return 
    myMA1;

    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #3
      Hello JasonK,
      Thank you for the response. I do use the $tick & $ticki in several ways.

      What Im trying to do is create a study that measures ....

      Upticks - Downticks

      and be able to also try

      Upticks / Downticks


      Kind of a tick differential and ratio so to speak to be applied to various equity symbols as a leading indication.

      So by adding the $tick into the formula it is acting as Uptick - Downtick?

      Best regards,
      Gaddock

      Comment


      • #4
        Hello Gaddock,

        Are you after the total number of Upticks and total number of Downticks for the NYSE or for the trades of an individual symbol?
        Jason K.
        Project Manager
        eSignal - an Interactive Data company

        EFS KnowledgeBase
        JavaScript for EFS Video Series
        EFS Beginner Tutorial Series
        EFS Glossary
        Custom EFS Development Policy

        New User Orientation

        Comment


        • #5
          Hello Jason,
          Sorry for the delay I have been out of the country.

          I want to measure upticks - downticks on a specific stock with the ability to use and adjust an SMA.

          Thanks,
          Gaddock

          Comment


          • #6
            Hello Gaddock,

            This can be accomplished, however, it will only work in real time. When a formula is loaded and processes historical bars, it does not see what the individual ticks are to be able to calculate the number for up ticks - down ticks on each bar.

            What you would do in EFS is create a custom function that calculates the total upticks minus down ticks.

            PHP Code:
            var nTotUp 0;
            var 
            nTotDn 0;
            var 
            ntick_1 null;
            var 
            ntick null;

            function 
            UpMinusDn() {
                if (
            getCurrentBarIndex() < 0) return;
                if (
            getBarState() == BARSTATE_NEWBAR) {
                    
            nTotUp 0;
                    
            nTotDn 0;
                }

                
            ntick_1 ntick;
                
            ntick close(0);
                
                if (
            ntick ntick_1) {
                    
            nTotUp++;
                } else if (
            ntick ntick_1) {
                    
            nTotDn++;
                }
                
                return (
            nTotUp nTotDn);


            Then in main(), you will create a series based on the custom function with efsInternal() and pass it as the source to the sma() built-in study.

            PHP Code:
            var xUmD null;
            var 
            xMA  null;
            var 
            bInit false;

            function 
            main() {
                if (
            bInit == false) {
                    
            xUmD efsInternal("UpMinusDn");
                    
            xMA sma(10xUmD);
                    
            bInit true;
                }
                
                return 
            xMA.getValue(0);


            Note also that if this code is running on a 1-min chart, because of the sma length of 10, it will take 10 minutes (or 10 bars) to prime the calculation. You won't see any plotted values until the moving average is primed.
            Jason K.
            Project Manager
            eSignal - an Interactive Data company

            EFS KnowledgeBase
            JavaScript for EFS Video Series
            EFS Beginner Tutorial Series
            EFS Glossary
            Custom EFS Development Policy

            New User Orientation

            Comment


            • #7
              Originally posted by eSignal_JasonK
              What you would do in EFS is create a custom function that calculates the total upticks minus down ticks.
              Old thread, but was looking for something similar...

              Actually, the solution posted doesn't do what the op asked. The code tallies price increase and price decrease. that's not the same as upticks and downticks. An uptick is buying at the offer and downtick is selling to the bid (that's a simplification, but normally true of futures, which usually trade with a 1-tick spread).

              There are built-in functions in tradestation that keep track of upticks and downticks (note--it's not a function of the data source--it works in tradestation even using an esignal feed), but esignal doesn't appear to have similar functions available.

              I don't think you can do it in esignal, as far as I can tell. I tried writing an efs that grabs the most recent bid (getMostRecentBid) as reference, but it eats way to much cpu to do that every tick.

              Comment

              Working...
              X