Page 1 of 1

Volume @ Price String in the right margin of the workspace

Posted: 12 Oct 2010
by CrazyNasdaq
Hi,
watching the great indicator for the Time&Sales posted in this section, I'd like to create in the right margin of the Workspace a series of strings which plots the Volume at Price strings for the last session.
If you apply it on a 1 tick chart, each line would plot the # of shares/contracts traded in the last session.
I've create a code, but something doesn't work because it doesn't plot what I want and the print statement in the bottom of the code tells me that I'm wrong somewhere.

See the code attached
Any suggestion will be very appreciated.

Regards
CrazyNasdaq

Re: Volume @ Price String in the right margin of the workspa

Posted: 12 Oct 2010
by TJ
you should also post a mock up picture.

Re: Volume @ Price String in the right margin of the workspa

Posted: 12 Oct 2010
by CrazyNasdaq
you should also post a mock up picture.
Here is what I would like to plot
See the picture attached

Re: Volume @ Price String in the right margin of the workspa

Posted: 13 Oct 2010
by TJ
do a search for an indicator named "TPO".
it has most of the code components you need.

Re: Volume @ Price String in the right margin of the workspa

Posted: 14 Oct 2010
by CrazyNasdaq
do a search for an indicator named "TPO".
it has most of the code components you need.
OK !!

Thanks

Re: Volume @ Price String in the right margin of the workspa

Posted: 15 Oct 2010
by CrazyNasdaq
I've made some adjustments and it seems to work now even if not well as it should, infact there are a couple of things that don't work fine and I don't know where the problem could be.

Attached you can find some pictures from different instruments with different price scale settings.
All the settings are correct in the Quotemanager for the minmovment, price scale and so on.
So the problem should be in the code.
I've attached also the TXT files from the statement generated from the code for each instrument. The variables, iPrice and Volume are all correct but the string plotting is not so correct.

The first problem is this:
What I notice is that the code works fine and displays for each level of price the correct volume if applied on instruments with price-scale "AS IS" or with no decimals in each minimum movment (FESX , YM). If you apply the code to instruments with price-scale in decimals (ES, NQ, 6E, FDAX, FGBL .....), it displays only the volume for the integer price and not for the decimals.
For example on the €/USD future (6E), it displays only one string even if I've plotted it on 1 tick chart where the average price is equal to close for each tick and iPrice is equal to average price.

The second problem is how to maintain the vertical alignment for the all strings at each new quote. After some seconds, the vertical alignment is lost and you find strings in the middle of the chart. Only the strings referencing the last quotes stay in the right margin of the chart.

Here is the code that I've made for the Volume@Price_string. Any help or suggestion will be very appreciated.

Code: Select all

//CrazyNasdaq date 20101012
//Volume@Price string
//version beta 0.1

Inputs: Txt.Color(red),
Txt.Size(8),
Txt.Bold(false),
Txt.Font("verdana");


Vars: StartPrice(0),
iPrice(0),
MyVolume(0);

Array: Vol.Array[15000](0),
Vol.Txt[15000](0),
Vol.Str[15000](" --- ");

If date = lastcalcdate then begin //this statement make the code begin only if the day is the last day on the chart

MyVolume = Volume;

// Reset Each day at the first TICK
if date > date[1] then begin
iPrice = AvgPrice;
StartPrice = AvgPrice;

for value1 = 0 to 15000 begin //this statement reset all the array to zero
Vol.Array[value1] = 0;
END;

Vol.Array[iPrice] = MyVolume; //this statement assigns the Volume to the first tick of the array

END;

// Calculate the value for the rest of the day past the first TICK
If date = date[1]and StartPrice > 0 then begin
iPrice = avgprice; //is suggested to use 1 tick chart

Vol.Array[iPrice]= Vol.Array[iPrice] + MyVolume; //this collects volume at each new tick and summs Volume with previous volume

END;

