How could you add the volume up between swings and list it on the chart? For instance, if you had a 19 bar swing with the Real Time Swing.efs indicator what is the total volume just for those 19 bars. Place the total right on the chart like the number of bars on a swing for example 25.2MM.
Announcement
Collapse
No announcement yet.
Real Time Swing.efs
Collapse
X
-
Hello usgvince,
One approach you could explore would be to create a global variable to store the accumulated volume figure. Inside the doLine() function you'll see a condition that check for sType == "con" This is the event that occurs at barstate newbar that draws the confirmed swing lines. Inside this condition set your gloabl variable to 0. This will start the accumulation over while the next swing is developing.
PHP Code:nTotalSwingVolume = 0;
PHP Code:var nPrevVolume = volume(-1);
if (nPrevVolume != null) {
nTotalSwingVolume += volume(-1);
}
Jason K.
Project Manager
eSignal - an Interactive Data company
EFS KnowledgeBase
JavaScript for EFS Video Series
EFS Beginner Tutorial Series
EFS Glossary
Custom EFS Development Policy
New User Orientation
-
Still not getting results
Attached is my attemp, but it doesn't seem to work. I added //EVR Add where I entered the lines. I also having some problem figuring out the chart output.
ThanksAttached Files
Comment
-
FWIW:
Here is the efs with two minor corrections recommended by Jason:
a. created a global variable
b. inserted the sum code within a BARSTATE_NEWBAR routine
I hope it works as you need.
note: the volume output is to the output window, not the chart. If you want to see the current volume count you could use drawTextRelative, drawTextAbsolute, or drawTextPixel. If you just want to see the result in the Cursor Window consider replacing the function main() return statement with:
PHP Code:return nTotalSwingVolume.toFixed();
PHP Code:setShowCursorLabel(false);
PHP Code:setShowCursorLabel(true);
Attached FilesLast edited by waynecd; 02-05-2009, 09:02 PM.
Comment
-
Hi,
Just in case I added the code that shows the volume output to the Cursor Window.
wayneAttached Files
Comment
-
Volume seems off
When I look at the swing lines on the chart I would like to totalize or average the volume from lowest point to highest point based on the pivot line in the study. Something looks wrong because sometimes the volume is accumulating before and sometimes after the high or low of the pivot line.
The pivot lines look right on my chart and the volume on some lines start at the next bar after the pivot which is correct, but some times it may be 2 or 3 bars after the pivot line before the volume starts to accumulate.
Any help on getting the volume on the chart would be appreciated.
Thanks for the help so far.
Comment
-
The formula is not quite right
I was wondering if where Jason suggested to place the formula isn't in the correct location. The formula was as follows:
var nPrevVolume = volume(-1)
if (nPreVolume !=null{
nTotalSwingVolume += volume(-1)
}
I wanted the total volume including the starting pivot point volume from the start of the leg to the end of the pivot leg including the pivot point volume at the end. Perhaps in the above formula volume(0) instead of volume(-1).
Perhaps the above formula needs to go into the
function Init(h,l,c){ but the new function would be called
function Init(h, l, c, v){
I believe the function Init(h,l,c) looks for a new pivot point.
I'm not sure how the function Init(h, l, c){ needs to be changed to add the full volume including both pivot points.
ThanksLast edited by usgvince; 02-08-2009, 01:20 PM.
Comment
-
Hi usgvince,
Attached is the best I know how to do for what you are asking. I also added a menu option in case you don't want to display the volume labels.
I had to change the label positions to start at the pivot bar instead of centered over it because of limitations of drawTextRelative.
Volume labels are shown above/below the % values.
You should test to make sure the volume is calculated the way you want.
wayneAttached Files
Comment
Comment