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.

Recommended Posts

Hello.

 

I'm having trouble with a study, and I would like some help with it.

 

The premise is simple.

Recording today's total volume traded between a specified time range and comparing it with the same previous day traded volume during the same specified time range.

 

So far so good. The formula below does just that.

 

The thing is, I want today's reading to indicate the difference of traded volume when compared to yesterday's traded volume at that same time.

 

So, if today, at 10:05 AM, the ES has already traded 115.882 futures, what is the difference in %, when compared to yesterday's same time?

I can say that this Friday, at 10:05 AM we had traded 129% more volume than the previous day at that same time.

 

Simply said, I want to know in realtime the trade volume difference when compared to yesterday's traded volume?

How can I program and insert that in the formula below?

 

Thank you.

 

Regards,

Fernando

 

PS: I use Multicharts.

 

Inputs: 
  startTime      (930), 
  endTime      (1200); 

variables: 
  stTime         (false), 
  resetVol      (false), 
  sessVol      (0), 
  myVolume      (0), 
  prevVolume      (0), 
  todayVolume      (0); 


if BarType >= 2 then                              
  MyVolume = Volume 
else                        
  MyVolume = Ticks; 


if date <> date[1] then begin 
  resetVol = false; 

  if time > startTime and resetVol = false then begin 
     resetVol = true; 
     prevVolume = todayVolume; 
     todayVolume = 0; 
  end; 

end; 

if time > startTime and time < endTime then begin 
  todayVolume = todayVolume + myVolume; 
end; 


plot1(todayVolume); 
plot2(prevVolume);

Share this post


Link to post
Share on other sites
...

So, if today, at 10:05 AM, the ES has already traded 115.882 futures, what is the difference in %, when compared to yesterday's same time?

I can say that this Friday, at 10:05 AM we had traded 129% more volume than the previous day at that same time.

...

 

 

What is your chart resolution?

 

are you looking at volume at each 5 min block?

or volume since the market opening?

Share this post


Link to post
Share on other sites
What is your chart resolution?

 

are you looking at volume at each 5 min block?

or volume since the market opening?

 

Hi.

 

I'm looking at volume since the opening, in this case, since startTime input.

 

Plotting todayVolume variable we'll have the volume reading/accumulation since the startTime input until the endTime input.

The formula should be able to read resolutions above 1 minute. The attached chart shows the indicator plotted in an ES 1 minute chart.

 

We already have access to the previous day's volume with the prevVolume variable. The thing is how to have access to the volume reading/accumulation time of yesterday so we can compare it with the same time in today's volume reading/accumulation?

 

Basically, what I want, based on the time range sellected in the inputs, is to be able to see in realtime, 1 minute, 5 minutes or 30 minutes charts, the volume difference at that precise time when comparing it with yesterday's same time.

 

Thank you.

ES_snapshot8.thumb.png.0bfc083e8aee27cfe1ac0535657b6289.png

Share this post


Link to post
Share on other sites
you can create a counter to count the bars,

so that you can reference it later.

 

Hi.

 

