Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

Andytick

Building a VolumeProfile Indicator with EasyLanguage

Recommended Posts

peak volume price... however with the two codes posted here im not sure how or if you can refer to the pvp on a trading strategy

 

That comment says more about you, than it does the indicator....

 

May i suggest you look around the forum, and research uses for PVP before you post detrimental remarks about particular codes.

Share this post


Link to post
Share on other sites
There are 2 reasons why I prefer ASCII:

First I know that you can plot a limited numbers of lines (trendLines) in a chart, so if I'd like to plot a daily histogram on many days, it would limit my plot.

 

Second it's a personal preference and in my opinion ASCII mapping like "------------" is easier to save with ADE and quicker to load as indicator than TLines, but its just my opinion.

Here form the first post 2 different resolutions using lines and ASCII:

2qx6e1d.png

 

soy4pg.png

 

Folks in this image we see the POC, while if I want see the PVP, how could I do?

 

I?d like to see a line for POC and Another for PVP.

 

I don't undesrtand what is exactky the difference, and what is the best, could you explain please?

Share this post


Link to post
Share on other sites

 

Grazie tuccio, senti hai skype ti va di sentirci per una chiaccherata?

 

Ci vai a mechanica a Milano?

 

Volevo chiederti se per visualtrader per visualtrader puoi postare il PVP e il POC, mi sembra che già lhai con le linee blu? ti ho posto su investireoggi perchè sul FOL mi hanno bannato e non posso mai piu scrivere.

 

A presto

Share this post


Link to post
Share on other sites
Grazie tuccio, senti hai skype ti va di sentirci per una chiaccherata?

 

Ci vai a mechanica a Milano?

 

Volevo chiederti se per visualtrader per visualtrader puoi postare il PVP e il POC, mi sembra che già lhai con le linee blu? ti ho posto su investireoggi perchè sul FOL mi hanno bannato e non posso mai piu scrivere.

 

A presto

 

ma quale Visual Trader a quale Milano :crap::crap:

 

Sto pubblicando una guida sull'analisi dei volumi con Multicharts sul fol :missy:

Share this post


Link to post
Share on other sites

allora non vuoi capire...quel grafico su VT è approssimativo e non ha la precisione di Multicharts...ma credi che se il prezzo su VT si trovi su una deviazione standard non vuol dire che si trovi veramente li!!! con VT è tutto sballato perfino il PVP e anche il VWAP...se fai trading usando quest indicatori su VT ti farai molto male...perchè gli indicatori su VT non rispecchiano la realtà di quello che sta succedendo sul mercato....

Share this post


Link to post
Share on other sites

tuccio grazie per i chiarimenti, quello che cercavo di capire è notare quanto i valori sono diversi da multicharts e visualtrader per fare un confronto. L'unica cosa è che per i titoli italiani e futures fib e minifib, sono costretto ad usare VT per avere i dati e lo storico, ho provato a fare il collegamento DDE con multicharts ma non regge, bisognerebbe farlo con le API che traderlink te le da anche il fatto è cjhe non sono programmatore, quelli di MC magari ci metterebbero 2 secondi a collegare il feed di VT su MC.

 

Non mi è chiaro questo

 

ma credi che se il prezzo su VT si trovi su una deviazione standard non vuol dire che si trovi veramente li!!!

??

 

 

 

allora il vwap lo hai pubblicaro ed effettivamente ci sono valori che ogni tanto non tornano perchè lo ho confrontati.

 

Il PVP vorrei confrontarlo anche quello ecco perchè te lo chiedo, poi magari la cosa segnalarla all'assistenza traderlink per vedere se migliorano, cerco di fare qualcosa di costruttivo, solo che non ho i codi, tu mi sembra che riuscito anche a codificare il volume bias o sbaglio?

 

Lo so che se devo fare trading seguo i valori di mc e non di Vt, però è anche vero che non ho bisogno di una ferrari,. In ogni caso mc la compro a fine mese, ideale sarebbe atrtaccatala a directa e prendere i dati da li.

 

Quindi se puoi manda i codi oer vt, ciao.

 

PS

Hai fatto un bellissimo lavoro sul FOL su mc, complimenti.

ciao.

Share this post


Link to post
Share on other sites

Non è una questione di "Ferrari", ma vuoi davvero paragonare il flusso dati di Zen-Fire a quello di Directa???? I codici per VT li ho postati una volta sul forum di investireoggi e poi ho fatto un paragone tra una giornata di trading monitorata contemporaneamente su VT e Multicharts entrambi con gli indicatori caricati e a fine giornata mi sono messo a ridereeeee....Inoltre se metti VT a 1 tick e carichi il PVP dopo 15 minuti crasha...questa anche perchè il linguaggio di VT è limitato...non è un linguaggio di programmazione completo come quello di Multicharts..per non parlare del VWAP su VT...una barzelletta ahahahahah...

