easylanguage question

Discussion in 'Trading Software' started by tortoise, Mar 16, 2010.

  1. Could someone tell me how to code a VWAP-style indicator that calculates the volume-weighted average price for "n" bars? Thanks
  2. inputs: Price(Close), Length(5);
    vars: sx(0), sy(0), ave(0), j(0);
    if length >= 1 then begin
    sx = 0;
    sy = 0;
    for j = 0 to (Length-1) begin
    sx = sx + Price[j]*Volume[j];
    sy = sy + Volume[j];
    if sy > 0 then begin
    ave = sx / sy;
    end else begin
    { if volume is zero, just return simple average }
    ave = sx / length;
    plot1(ave, "VWA");
  3. Thanks!

    Question, though: In EL-land, doesn't "volume" refer to "upticks" only? If so, shouldn't one use "ticks" -- which, as I understand it, incorporates upticks and downticks, thus giving you volume?
  4. "vwap_h" will plot VWAP for the entire day. If the day is not finished it will plot it up to that point. Pretty simple.

    EDIT: in EL land volume translate into total volume for your specified time series upticks and downticks
  5. As I understand it volume is dependent on time interval. Here is what my understanding of volume currently is in EL:

    - Volume = Volume on a Daily chart bar
    - Volume = UpVolume on an Intraday chart bar
    - Ticks = volume on an Intraday chart bar

    Your right, the EL word 'Ticks' is the proper EasyLanguage word to use on intraday bars. The type of data returned will vary based on your chart setting.

    From the 'Format Symbol' window, if the 'For volume, use:' setting is 'Trade Vol' then the total volume (e.g., total number of shares) traded during the bar will be returned.

    If the 'For volume, use:' setting is 'Tick Count' then the total number of ticks (e.g., trades) during the bar will be returned.

    In this case I am a Swing Trader on Daily Charts so my routines use Volume.