Welcome to the Traders Laboratory Forums.
Coding Forum Collaborate, receive help, or discuss coding related issues.

Like Tree1Likes

Reply
Old 11-02-2009, 08:59 AM   #17

BlowFish's Avatar

Join Date: Mar 2007
Location: In Da House
Posts: 3,272
Ignore this user

Thanks: 129
Thanked 1,038 Times in 694 Posts



Re: Building a VolumeProfile Indicator with EasyLanguage

Code:
	If date = date[1] And StartPrice > 0 Then Begin
		Value2 = AvgPrice - StartPrice;
		V2VolLevel = 5000+(Value2*(1/(minmove/pricescale)));
		PVPVolArray[V2VolLevel] = PVPVolArray[V2VolLevel] + MyVolume;

                {Plot new volume level here volume is PVPVolArray[V2VolLevel]
                 the level to plot at can be got from V2VolLevel}
	
		If PVPVolArray[V2VolLevel] > PVPVolume Then Begin
			PVPVolume = PVPVolArray[V2VolLevel];
			PriceDiff = 5000-V2VolLevel;
			PVPPrice = StartPrice - (PriceDiff*(minmove/pricescale));

                        {If we are here then we have a new peak volume, you might need
                          to rescale the chart unless you used a 'fixed scaling'}

		End;

	End;
BlowFish is offline  
Reply With Quote
The Following 2 Users Say Thank You to BlowFish For This Useful Post:
Andytick (11-02-2009), Tams (11-02-2009)
Old 11-02-2009, 10:23 AM   #18

Join Date: Oct 2009
Location: Catania
Posts: 20
Ignore this user

Thanks: 2
Thanked 3 Times in 1 Post



Re: Building a VolumeProfile Indicator with EasyLanguage

Quote:
Originally Posted by BlowFish »
If date = date[1] And StartPrice > 0 Then Begin
Value2 = AvgPrice - StartPrice;
V2VolLevel = 5000+(Value2*(1/(minmove/pricescale)));
PVPVolArray[V2VolLevel] = PVPVolArray[V2VolLevel] + MyVolume;

{Plot new volume level here volume is PVPVolArray[V2VolLevel]
the level to plot at can be got from V2VolLevel}
Ok, Now I've understood that V2VolLevel is my price map level sets as integer. That's ok !!!
Now I've to loop it to add new volume when price touches again a map price level.
Could be a way of doing that to create a range of the day sets as the map price level which identifies High and Low of the day sets as integer as V2VolLevel ?
In this way I could create a Loop For X = Low of the day range To High of the day range and ADD Volume each time prices touch a price of the range a new time.
Something like:

For X = LowRange To HighRange-1
PVPVolArray[X] = PVPVolArray[X] + MyVol;


This step is not simple for me and my programming experience.
Sorry !!!

Quote:
If PVPVolArray[V2VolLevel] > PVPVolume Then Begin
PVPVolume = PVPVolArray[V2VolLevel];
PriceDiff = 5000-V2VolLevel;
PVPPrice = StartPrice - (PriceDiff*(minmove/pricescale));

{If we are here then we have a new peak volume, you might need
to rescale the chart unless you used a 'fixed scaling'}

End;

End;

This step is harder then previous !!!! Rescale...........how to rescale ?
I'm very sorry, but here come out all my limits in programming
Andytick is offline  
Reply With Quote
Old 11-02-2009, 10:52 AM   #19

BlowFish's Avatar

Join Date: Mar 2007
Location: In Da House
Posts: 3,272
Ignore this user

Thanks: 129
Thanked 1,038 Times in 694 Posts



Re: Building a VolumeProfile Indicator with EasyLanguage

Well there is a way to avoid rescaling. Lets take the case that does need rescaling first. If you look at GKMarketProfileTL (this is from dim distant memory) there is a parameter for number of bars that the profile occupies. In other words there is a fixed space on the X axis of say or 100 'bars' (whatever you enter for that parameter). So the profile occupies first bar of the chart to the 100th bar of the chart. This means that whenever the peak profile gets longer you need to rescale with respect to that maximum value. This is acceptable as it only occurs if the peak surpasses its old value.

An alternate way is that you have a parameter, N bars (or pixels or charcters) per X volume. That is an absolute scale. So for the ES you may have 1 'bar' (or ascii char) per 250,000 contracts. Using this method your chart simply 'grows' from the left. Every time the peak volume increases by 250,000 contracts you expand your chart 1 more 'chunk'. Of course this has the potential problem of the profile growing bigger than the screen but you could have a simple test to see if that has occurred and truncate it. The user would see that the bars are occupying the whole screen and could then manually change the scaling to say 1 'bar' per 400,000 contracts (or whatever). I like this approach.
BlowFish is offline  
Reply With Quote
The Following User Says Thank You to BlowFish For This Useful Post:
Tams (11-02-2009)
Old 11-02-2009, 11:23 AM   #20

Join Date: Oct 2009
Location: Catania
Posts: 20
Ignore this user

Thanks: 2
Thanked 3 Times in 1 Post



Re: Building a VolumeProfile Indicator with EasyLanguage