Share this post


Link to post
Share on other sites

Potresti per favore inviarmeli in pm, i codici per visualtrader del pvp, volume bias ecc... non li riesco a trovare, ho trovato solo quelli del vwap con le 2 sd. Grazie mille.

Secondo te fare presente questa discrepanza a directa e a visualtrader cambierebbe qualcosa?

Per caso hai provato anche con metastock e prorealtime o la T£ per capire come se

la cavano nel confronto ?

Share this post


Link to post
Share on other sites

Non posso postarteli perchè non li ho più in quanto ho disistallato tutta la cartella VT perchè mi dava problemi con l'antivirus e poi non uso più. Fare presente queste cose a Directa e company non cambierebbe niente...a loro poco importa, il loro business va già bene così (l'amministratore delegato di Directa una volta è intervenuto sul fol dicendo che questa dei volumi è solo una moda passeggera). Non esiste nessun Volume Bias per VT.

 

Continuiamo la discussione sul fol prima che ci caccino da quà...

Share this post


Link to post
Share on other sites

Anybody could help me please,

 

I tried to use the code in the post 38 and it compiles ok but when I try to insert the indicator on a 1 tick chart it gives me the following error msg:

 

- Can't open/create file: "C:/temp/VolumeProfile.txt". -

 

Anybody could help me please.

thanks

mark

Share this post


Link to post
Share on other sites
Anybody could help me please,

 

I tried to use the code in the post 38 and it compiles ok but when I try to insert the indicator on a 1 tick chart it gives me the following error msg:

 

- Can't open/create file: "C:/temp/VolumeProfile.txt". -

 

 

You need to Save As : What ever name you want to call the file.

 

Sounds as if you're trying to insert the original .txt file and not the .el or .eld code.

 

Hope this helps.

 

VT

Share this post


Link to post
Share on other sites
You need to Save As : What ever name you want to call the file.

 

Sounds as if you're trying to insert the original .txt file and not the .el or .eld code.

 

Hope this helps.

 

VT

 

Hello ValueTrader,

maybe I explained myself not correctly.

I already imported the code in Power Language Editor of Multicharts and I gave to it the name "Volume profile" and it compiled perfectly.

The problem rise when I try to insert the indicator in a 1 tick chart giving me the error that I reported: - Can't open/create file: "C:/temp/VolumeProfile.txt". -

thanks

Share this post


Link to post
Share on other sites

Manually create a directory named C:\temp\ and then try running the indicator again.

 

[edit] The forum software interpreted the name of the directory I specified as some smiley face but you should be able to make sense of the concept anyway.

 

Hello ValueTrader,

maybe I explained myself not correctly.

I already imported the code in Power Language Editor of Multicharts and I gave to it the name "Volume profile" and it compiled perfectly.

The problem rise when I try to insert the indicator in a 1 tick chart giving me the error that I reported: - Can't open/create file: "C:/temp/VolumeProfile.txt". -

thanks

Share this post


Link to post
Share on other sites
Hello ValueTrader,

maybe I explained myself not correctly.

I already imported the code in Power Language Editor of Multicharts and I gave to it the name "Volume profile" and it compiled perfectly.

The problem rise when I try to insert the indicator in a 1 tick chart giving me the error that I reported: - Can't open/create file: "C:/temp/VolumeProfile.txt". -

thanks

 

try it on a 60 min chart, or a day chart...

Share this post


Link to post
Share on other sites

Thanks onesmith, thanks Tams,

I created the file VolumeProfile.txt in C:/temp.

When I open a chart with 30 minutes candles 50 days history and I insert the Volume Profile indicator I get the answer: - Message Error in study "Volume Profile" : : Array bounds. Wrong index value : -4."

The last number "-4" change changing the number of history days.

It is -4 with 50 days history and it becomes -24 with 25 days history.

Could you pls. help me.

I have no clue about the meaning of the message error.

Many thanks

mark

Share this post


Link to post
Share on other sites
Thanks onesmith, thanks Tams,

I created the file VolumeProfile.txt in C:/temp.

When I open a chart with 30 minutes candles 50 days history and I insert the Volume Profile indicator I get the answer: - Message Error in study "Volume Profile" : : Array bounds. Wrong index value : -4."

The last number "-4" change changing the number of history days.