Vol.Str[iPrice] = numtostr(Vol.Array[iPrice],0); //this transform numbers of the Volume @ each Price in strings to display

text_Delete(vol.txt[iprice]); //this is to not rewrite the string on the previous string
vol.txt[iPrice]=text_new(d, getAppInfo(aiRightDispDateTime),iPrice,"text string");
text_setstyle(vol.txt[iPrice],1,2);
text_setcolor(vol.txt[iPrice],getbackgroundcolor);
text_setstring(vol.txt[iPrice], vol.str[iPrice]+ " ");
text_setcolor(vol.txt[iPrice],Txt.Color);
Text_SetSize(Vol.txt[iPrice], txt.Size);
text_setattribute(Vol.txt[iPrice], 1 , txt.bold);
text_setfontname(Vol.txt[iPrice], txt.font);
text_setlocation(Vol.txt[iPrice], d, getappinfo(airightdispdatetime), iprice);

{This is the statement that creates the TXT file to control if the code works fine}
Print(File("C:/temp/Volumestring_"+Getsymbolname+".txt")," ",numtostr(date,0), " ", numtostr(time_s,0), " ", numtostr(iprice, 4)," ", numtostr(Vol.Array[iPrice],0));

END;
CrazyNasdaq

Re: Volume @ Price String in the right margin of the workspa

Posted: 15 Oct 2010
by CrazyNasdaq
These are the TXT statements generated from the code.
Attached.

P.S.
This feature could be very interesting to have as default in a next release of Multicharts, as the Volume Profile that already is in the right margin of the workspace.
It could be a utility as many DOM now have to implement in MC.

Re: Volume @ Price String in the right margin of the workspa

Posted: 15 Oct 2010
by TJ
the texts appear on the chart because you put them there...

the chart increments with time and new data...
and the the bars move to the left.

if you want the texts to stay at the right hand edge,
you have to re-position them through TEXT_SETLOCATION at the beginning of each bar.

Re: Volume @ Price String in the right margin of the workspa

Posted: 21 Dec 2010
by bomberone1
Hi CrazyNasdaq using volume is it poissible to find HFT enter in the markets and if they are going long or short?

Re: Volume @ Price String in the right margin of the workspa

Posted: 21 Dec 2010
by CrazyNasdaq
Hi CrazyNasdaq using volume is it poissible to find HFT enter in the markets and if they are going long or short?
Sorry, but what is the matter with this thread ?
What HFT matters with Volume@Price string ?

Re: Volume @ Price String in the right margin of the workspa

Posted: 22 Dec 2010
by bomberone1
Nothing at all.

Re: Volume @ Price String in the right margin of the workspa

Posted: 27 Dec 2010
by bomberone1
so WITH THIS INDICATOR COULD U FIND hft?

Re: Volume @ Price String in the right margin of the workspa

Posted: 27 Dec 2010
by CrazyNasdaq
so WITH THIS INDICATOR COULD U FIND hft?
This indicator is not designed to identify HFT, it's only a numerical expression of Volume profile, very accurate ( 1 tick accurate).

HFT with this indicator doesn't matter at all
You are searching here something different from what I've posted here


Image

Re: Volume @ Price String in the right margin of the workspa

Posted: 27 Dec 2010
by TJ
so WITH THIS INDICATOR COULD U FIND hft?

This indicator is not designed to identify HFT, it's only a numerical expression of Volume profile, very accurate ( 1 tick accurate).

HFT with this indicator doesn't matter at all
You are searching here something different from what I've posted here

I can see that you have worked out the text location problem.
The effect looks good.

Re: Volume @ Price String in the right margin of the workspa

Posted: 28 Dec 2010
by CrazyNasdaq
Yes, but the text location is modified from the original project because if I put it on the right edge of the screen with Getappinfo(aiRightDispDateTime ) it becomes too CPU intensive because of it calculates on each tick and on each tick the code should position all the strings.