Announcement

Collapse
No announcement yet.

Help converting TS tickvolume profile ela to Esignal efs

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

  • Help converting TS tickvolume profile ela to Esignal efs

    From what I hear this wont currently work in Esignal on tick charts as an EFS, but could someone convert it as an EFS based on 1 minute volume data? Keeping the minutes back as a variable?

    input: date1(0), time1(930), time2(1600), HistColor(darkgray), ValueArea(.6), ValueColor(blue);
    input: EveryMins(15), MinsBack(15);
    input: ShoHist(true);

    { This displays price histograms EveryMins. The lookback period is MinsBack.

    It works for both minute and tick bars, even 1-tick bars. Try with S&P 1-minute bars
    or S&P 1-tick bars.

    Inputs:
    date1 - draws histrograms for this date; all date if its 0
    time1, time2 - draws histograms within this date range
    HistColor - the color of the histogram
    ValueColor - the color of the value area
    ValueArea - portion of the prices that will be colored; range 0 to 1
    EveryMins - draw a histogram every, say, 15 minutes
    MinsBack - how far back to analyze prices, typically the same as EveryMins
    ShoHist - if false, just the value area is plotted like a bar
    }

    array: v[5000](0);
    var: base(10000);

    var: ii(0), ij(0), hh(0), ll(0), cbStart(0), bb(0), maxv(0), han1(0), m1(0), m2(0);
    var: mins(0), cb(0), cbPrev(0), targ(0), Sanity(false);
    var: iivmax(0), totv(0), vmaxpc(0), vhh(0),vll(0), loop(0);

    if currentbar = 1 then begin
    hh = h;
    ll = l;
    end;
    mins = EveryMins*intportion(timetominutes(time)/EveryMins);

    if (date1 = date or date1 = 0) and ((time >= time1 and time <= time2) or time1 = 0 or time2 = 0) and
    mins <> mins[1] then begin

    { plot1(c,"",red,default,5);}

    { clear v array }
    for ii = ll * 10 - base to hh * 10 - base begin
    v[ii] = 0;
    end;

    { find start of interval }
    cb = 0;
    Sanity = true;
    targ = timetominutes(time) - MinsBack;
    while targ <= timetominutes(time[cb]) and Sanity begin
    cb = cb+1;
    if cb >= currentbar then Sanity = false;
    if date[cb] <> date then Sanity = false;
    if cb > 1000 then Sanity = false;
    end;
    cb = cb - 1;

    { add bars to list }
    hh = h;
    ll = l;
    for ij = cb - 1 downto 0 begin
    m1 = l[ij];
    m2 = h[ij];
    if hh < m2 then hh = m2;
    if ll > m1 then ll = m1;
    if m1 > c[ij+1] + .10 then m1 = c[ij+1] + .10
    else if m2 < c[ij+1] - .10 then m2 = c[ij+1] - .10;
    for ii = m1 * 10 - base to m2 * 10 - base begin
    v[ii] = v[ii] + 1;
    end;
    end;

    { find value area }
    maxv = 0;
    totv = 0;
    for ii = ll * 10 to hh * 10 begin
    totv = totv + v[ii - base];
    if maxv < v[ii - base] then begin
    maxv = v[ii - base];
    iivmax = ii;
    end;
    end;
    vmaxpc = maxv;
    vhh = iivmax;
    vll = iivmax;
    sanity = true;
    loop = 0;
    if maxV > 0 then
    while sanity and vmaxpc / totv < ValueArea begin
    loop = loop + 1;
    if loop > 50 then sanity = false;
    if v[vhh + 1 - base] > v[vll - 1 - base] then begin
    vhh = vhh + 1;
    vmaxpc = vmaxpc + v[vhh - base];
    end else begin
    vll = vll - 1;
    vmaxpc = vmaxpc + v[vll - base];
    end;
    end;



    { display the list }
    if ShoHist then
    for ii = ll * 10 to hh * 10 begin
    if maxV > 0 then begin
    bb = v[ii - base] * (currentbar - cbPrev) / maxV;
    if time[bb] <> time then begin
    han1 = tl_new(date[bb],time[bb],ii*.1,date,time,ii*.1);
    tl_setextleft(han1,false);
    tl_setextright(han1,false);
    tl_setcolor(han1,HistColor);
    if ii >= vll and ii <= vhh then tl_setcolor(han1,ValueColor);
    if ii = iivmax then tl_setcolor(han1,cyan);
    end;
    end;
    end;
    { plot2(iivmax*.1,"",cyan,default,4);}
    plot3(vhh*.1,"",ValueColor,default,0);
    plot4(vll*.1,"",ValueColor,default,0);
    cbPrev = currentbar;
    end;





    if false then begin
    plot1(0,"");
    plot2(0,"");
    plot3(0,"");
    plot4(0,"");
    end;

    Here is a link to download the Tradestation code

    Attached Files
Working...
X