It is -4 with 50 days history and it becomes -24 with 25 days history.

Could you pls. help me.

I have no clue about the meaning of the message error.

Many thanks

mark

 

what instrument you are charting?

Share this post


Link to post
Share on other sites

Mark, the file error is caused by the use of forward slashes rather than back slashes. The out of bounds error (on 6e) occurs because the index is keyed directly to price rather than something like index=p+offset to center price in the array; There's also a conceptual error that no one has mentioned, where the reserved word volume should be changed to ticks.

Share this post


Link to post
Share on other sites

I never knew where this indicator originated from....

Over the years I have been playing & trying to figure out the code... There are a lot of ambiguous ValueNN references that who knows what they reference.

 

Anyway... There are a lot of user defined inputs in my re-coded TPOpro indicator...

you are able to turn off different plots like the textLables , change line colors, and even change the ABC Text profile histogram to whatever symbol you like ( "_", "+","*","-","8")

{********************************************************************
TPO Pro  indicator   Original  TPO Pro5   by ????  
5c 5b 
203.21  Added VAH VAL Lines & PriceAxis Markers, Flipped Histogram
30303   Seperating Plot Colors, Widths , History from Current Plots
       Removed Code for Letters, was unnecessary duplicated
30304   Major Overhaul , changed names, cleaned code,  more readable 
30309 Removed Today's VA Lines replotting next to new lines 
30414 Input Names changed, Todays VA Lines plot once
31002 same as 40101 Added a lot.
wishlist: plot multiple days histo.... extend VAH &VAL Lines 

********************************************************************}
[LegacyColorValue = false];

input:
_HISTOGRAM_PLOT_SETTINGS_(0),
 PlotTPOHistogramABcText  (false),
 HistogramTextColor       (magenta),  
 HistogramLetter_Symbol   (""),
 HistoSymbol_if_ABCTxt_False ({MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}{MustHave "Quotes" InputAbove}0),

_VA_RANGE_TEXT_LABELS_(0),
 ShowTodaysVARange_TextString (false),
 TodaysVARange_TextStringColor (white), 
 ShowPriorVARangeTextLables    (false),
 ColorPastVARangeTextLabels    (darkmagenta),

_VARANGE_VERTICAL_LINESnDOT_(0),  
 POCdot_Color              (white), 
 POCdot_ThicknessWidth     (5),
 VArangeVerticalLine_Color (magenta), 
 VArangeVerticalLine_Width (5),
//cPastVAVerticalRangeLine  (magenta),
//ColorPastVerticalPOCDots  (white),
//wPastVA_VerticalRangeLine (5),
//wPastVAMidPointDots       (5), 
_TODAYS_VAH_VAL_LINES_(0),
WidthTodaysVA_HighLowLines (2),
TodaysVAHigh_LineColor (blue),
TodaysVALow_LineColor (red),
TodaysPOC_LineColor (yellow),
_PRIORHISTORY_VAH_VAL_LINES_(0),
ShowPriorHistoryVALines     (false),
cPastVAHigh_LineColor       (red),
cPastVALow_LineColor        (blue),
wPastVAHigh_VALow_LineThickness (1),

_REPLOT_PRICE_BARS_SETTINGS_ (0),
 RePlotPriceBarsOverHistgram (true), 
 ReplotPriceBars_LineWidth   (2),
 ReplotPriceBarsWick_Color       (black),
 PriceBarCloseDot_Color      (darkgray),
 cBarUp (green),
 cBarDN (rgb(200,0,0)),

_LAST_PRICE_FLOATING_LINE_(0),  
 ShowCurrentLastPriceLine (true),
 LastPrice_LineColor      (LightGray), 

_SETTINGS_(0),
 ValueAreaRange_Percent (.7),
 Stime                  (1615),
 compress               (1),
 len                    (30),
 letter_1               (2),
 ValueAreaSize_n        (4); 


