Volume @ Price String in the right margin of the workspace

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
User avatar
CrazyNasdaq
Posts: 260
Joined: 02 Sep 2009
Location: ITALY
Has thanked: 77 times
Been thanked: 79 times

Volume @ Price String in the right margin of the workspace

Postby CrazyNasdaq » 12 Oct 2010

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
Attachments
V@P_string.txt
(2.13 KiB) Downloaded 203 times

User avatar
TJ
Posts: 6571
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 968 times
Been thanked: 1900 times

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

Postby TJ » 12 Oct 2010

you should also post a mock up picture.

User avatar
CrazyNasdaq
Posts: 260
Joined: 02 Sep 2009
Location: ITALY
Has thanked: 77 times
Been thanked: 79 times

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

Postby CrazyNasdaq » 12 Oct 2010

TJ wrote:you should also post a mock up picture.

Here is what I would like to plot
See the picture attached
Attachments
V@PString.png
V@PString.png (29.17 KiB) Viewed 832 times

User avatar
TJ
Posts: 6571
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 968 times
Been thanked: 1900 times

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

Postby TJ » 13 Oct 2010

do a search for an indicator named "TPO".
it has most of the code components you need.

User avatar
CrazyNasdaq
Posts: 260
Joined: 02 Sep 2009
Location: ITALY
Has thanked: 77 times
Been thanked: 79 times

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

Postby CrazyNasdaq » 14 Oct 2010

TJ wrote:do a search for an indicator named "TPO".
it has most of the code components you need.

OK !!

Thanks

User avatar
CrazyNasdaq
Posts: 260
Joined: 02 Sep 2009
Location: ITALY
Has thanked: 77 times
Been thanked: 79 times

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

Postby CrazyNasdaq » 15 Oct 2010

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
Attachments
6E V@P.png
6E V@P.png (29.33 KiB) Viewed 716 times
NQZ0 V@P.png
NQZ0 V@P.png (33.16 KiB) Viewed 674 times
FDAX V@P.png
FDAX V@P.png (39.85 KiB) Viewed 677 times
YM V@P.png
YM V@P.png (37.78 KiB) Viewed 653 times
FESX V@P.png
FESX V@P.png (34.02 KiB) Viewed 681 times
Last edited by CrazyNasdaq on 16 Oct 2010, edited 1 time in total.

User avatar
CrazyNasdaq
Posts: 260
Joined: 02 Sep 2009
Location: ITALY
Has thanked: 77 times
Been thanked: 79 times

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

Postby CrazyNasdaq » 15 Oct 2010

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.
Attachments
V@P_String_Statement_files_txt.rar
(561.62 KiB) Downloaded 197 times

User avatar
TJ
Posts: 6571
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 968 times
Been thanked: 1900 times

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

Postby TJ » 15 Oct 2010

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.

bomberone1
Posts: 151
Joined: 02 Nov 2010
Has thanked: 9 times
Been thanked: 10 times

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

Postby bomberone1 » 21 Dec 2010

Hi CrazyNasdaq using volume is it poissible to find HFT enter in the markets and if they are going long or short?

User avatar
CrazyNasdaq
Posts: 260
Joined: 02 Sep 2009
Location: ITALY
Has thanked: 77 times
Been thanked: 79 times

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

Postby CrazyNasdaq » 21 Dec 2010

bomberone1 wrote: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 ?

bomberone1
Posts: 151
Joined: 02 Nov 2010
Has thanked: 9 times
Been thanked: 10 times

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

Postby bomberone1 » 22 Dec 2010

Nothing at all.

bomberone1
Posts: 151
Joined: 02 Nov 2010
Has thanked: 9 times
Been thanked: 10 times

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

Postby bomberone1 » 27 Dec 2010

so WITH THIS INDICATOR COULD U FIND hft?

User avatar
CrazyNasdaq
Posts: 260
Joined: 02 Sep 2009
Location: ITALY
Has thanked: 77 times
Been thanked: 79 times

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

Postby CrazyNasdaq » 27 Dec 2010

bomberone1 wrote: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

User avatar
TJ
Posts: 6571
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 968 times
Been thanked: 1900 times

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

Postby TJ » 27 Dec 2010

CrazyNasdaq wrote:
bomberone1 wrote: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.

User avatar
CrazyNasdaq
Posts: 260
Joined: 02 Sep 2009
Location: ITALY
Has thanked: 77 times
Been thanked: 79 times

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

Postby CrazyNasdaq » 28 Dec 2010

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.


Return to “User Contributed Studies and Indicator Library”