Announcement

Collapse
No announcement yet.

Net tick volume indicator

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

  • Net tick volume indicator

    I'm trying to create an indicator that tracks the cumulative tick volume on the ask minus the cumulative tick volume on the bid (ie. a 100 share print on the ask or higher increases the indicator value by 100, a 100 share print on the bid or lower decreases the indicator value by 100). For some reason the following formula returns nothing. Could someone please help?

    Thanks,
    Rod


    var bid = 0;
    var ask = 0;
    var tradeSize = 0;
    var tradePrice = 0;
    var upVol = 0;
    var dnVol = 0;
    var netVol = 0;

    function preMain() {
    setStudyTitle("Net Tick Volume");
    setCursorLabelName("Net Tick Volume");
    setDefaultBarFgColor(Color.blue, 0);
    setShowCursorLabel(true);
    setDefaultBarThickness( 2, 0 );
    addBand( 0, PS_DOT, 3, Color.white);
    }

    function main() {

    bid = getMostRecentBid();
    ask = getMostRecentAsk();
    tradePrice = getMostRecentTrade();
    tradeSize = getMostRecentTradeSize();

    time60 = getHour(0) * 60;
    time60 += getMinute(0);

    if((isTick() || isRawTick()) && time60>=570){

    if(tradePrice<=bid)
    dnVol += tradeSize;
    else if(tradePrice>=ask)
    upVol += tradeSize;

    netVol = upVol - dnVol;

    return netVol;
    }
    else return;
    }

  • #2
    Hello Rod,

    There is currently a formula in our EFS Library that does what you are trying to do. See BidAskRatio.efs. You will need to change the Study Output parameter to Ask-Bid through Edit Studies. You could use this formula or compare your code to this formula to see a working example of how to accomplish this task.
    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

    Working...
    X