vars:
intrabarpersist Color(0),
x(0),y(0),TPOtotal(0),
//lett("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"}),
CurTxt(""),CurLet(""),OldLet(""),letter1(0),lcount(1),
dHi(0),dLo(0),HH(0),LL(0),BarHi(0),BarLo(0), 
Time0(0),DayNum(0),d0(0),dl(0),DayLow(0),  
VA(0),VaMid(0),VAP(0),VAH(0),OldVAH(0),VAL(0),OldVAL(0),Valsize(0), //  {"vap"=ValueAreaPercent}
PC(0),PC2(0),et(0),FP(0),skp(0),tot(0),tpstr("00"),xpts(0),  
vCurPOC(0),POC(0),OldPOC(0),CP(0),//                              {"CP "= CenterPoint Center of Distribution ?POC?} 
nuFlag(0),Flag2(0),NewDayFlag(0),
cVrtRng(0), wVrtRng(0),  TL_VrtPOC(0), TL_VrtRng(0), TL_hVrtRng(0),      
Labl(0),cRngLbl(0),chRngLbl  (0),  
Price(0),cLstPrc(0),TL_LstPrc(0),         
cPOC(0),cVAH(0),cVAL(0),chVAH(0),chVAL(0),ctPOC(0),    
whVaHL(0),wVaHL(0),wPOC(0),
phVaHL(false),pLstPrc(false),pHisLbl(false),ptLabl(false),
TL_POC(0),TL_VAH(0),TL_VAL(0),      
ctHisto(0), pHistoTxt(true), HistoChar("8"),
pCurLoc(0), D1p(0),D2p(0),T1p(0),T2p(0),
PBWick(0),cPBWick(0),wPBWick(0),pPBWick(false),
PBBody(0),cPBBody(0),wPBBody(0),     
mintick(0);

array: aPRI[1000](0),
      aTPO[1000](0),
      aPriStr[1000]("");  {? Primary String ?}

if currentbar = 1  then begin
 letter1 =  letter_1 ;
 ctHisto = HistogramTextColor ;
//cPOC    = ColorPastVerticalPOCDots ;
 cLstPrc =  LastPrice_LineColor ;
 cVrtRng = VArangeVerticalLine_Color ;
//cVrtRng = cPastVAVerticalRangeLine ;
 cPBWick = ReplotPriceBarsWick_Color ;
 cPBBody =  PriceBarCloseDot_Color ;
 cRngLbl = TodaysVARange_TextStringColor ;
 chRngLbl= ColorPastVARangeTextLabels ;
 cPOC    = POCdot_Color ;
 ctPOC   = TodaysPOC_LineColor;
 cVAH    = TodaysVAHigh_LineColor ;
 cVAL    = TodaysVALow_LineColor  ;
 chVAH   = cPastVAHigh_LineColor ;
 chVAL   = cPastVALow_LineColor ;
 wPOC    = minlist (6, POCdot_ThicknessWidth );
 wVrtRng = minlist (6, VArangeVerticalLine_Width );
//wVrtRng = minlist (6, wPastVA_VerticalRangeLine );
 wVaHL   = minlist (6, WidthTodaysVA_HighLowLines );
//wPOC    = minlist (6, wPastVAMidPointDots );
 whVaHL  = minlist (6, wPastVAHigh_VALow_LineThickness );
 wPBWick = minlist (6, ReplotPriceBars_LineWidth );
 wPBBody = minlist (6, wPBWick + 1 ); 
//wVaHL    = minlist (6, WidthTodaysVA_HighLowLines );
//wTodayVAL= minlist (6, wTodaysValueAreaLowLine );
 pHistoTxt= PlotTPOHistogramABcText ;
 HistoChar= HistogramLetter_Symbol ;
 pPBWick  = RePlotPriceBarsOverHistgram ;
 pLstPrc  = ShowCurrentLastPriceLine ;
 ptLabl   = ShowTodaysVARange_TextString;
 pHisLbl  = ShowPriorVARangeTextLables ;
 phVaHL   = ShowPriorHistoryVALines ;
 VAP      = ValueAreaRange_Percent ;
 Valsize  = ValueAreaSize_n ;        {Line Thickness for VA horiz lines}
 mintick  = 1 point * minmove * compress ; 
 xpts     = 500 * mintick ;
end;

{*****  START PROGRAM IF TIME IS WITHIN DAY SESSION HOURS *****}
if BarStatus(1) = 2 then begin

nuFlag = 0 ;
if  Time0 <= sess1endtime 
and t > sess1endtime 
and sess2starttime <> 0 
 then nuFlag = 1
 else
if  d <> d0 
and sess2starttime = sess2endtime 
 then nuFlag = 1
 else
if Time0 = sess1endtime then nuFlag = 1 ;    