It seems that I need to use for loop (?) (based on your image), but unfortunately my EL knowledge is still very limited :( and I haven't yet understood how that works :confused:

 

I've tried something like, for counter = 1 to current bar begin, but naturally I've got no where :roll eyes:

 

I created the counter and changed slightly the formula since the previous version had a problem.

 

I've also created the volPCT variable to calculate the % from yesterday, just to see the result of it, and at first I received an zero division error.

I added the maxlist function which resolved the problem, but I don't know if this is the best option.

 

Inputs:
startTime		(1200),
endTime		(1400);

variables:
stTime			(false),
resetVol		(false),
sessVol		(0),
myVolume		(0),
prevVolume		(0),
todayVolume		(0),
counter		(0),
volPct			(0);

if BarType >= 2 then                             
MyVolume = Volume
else                        
MyVolume = Ticks;

if date <> date[1] then begin
counter = 0;
prevVolume = todayVolume;
todayVolume = 0;
end
else begin
if time > startTime and time < endTime then begin
	todayVolume = todayVolume + myVolume;
	counter = counter + 1;
end;
end;


//volPct = ((todayVolume/maxlist(prevVolume,0.01)) - 1) * 100;


plot1(todayVolume);
plot2(prevVolume);
//plot3(counter);
//plot4(volPct);

Share this post


Link to post
Share on other sites

On time bars, I've always found it easiest (though not the most memory-efficient method) to make an array sized 2400 and fill it/look it up based on time[0].

 

So basically the code has a structure like this:

 

arrays:
 double volarray[2400](0);

// look up yesterdays...
// remember easylanguage arrays are 1-based indexes
// so to be correct you'd add 1 
value1 = volarray[time+1];

// do something with it
plot1(volume - value1,"voldiff");

// store today's...
volarray[time+1] = volume;

Share this post


Link to post
Share on other sites
Hi.

 

It seems that I need to use for loop (?) (based on your image), but unfortunately my EL knowledge is still very limited :( and I haven't yet understood how that works :confused:

 

I've tried something like, for counter = 1 to current bar begin, but naturally I've got no where :roll eyes:

 

I created the counter and changed slightly the formula since the previous version had a problem.

 

I've also created the volPCT variable to calculate the % from yesterday, just to see the result of it, and at first I received an zero division error.

I added the maxlist function which resolved the problem, but I don't know if this is the best option....

 

 

 

 

don't jump into coding yet... you are a long way from ready.

 

1. Loops is easy... it is not rocket science...you just need to read the manual.

 

2. The problem at hand is NOT about programming in EasyLanugage...

 

The problem is: how do you think through your logic:

 

i.e. writing out your thoughts...

 

a. describe what you want to do... and

b .describe HOW you are going about to get want you want.

c. the first set step in getting what you want is to give the computer what it needs...

 

can you list out the items the computer need in order to do your calculation?

 

 

 

hint: you don't need a loop, and I am not talking about array,

and your description so far is incomplete...

Share this post


Link to post
Share on other sites
...

a. describe what you want to do... and

b .describe HOW you are going about to get want you want.

c. the first set step in getting what you want is to give the computer what it needs...

 

can you list out the items the computer need in order to do your calculation?

...

 

OK, let's see if I'm able to cover all requests. Also, let's assume that all will be apllied to 1 minute charts, thought it should also be able to be applied to higher resolutions.

 

a - I want to compare today's volume with yesterday's volume.

b - I want to compare the volume of a specific time/bar with yesterday's same specific time/bar.

c - This volume comparison must be made not over the volume traded in each bar, but over the cumulative volume traded, since the time specified in the Input area.

d - This reading shoud be made inside the selected time range in the Input area.

e - To facilitate the comparison, we should use a counter, counting the bars between the selected time range.

f - using a counter you can reference the cumulative volume of each bar to the same bar (bar number) of the previous day.

 

So the computer already have the cumulative volume of the specified time range and now it needs a counter for referencing.

The counter is also there, so now it needs a way to connect the volume of each counted bar to the same previous day counted bar.

 

Right?

Share this post


Link to post
Share on other sites

one more thing is needed...

 

how do you calculate the volume percentage you want?

 

what is the formula ?

 

to make things simpler,

let's say there are only 3 bars in one day,

you are at the first bar of the day now,

and you want to compare the current bar's volume with

the first bar of yesterday...

 

how would you do it?

 

 

p.s. this is not a trick question... we are not coding yet, all you need is to write down the idea in pseudo code.

i.e. don't over complicate things.

 

 

attachment.php?attachmentid=16598&stc=1&d=1260817973

vol_count.jpg.5e991ff297581d7070029102237aa4b0.jpg

Edited by Tams

Share this post


Link to post
Share on other sites

Hi Tams.

 

Sorry for this late reply. I've just came out of the hospital yesterday :(

 

So, first I want to confirm that we have a new trading day and if confirmed, I will then start a new bar count.

 

Then, when the counter starts I will need to go to the previous day counter to reference today's first bar with yesterday's first bar.

 

To calculate the volume percentage:

 

((current volume bar number / yesterday's same volume bar number) - 1 ) * 100

Share this post


Link to post
Share on other sites
Hi Tams.

 

Sorry for this late reply. I've just came out of the hospital yesterday :(

 

So, first I want to confirm that we have a new trading day and if confirmed, I will then start a new bar count.

 

Then, when the counter starts I will need to go to the previous day counter to reference today's first bar with yesterday's first bar.

 

To calculate the volume percentage:

 

((current volume bar number / yesterday's same volume bar number) - 1 ) * 100

 

 

Hi Arnie...

 

Hope you are ok and wishing you a speedy recovery.

 

 

1. a few suggestions:

 

When describing programming logics,

get into the habit of writing SHORT sentences.

Start a new line with every comma,

and every period.

This will help you to isolate the thoughts

into sections of logics...

so that you can attack each section

with a fresh mind

and not get confused with multiple logics

at the same time.

 

 

2. YUP...

The formula is correct.

Let's put it in coding format:

 

Can you tell WHY I knew the bar number was [3] ?

(see prev diagram for clue)

 

 

attachment.php?attachmentid=16738&stc=1&d=1261233564

 

 

 

 

p.s. there is limitation to this method...

we can discuss the limitation and solution later.

let's figure out bar referencing first.

vol_count_formula.jpg.676d590dfe8df57625ba08ab9020af33.jpg

Edited by Tams

Share this post


Link to post
Share on other sites

Thanks Tams.

It was a small surgery. Nothing to worry about, though for a short period of time, I'm limited in terms of walking.

 

Hey, look at the bright side, I have more time to study EL ;)

 

 

It looks like you use the previous day counter to know how many bars exist in that day, and then for today calculations you use downto loop (?) to count backwards?

 

Something like:

 

for currentbar(count) downto previousbar(count)

 

:confused:

Share this post


Link to post
Share on other sites
Thanks Tams.

It was a small surgery. Nothing to worry about, though for a short period of time, I'm limited in terms of walking.

 

Hey, look at the bright side, I have more time to study EL ;)

 

 

It looks like you use the previous day counter to know how many bars exist in that day, and then for today calculations you use downto loop (?) to count backwards?

 

Something like:

 

for currentbar(count) downto previousbar(count)

 

:confused:

 

 

 

no... no loops. I said that before... no loops needed.

Share this post


Link to post
Share on other sites
// Volume Percentage
// based on a concept by arnie_pt
// author: TAMS
// date: 20091219
// license: public use. Retention of this header is required.
// http://www.traderslaboratory.com/forums/f56/help-formula-7276.html
//

{The premise is simple. 
Recording today's total volume traded between a specified time range 
and comparing it with the same previous day traded volume 
during the same specified time range. 

i.e. Today's reading will indicate the difference of traded volume
when compared to yesterday's traded volume at that same time. 

Say, if today, at 10:05 AM, the ES has already traded 115.882 futures, 
what is the difference in %, when compared to yesterday's same time? 
I can say that this day, at 10:05 AM we had traded 129% more volume 
than the previous day at that same time. 

Simply said, this indicator lets you know in realtime 
the trade volume difference when compared to yesterday's traded volume. 
}

input:
Threshold(68.268),
upcolor(blue),
downcolor(red);

var:
Counter(0),
Bar_count(0),
VolPct(0),
TodayVolume(0);

{========== end of variables ==========}


{----- beginning of new day, reset variables -----}

if d <> d[1] then
begin
bar_count = counter;
Counter = 0;
TodayVolume = 0;
end;


{----- increment variables -----}

Counter = Counter + 1;
TodayVolume = TodayVolume + ticks;


{----- calculate volume percentage -----}

VolPct = ( TodayVolume / TodayVolume[bar_count] ) * 100;


{----- plot -----}

plot1( 0, "Zero" );  {so that bars automatically start at zero}
plot10( VolPct, "VolPct" );  {set as histogram}
plot11( threshold, "Threshold");   {set as line}

if VolPct < Threshold then
SetPlotColor(10, downcolor)
else
SetPlotColor(10, upcolor);

{========== end ==========}

Edited by Tams

Share this post


Link to post
Share on other sites

Seeing it now, it's amazing how simple it is :embarassed:

 

The strange part is that in theory, we should see negative percentages and that never happens :confused:

This cannot be possible. It would be the same to say that every single day, more volume is traded relatively to the previous day, and that, we know that it's not true.

 

I'm sure I'm missing something, but I couldn't figure it out yet.

 

Another thing that I'm missing is the threshold input :confused:

It seems that you consider a volume below threshold to be negative, since you set the plot color to be "down", but from where did you collect that value?

 

I'm definitely missing something :embarassed:

Share this post


Link to post
Share on other sites
Seeing it now, it's amazing how simple it is :embarassed:

 

 

It is simple.

That's why it is important to think things through first... before jumping into coding.

To help see the logic... you must write out your thoughts step-by-step in a short line-by-line format..

 

 

The strange part is that in theory, we should see negative percentages and that never happens :confused:

This cannot be possible. It would be the same to say that every single day, more volume is traded relatively to the previous day, and that, we know that it's not true.

 

I'm sure I'm missing something, but I couldn't figure it out yet.

 

Another thing that I'm missing is the threshold input :confused:

It seems that you consider a volume below threshold to be negative, since you set the plot color to be "down", but from where did you collect that value?

 

I'm definitely missing something :embarassed:

 

 

 

Anything less than 100% is "negative".

 

Just set the threshold to 100 and you will see the red for bars under 100%.

 

 

I will let you think about why I had the Threshold at 68.268%

 

 

 

Have fun

Edited by Tams

Share this post


Link to post
Share on other sites

other volume analysis that might interest you:

 

PRV -- Pro Rated Volume

http://www.traderslaboratory.com/forums/f46/prv-pro-rated-volume-5814.html

 

Volume DayAverage

http://www.traderslaboratory.com/forums/f46/volume-dayaverage-5753.html

 

Volume Weighed Color Bars

http://www.traderslaboratory.com/forums/f46/volume-weighed-color-bars-5709.html

 

Volume Bias

http://www.traderslaboratory.com/forums/f46/volume-bias-6519.html

 

 

 

 

79.60.142 (55.118)

Edited by Tams

Share this post


Link to post
Share on other sites
Thanks Tams for the links.

 

Very interesting stuff indeed.

 

Did you made any type historical test that resulted in those 68.268%?

 

Again, thank you for your patience.

 

 

There is historical/statistical significance in 68.268%,

 

but no, I did not make the tests.

 

 

You can Google "Importance of 68.268%" for more information.

 

 

.

Edited by Tams

Share this post


Link to post
Share on other sites

Hi Tams.

 

Need your wisdom again.

 

I'm trying to "plot" text on the chart, but something is wrong with it.

 

Please see formula:

 

Inputs:
startTime		(830),
endTime		(1515);

variables:
stTime			(false),
resetVol		(false),
sessVol		(0),
myVolume		(0),
prevVolume		(0),
todayVolume		(0),
txt			(0);

if currentbar = 1 then 
txt = text_new_s(date,time_s, 0, " ");
	Text_SetStyle(txt, 0, 2);

if BarType >= 2 then                             
MyVolume = Volume
else                        
MyVolume = Ticks;

if date <> date[1] then begin
prevVolume = todayVolume;
todayVolume = 0;
Text_setstring(txt, "Regular Session");
end
else begin
if time > startTime and time < endTime then begin
	todayVolume = todayVolume + myVolume;
end;
end;

Text_setlocation_S(txt, date, Time, todayVolume);	

plot1(todayVolume);
plot2(prevVolume);

 

I created a new text at the first bar and then when the condition became true I set the string for that text, and at the end set the location.

 

The location is to be in front of the todayVolume variable, and since the text isn't being "plotted" I assume that it as something to do with the location (?).

Share this post


Link to post
Share on other sites
Hi Tams.

 

Need your wisdom again.

...

 

 

sorry for the late reply; I am on a trip.

 

 

the problem is here:

 

Text_setlocation_S(txt, date, Time, todayVolume);

 

change it to Time_s

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.


  • Similar Content

    • By FMIND5
      Hello traders,
      I am interested in order flow trading and I will post some trades and predictions, some articles and ideology of a bit different understanding how price moves and why. May be this forum will be the right place. So, for the start I have  couple of charts of recent trade on oil. Also I did some comparison of two different software. Would be great to meet some traders who use order flow too. Lets see. I have a lots ideas and strategies to share. I don't use any traditional indicators, because just numbers are important for me.
       
       
       


    • By trading4life
      Hello, My name is trading4life.
      I just joined this forum.
  • Topics

  • Posts

    • Date: 22nd November 2024.   BTC flirts with $100K, Stocks higher, Eurozone PMI signals recession risk.   Asia & European Sessions:   Geopolitical risks are back in the spotlight on fears of escalation in the Ukraine-Russia after Russia reportedly used a new ICBM to retaliate against Ukraine’s use of US and UK made missiles to attack inside Russia. The markets continue to assess the election results as President-elect Trump fills in his cabinet choices, with the key Treasury Secretary spot still open. The Fed’s rate path continues to be debated with a -25 bp December cut seen as 50-50. Earnings season is coming to an end after mixed reports, though AI remains a major driver. Profit taking and rebalancing into year-end are adding to gyrations too. Wall Street rallied, led by the Dow’s 1.06% broadbased pop. The S&P500 advanced 0.53% and the NASDAQ inched up 0.03%. Asian stocks rose after  Nvidia’s rally. Nikkei added 1% to 38,415.32 after the Tokyo inflation data slowed to 2.3% in October from 2.5% in the prior month, reaching its lowest level since January. The rally was also supported by chip-related stocks tracked Nvidia. Overnight-indexed swaps indicate that it’s certain the Reserve Bank of New Zealand will cut its policy rate by 50 basis points on Nov. 27, with a 22% chance of a 75 basis points reduction. European stocks futures climbed even though German Q3 GDP growth revised down to 0.1% q/q from the 0.2% q/q reported initially. Cryptocurrency market has gained approximately $1 trillion since Trump’s victory in the Nov. 5 election. Recent announcement for the SEC boosted cryptos. Chair Gary Gensler will step down on January 20, the day Trump is set to be inaugurated. Gensler has pushed for more protections for crypto investors. MicroStrategy Inc.’s plans to accelerate purchases of the token, and the debut of options on US Bitcoin ETFs also support this rally. Trump’s transition team has begun discussions on the possibility of creating a new White House position focused on digital asset policy.     Financial Markets Performance: The US Dollar recovered overnight and closed at 107.00. Bitcoin currently at 99,300,  flirting with a run toward the 100,000 level. The EURUSD drifts below 1.05, the GBPUSD dips to June’s bottom at 1.2570, while USDJPY rebounded to 154.94. The AUDNZD spiked to 2-year highs amid speculation the RBNZ will cut the official cash rate by more than 50 bps next week. Oil surged 2.12% to $70.46. Gold spiked to 2,697 after escalation alerts between Russia and Ukraine. Heightened geopolitical tensions drove investors toward safe-haven assets. Gold has surged by 30% this year. Haven demand balanced out the pressure from a strong USD following mixed US labor data. Silver rose 0.9% to 31.38, while palladium increased by 0.9% to 1,040.85 per ounce. Platinum remained unchanged. Always trade with strict risk management. Your capital is the single most important aspect of your trading business.   Please note that times displayed based on local time zone and are from time of writing this report.   Click HERE to access the full HFM Economic calendar.   Want to learn to trade and analyse the markets? Join our webinars and get analysis and trading ideas combined with better understanding of how markets work. Click HERE to register for FREE!   Click HERE to READ more Market news. Andria Pichidi HFMarkets Disclaimer: This material is provided as a general marketing communication for information purposes only and does not constitute an independent investment research. Nothing in this communication contains, or should be considered as containing, an investment advice or an investment recommendation or a solicitation for the purpose of buying or selling of any financial instrument. All information provided is gathered from reputable sources and any information containing an indication of past performance is not a guarantee or reliable indicator of future performance. Users acknowledge that any investment in FX and CFDs products is characterized by a certain degree of uncertainty and that any investment of this nature involves a high level of risk for which the users are solely responsible and liable. We assume no liability for any loss arising from any investment made based on the information provided in this communication. This communication must not be reproduced or further distributed without our prior written permission.
    • A few trending stocks at support BAM MNKD RBBN at https://stockconsultant.com/?MNKD
    • BMBL Bumble stock watch, pull back to 7.94 support area with high trade quality at https://stockconsultant.com/?BMBL
    • LUMN Lumen Technologies stock watch, pull back to 7.43 support area with bullish indicators at https://stockconsultant.com/?LUMN
×
×
  • Create New...

Important Information

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