Quote:
Originally Posted by BlowFish »
An alternate way is that you have a parameter, N bars (or pixels or charcters) per X volume. That is an absolute scale. So for the ES you may have 1 'bar' (or ascii char) per 250,000 contracts. Using this method your chart simply 'grows' from the left. Every time the peak volume increases by 250,000 contracts you expand your chart 1 more 'chunk'. Of course this has the potential problem of the profile growing bigger than the screen but you could have a simple test to see if that has occurred and truncate it. The user would see that the bars are occupying the whole screen and could then manually change the scaling to say 1 'bar' per 400,000 contracts (or whatever). I like this approach.
I like the second approach too.
It could be set by an input parameter in the Inputs panel, so if you enlarge your X axis to watch the chart wide, you could choose your input parameter to enlarge even your Volume profile or compress it if you'd like to watch the chart more tight.
The second approach is better
Andytick is offline  
Reply With Quote
Old 11-02-2009, 12:37 PM   #21

Join Date: Jan 2008
Location: San Francisco
Posts: 394
Ignore this user

Thanks: 17
Thanked 338 Times in 156 Posts



Re: Building a VolumeProfile Indicator with EasyLanguage

all this CPU-intensive code is kind of just a pain in the ass...

from the 'keep it simple' school:

Frank is offline  
Reply With Quote
The Following User Says Thank You to Frank For This Useful Post:
Tams (11-02-2009)
Old 11-02-2009, 12:48 PM   #22

BlowFish's Avatar

Join Date: Mar 2007
Location: In Da House
Posts: 3,272
Ignore this user

Thanks: 129
Thanked 1,038 Times in 694 Posts



Re: Building a VolumeProfile Indicator with EasyLanguage

Actually my code is not intensive at all. Arrays are absolutely fine looping thorugh them isn't. I would go out on a limb and say there is no more efficient way to do things in El to that which I presented. None of the code I have submitted has a single loop in it except to initialise all data to zero. The sugestion i have made for histogram has not a single loop either. I also have non iterative code for VWAP & weighted SD's I decided not to share that as I believe it has commercial value (not that I have exploited that). Take a look I think it is a very elegant aproach (though of course I am biased).
BlowFish is offline  
Reply With Quote
The Following User Says Thank You to BlowFish For This Useful Post:
Tams (11-02-2009)
Old 11-02-2009, 12:55 PM   #23

BlowFish's Avatar

Join Date: Mar 2007
Location: In Da House
Posts: 3,272
Ignore this user

Thanks: 129
Thanked 1,038 Times in 694 Posts



Re: Building a VolumeProfile Indicator with EasyLanguage

Actually my code is not intensive at all. Arrays are absolutely fine looping thorugh them isn't. I would go out on a limb and say there is no more efficient way to do things in El to that which I presented. None of the code I have submitted has a single loop in it except to initialise all data to zero. The sugestion i have made for histogram has not a single loop either. I also have non iterative code for VWAP & weighted SD's (many orders of magnitude faster than tradestations own, they get exponentially faster the more bars you load) I decided not to share that as I believe it has commercial value (not that I have exploited that). Take a look I think it is a very elegant aproach (though of course I am biased).
BlowFish is offline  
Reply With Quote
Old 11-02-2009, 01:44 PM   #24

Join Date: Oct 2009
Location: Catania
Posts: 20
Ignore this user

Thanks: 2
Thanked 3 Times in 1 Post



Re: Building a VolumeProfile Indicator with EasyLanguage

Quote:
Originally Posted by Frank »
all this CPU-intensive code is kind of just a pain in the ass...

from the 'keep it simple' school:

CPU intensive Array loops[/url]
Well Frank your chart is fine, and if I'm not wrong it's from Open & Cry platform.
I've tried it for the demo period months ago.
But what about yesterday Histogram with that pltaform ? and the day before ?

What I'm trying to do is a Volume profile histogram to plot on Multicharts or tradestation, something EL compatible, which plots not only today histogram, but could have an history of Volume profiles. Something that plot without using excel or other things, but simply charging data from my database and plotting it as a simple MACD or other indicators.

Blowfish codes That I use to plot PVP price (mode) is not CPU intensive at all and not seems to use loop at all, so my opinion is that Blowfish code is one of the best stuff from the 'Keep it simple' school.
If you have better ideas about this code, you are welcome. I would be very greatful to you if you have found a better way and you would share it with us, but at this time, Blowfish's code is the best I have to start and trying to improve.
AndyTick
Andytick is offline  
Reply With Quote

Reply

Tags
array, volume

« Snake Force | - »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
EasyLanguage Indicator -- How Long (in Min) 1500 Tick Bar Took to Complete Frank Coding Forum 3 03-16-2010 11:47 AM
Building a GAP Trading Strategy brownsfan019 The Candlestick Corner 41 08-06-2009 12:54 PM
Adding Sound to Your Indicator (EasyLanguage) Tams Coding Forum 33 05-10-2009 08:58 AM
building a track record? darthtrader Market Analysis 7 06-23-2007 12:19 AM
Building a Computer System wsam29 General Discussion 5 03-04-2007 07:28 PM

All times are GMT -4. The time now is 06:23 AM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.