if NuFlag = 1 then begin
 if currentbar > 1  then begin
  if  cVrtRng <> 0     { if  PlotHistogram = true }
  and Flag2 = 0
   then begin
    VaMid = 0 ;
    TPOtotal = 0 ;
    POC = dLo ;
    CP = dLo + (( dHi - dLo )*.5);//    {"CP "=CenterPoint center of dist.}

    for x = dLo to dHi  begin 
     if aPriStr[x] <> "" then begin
     //aPriStr[x] = nutpstr( aTPO[x], aPriStr[x], aPRI[x]);     {places NumberCharacter in front of Histogram Text History Plots}
       TPOtotal = TPOtotal + aTPO[x];    {Total TPO Count}

       if  aTPO[x] = VaMid 
       and x <= CP  
        then POC = x ;

       if  aTPO[x] = VaMid 
       and   x > CP 
       and ( x - CP ) < AbsValue( CP - POC ) 
        then POC = x ;

       if aTPO[x] > VaMid then begin
         POC  = x ;
         VaMid = aTPO[x] ;
       end;
     end; //  {end of "if aPriStr[x] <> "" then begin"}
    end;    {end of "for x = dLo to dHi  begin "}

    VA = TPOtotal * vap ;
    x = VaMid ; 
    VAH = POC ; 
    VAL = POC ;
    x = 0 ;

    while x < VA  begin
     value19 = aTPO[VAH+1] + aTPO[VAH+2];
     value20 = aTPO[VAL-1] + aTPO[VAL-2];

     if value19 >= value20 then begin
      if x + aTPO[ VAH +1] >= VA
       then begin
        x = x + aTPO[ VAH +1];
        VAH = VAH + 1 ;
      end else begin
        x = x + value19;  
        VAH = VAH + 2 ;
      end;
     end else begin

     if x + aTPO[ VAL -1] >= VA
      then begin
       x = x + aTPO[ VAL -1]; 
       VAL = VAL - 1 ;
     end else begin
       x = x + value20;
       VAL = VAL - 2 ;
     end;
     end;
     end;//     {end of ":if value19 >= value20"} 
    end;//     {end of " while x < VA  begin"}


//{***** PAST HISTORY VALUE AREA TEXT LABLES  below pricebars *********}   
    if  VAH > dHi  then   VAH = dHi ;     {"tHi"=Today'sHigh}
    if  VAL < dLo  then   VAL = dLo ;    
    VAH = FP + ((VAH-500) * mintick );
    VAL = FP + ((VAL-500) * mintick );
    vCurPOC = FP + (( POC -500 ) * mintick );

    if  pHisLbl  then begin
      Labl = text_new( D2p , T2p , dl - mintick ,"VA:"+mp_str32(VAL) + " " + mp_str32(VAH));
      text_setstyle( Labl , 0 , 2 );    
      text_setcolor( Labl , chRngLbl );
    end;

{***** SETS PAST HISTORY VA VERTICAL LINE ****************************************************} 
    TL_hVrtRng = tl_new( D1p , T1p , VAH , D1p , T1p , VAL );
    tl_setcolor( TL_hVrtRng , cVrtRng );
    tl_setsize ( TL_hVrtRng , wVrtRng );

{***** SETS PAST HISTORY POC VERTICAL-LINE/DOT OF VALUE AREA ******************************************} 
    TL_VrtPOC = tl_new( D1p , T1p , vCurPOC + mintick /15, D1p , T1p , vCurPOC - mintick /15 ); 
  //tlVACpt = tl_new ( D1p , T1p , vCurPOC + mintick /15, D2p , T1p , vCurPOC - mintick /15 ); 
  //Above tl_new Creates a POC Line spanning the entire day               
    tl_setcolor( TL_VrtPOC , cPOC );
    tl_setsize ( TL_VrtPOC , wPOC );

{      
{***** VA HISTOGRAM RED TEXT row **************************************************************}  
    PC2 = 0 ;
    for y = dLo to dHi begin
     Price= FP + ((y-500) * mintick ) ;                    
     if Price <= pc  then  PC2 = y ;  
    end;

    if PC2 = 0  then  PC2 = BarLo ;
    CurTxt = aPriStr[pc2] ;
    if RightStr(  CurTxt , 1) <> "<" 
     then begin
      text_setstring( aPRI[pc2] ,  CurTxt + " <");
      text_setcolor ( aPRI[pc2] , cClose );
    end;
}       
 end;    {end of "if currentbar > 1  then begin" line164}

 D1p  = d - 1 ;               {Used on TLs as Yesterday  D1p,T1p=1stBar B4 New Session} 
 T1p  = SessionEndTime(1,1) ; {Used on TLs as begining Time}
 T2p  = t ;                   {1st TimeStamp of New Day (for line locations)}
 D2p  = d ;                   { Date/Day to Plot (for line locations)}
 Labl = 0 ;
 TL_hVrtRng = 0 ;   {30304xx }

{***** HISTOGRAM TEXT LETTERS *************************************************} 
 for value1 = dLo to dHi begin
   aPriStr[value1] = "" ;
   aTPO[value1]    = 0 ;
 end;

 //CurLet  = curletstr( stime ,len, letter1 );
 //Old CurLet  =  CurLet  ;
 NewDayFlag = 0 ;
 DayLow  = l ;  
 FP   = o   ; 
 dHi  = 500 ;
 dLo  = 500 ;
//30425  //aTPO[500] = 1 ;                                 
 //aPRI[500] = text_new(d, T2p ,o,"   >" +  CurLet  );
 //   aPriStr[500] = "   >" +  CurLet  ;
 //text_setstyle( aPRI[500] , 1 , 2 );    
 //text_setcolor( aPRI[500] , darkgray);
 HH    = o ; 
 LL    = o ; 
 VaMid = 1 ; 
 tot   = 1 ;
 dl    = l ;
 value22 = currentbar;

 if d = juliantodate(lastCalcJdate) then Flag2 = 1 ;

end;   {end of "if NuFlag = 1 then begin" line161} 

{ CURRENT DAY HISTOGRAM PLOT SYMBOL/CHARACTER instead of ABCs chose one letter}
if pHistoTxt
then   CurLet  = curletstr( stime , len , letter1 )
else   CurLet  = HistoChar ; 

Time0 = t ; 
d0 = d ; 
pc = C ;
BarHi = intportion(( xpts + H - FP + ( mintick /10))/ mintick );
BarLo = ceiling   (( xpts + l - FP - ( mintick /10))/ mintick );

if BarHi > dHi  then  dHi = BarHi ;     {tH = Today's High price}
if BarLo < dLo  then  dLo = BarLo ;
if low   < dl   then  dl = l ;

if  datacompression = 0 
and currentbar > value22 
then begin
//lcount = lcount + 1 ;                 {"lcount"=LetterCount a-z,A-Z}
//if lcount = 53  then lcount = 1 ;     {Reset to first of 52 letters}
//CurLet  = midstr( lett , lcount ,1);
 HH = o ; 
 LL = o ;
 NewDayFlag = NewDayFlag + 1 ; 
end;

value22 = CurrentBar ;
if  datacompression = 1
and OldLet <> CurLet
then begin
 HH = o ; 
 LL = o ;
 NewDayFlag = NewDayFlag + 1 ;
end;

{***** HISTOGRAM LETTERS *****************************************************}
for y = BarLo to BarHi  begin
Price  = FP + ((y-500) * mintick );
CurTxt = aPriStr[y] ;

if  CurTxt = "" then begin
  aTPO[y] = 1 ;
  aPRI[y] = text_new( D2p ,2300, Price ,"    " + CurLet );  // aPRI[y]= text_new(D2p,T2p,price,"    "+ CurLet );
  aPriStr[y] = "    " + CurLet ;                            // aPriStr[y]="    "+ CurLet ;
{SETS HISTO PLOT Left1/VaMid0/Right2 of PriceBar}
  text_setstyle( aPRI[y],1,0);                             //text_setstyle( aPRI[y],0,0);
  text_setcolor( aPRI[y],ctHisto);
end 
 else begin
if leftstr(  CurTxt ,1) <> CurLet 
 then begin                                      //if RightStr( CurTxt,1) <>  CurLet  then begin
  text_setstring( aPRI[y] , CurTxt + CurLet );  //text_setstring( aPRI[y], CurTxt+ CurLet );
  aPriStr[y] =  CurTxt + CurLet  ;
  aTPO[y]    = aTPO[y] + 1 ;
end;
end;
end;    {end of "for y = BarLo to BarHi begin"}

{***** HighestHigh LowestLow of the Day **************************************}
if  h > HH  then  HH = h ;
if  l < LL  then  LL = l ;

{*************************************************************}
if  cVrtRng <> 0     {if No color speced then no Histogram calced or plotted}
and lastbaronchart  
then begin
 VaMid   = 0 ;  
 value16 = 0 ;
 TPOtotal = 0 ;
 POC     = dLo ;
 CP      = dLo + ( dHi - dLo )/2; {center of dist.}

//{***** TODAY'S HISTOGRAM PLOT ************************************************} 
 for x = dLo to dHi  begin 
  if  aPriStr[x] <> "" then begin
  //aPriStr[x] = nutpstr( aTPO[x] , aPriStr[x] , aPRI[x] );     {Numbered Outline of Today's Histogram }
    TPOtotal   = TPOtotal + aTPO[x] ;                             {total tpo count}
    if  aTPO[x] = VaMid and x <= CP   then POC = x ;
    if  aTPO[x] = VaMid and x >  CP  
    and (x- CP ) < absvalue(CP - POC ) then POC = x ;

    if aTPO[x] > VaMid then begin
      POC   = x ;
      VaMid = aTPO[x];
    end;
  end;    {end of "if  aPriStr[x] <> "" then begin"}
 end;    {end of "for x = dLo to dHi begin"}

 VA = TPOtotal * vap ;

 if l < DayLow  then begin    {if Low < Dailylow}
   DayLow = l ;
   Price = FP +(( dLo -501)  * mintick );
   if Labl <> 0 then Text_SetLocation( Labl , D2p , T2p , Price );
 end;

//{***** VALUE AREA TEXT   ploted above PriceBars CURRENT DAY *****************************} 
 if ptLabl then begin 
  if Labl = 0 then begin
   pCurLoc = GetAppInfo(aiHighestDispValue) - (10 * mintick) ;  {New Location at Top of Chart}
 //Price = FP +(( dLo -501) * mintick );           {Prior30321, VA Txtlocation difficult to see }
   Labl  = text_new( D2p , T2p , pCurLoc, "-" );   //Labl  = text_new( D2p , T2p , Price, "-" );
   text_setstyle( Labl , 2 , 3 );               
   text_setcolor( Labl , cRngLbl );   //text_setcolor(Labl,cRngLbl);
  {Current VA Values & TextPlots are Updated on Line459}
  end;
 end;

 if VA <> 0 then begin
   value61 = value18; 
   x   = VaMid ;
   VAH = POC   ;
   VAL = POC   ;

   while x < VA begin
     value19 = aTPO[ VAH +1] + aTPO[ VAH +2] ;  
     value20 = aTPO[ VAL -1] + aTPO[ VAL -2] ;
     if value19 >= value20  then begin
      if x + aTPO[ VAH +1] >= VA  
       then begin
        x  = x + aTPO[ VAH +1] ;
        VAH = VAH + 1 ;
      end else begin
        x = x + value19 ;  
        VAH = VAH + 2 ;
      end;
     end else begin
     if x + aTPO[ VAL -1] >= VA  then begin
       x = x + aTPO[ VAL -1] ; 
       VAL = VAL - 1 ;
     end else begin
       x = x + value20 ;  
       VAL = VAL -2;
     end;                
     end;
   end;    {end of "while x < VA begin"}

//{***** MOST CURRENT VALUE AREA & POC CENTER POINT *************************}    
   if VAH > dHi  then  VAH = dHi ; 
   if VAL < dLo  then  VAL = dLo ;    
   OldPOC = POC ;
   OldVAH = VAH ;
   OldVAL = VAL ;
   VAH    = FP + ((VAH-500) * mintick );
   VAL    = FP + ((VAL-500) * mintick );
   if NewDayFlag = 1  then  value63 = t ;

   if VAH > VAL and NewDayFlag > 1  then begin
    if TL_VrtRng  = 0 
     then begin

//{***** CURRENT DAY VALUE AREA VERTICAL LINE **************************************}
      TL_VrtRng  = tl_new( D1p , T1p , VAH , D1p , T1p , VAL );
      tl_setcolor  ( TL_VrtRng  , cVrtRng );
      tl_setsize   ( TL_VrtRng  , wVrtRng );               //tl_setsize(VrtRng,wVrtRng);
      vCurPOC = FP +(( OldPOC - 500 ) * mintick );

//{*** CURRENT DAY POC,VAL & VAH  (Vertical & Horizontal Lines) ********************}
      TL_VrtPOC = tl_new( D1p , T1p , vCurPOC + mintick /15, D1p , T1p , vCurPOC - mintick /15);
      tl_setcolor( TL_VrtPOC , cPOC ) ;                 //tl_setcolor(tlVACpt,cVrtRng);
      tl_setsize ( TL_VrtPOC , wPOC  ) ;                //tl_setsize(tlVACpt,value88);

      plot1( vCurPOC , "POCaxis", ctPOC ) ;
      plot2( VAH ,"VAHaxis", cVAH ); 
      plot3( VAL ,"VALaxis", cVAL );


//    {***** Horizontal Lines *****} 
      TL_VAH = tl_new( D2p , T2p , VAH , D2p , t , VAH );
      tl_setcolor( TL_VAH , cVAH  );
      tl_setsize ( TL_VAH , wVaHL );
      TL_VAL = tl_new( D2p , T2p , VAL , D2p , t , VAL );
      tl_setcolor( TL_VAL , cVAL  );
      tl_setsize ( TL_VAL , wVaHL );
      TL_POC = tl_new( D2p , T2p , vCurPOC , D2p , t , vCurPOC );
      tl_setcolor( TL_POC , ctPOC );
      tl_setsize ( TL_POC , wVaHL );
    end 
     else begin
    if OldVAH <> VAH       
     then begin
      tl_setbegin( TL_VrtRng , D1p , T1p , VAH );
    //tl_setbegin( TL_VAH , D2p , T1p , VAH );     {Current ValueAreaHigh Line}
    //tl_setend  ( TL_VAH , D2p , t   , VAH );
    end;

    if OldVAL <> VAL
     then begin
      tl_setend  ( TL_VrtRng  , D1p , T1p , VAL );
    //tl_setbegin( TL_VAL , D2p , T1p , VAL );
    //tl_setend  ( TL_VAL , D2p , t   , VAL );
    end;
    end;
  end;     {end of "if VAH > VAL and NewDayFlag > 1  then begin"}

     if   NewDayFlag > 1 {and value61 <> value18 }
      then begin
        vCurPOC = FP + (( OldPOC - 500 ) * mintick );
        tl_setbegin( TL_VrtPOC , D1p , T1p , vCurPOC + mintick / 15 );
        tl_setend  ( TL_VrtPOC , D1p , T1p , vCurPOC - mintick / 15 );
     end;

     text_setstring( Labl ,"CurVA:"+mp_str32( VAL ) + " " + mp_str32( VAH ));

  end;     {end of "if VA <> 0 then begin" line#300}
end;     {end of "if  cVrtRng <> 0 and lastbaronchart " line#263}


{**** PRIOR HISTORY VAH & VAL LINES ***********************************}

 If phVaHL  then begin 
   var: TL_hVAH (0), TL_hVAL (0);
   TL_hVAH = tl_new( D1p-1 , T1p , VAH , D2p , T2p , VAH );
   TL_hVAL = tl_new( D1p-1 , T1p , VAL , D2p , T2p , VAL );
   tl_setcolor( TL_hVAH , chVAH  );
   tl_setsize ( TL_hVAH , whVaHL );   
   tl_setcolor( TL_hVAL , chVAL  );
   tl_setsize ( TL_hVAL , whVaHL ); 
 end;


{***** MostRecent LastClosingPrice (floating Horizontal Line) ************************}
//var: TL_LstPrc (0);
if pLstPrc  then begin
  if  TL_LstPrc  = 0 
  and currentbar = 3 
   then begin
     TL_LstPrc = tl_new( value50 , value51 ,c,d,t,c );
     tl_setcolor  ( TL_LstPrc , cLstPrc   );           {Color of CurrentPrice floating Line}
     tl_setsize   ( TL_LstPrc , 1 );
     TL_SetExtLeft( TL_LstPrc , true );
  end else 
  if currentbar > 3 
  and LastBarOnChart  
   then begin
     tl_setend  ( TL_LstPrc ,d,t,c);
     tl_setbegin( TL_LstPrc , value52 , value53 ,c );

     tl_setend  ( TL_POC , d , t ,  vCurPOC );
     tl_setbegin( TL_POC , d , 930, vCurPOC );
     tl_setend  ( TL_VAH , d , t ,  VAH );
     tl_setbegin( TL_VAH , d , 930, VAH );
     tl_setend  ( TL_VAL , d , t ,  VAL );
     tl_setbegin( TL_VAL , d , 930, VAL );
   //if h > HH  then  tl_setend  ( TL_hVAH , d , t , VAL ); 

end;

  value52 = value50 ;
  value53 = value51 ;
  value50 = d ;
  value51 = t ;
end;

end; //{end of "if BarStatus(1)=2 then begin"} 
 {****  PRICEBAR REPLOT OVER TOP OF HISTOGRAM & LINES *****} 

if pPBWick then begin
 if C > C[1] and C[1] < C[2] then Color = green
  else
 if C < C[1] and C[1] > C[2] then Color = red
  else
 if C > O then Color = cBarUP  
  else         Color = cBarDN ;

 PBWick = tl_new( D, T , Low , D, T, High );
 tl_setcolor( PBWick , cPBWick );
 tl_setsize ( PBWick , wPBWick );   //tl_setsize ( PBWick , wPBWick );

 PBBody = tl_new( D, T, Open , D, T, Close );  
 tl_setcolor( PBBody , Color );
 tl_setsize ( PBBody , wPBBody );   //tl_setsize ( PBBody , wPBBody );       
end;     {end of "if pPBWick then begin"}

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.