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

    • Be careful who you blame.   I can tell you one thing for sure.   Effective traders don’t blame others when things start to go wrong.   You can hang onto your tendency to play the victim, or the martyr… but if you want to achieve in trading, you have to be prepared to take responsibility.   People assign reasons to outcomes, whether based on internal or external factors.   When traders face losses, it's common for them to blame bad luck, poor advice, or other external factors, rather than reflecting on their own personal attributes like arrogance, fear, or greed.   This is a challenging lesson to grasp in your trading journey, but one that holds immense value.   This is called attribution theory. Taking responsibility for your actions is the key to improving your trading skills. Pause and ask yourself - What role did I play in my financial decisions?   After all, you were the one who listened to that source, and decided to act on that trade based on the rumour. Attributing results solely to external circumstances is what is known as having an ‘external locus of control’.   It's a concept coined by psychologist Julian Rotter in 1954. A trader with an external locus of control might say, "I made a profit because the markets are currently favourable."   Instead, strive to develop an "internal locus of control" and take ownership of your actions.   Assume that all trading results are within your realm of responsibility and actively seek ways to improve your own behaviour.   This is the fastest route to enhancing your trading abilities. A trader with an internal locus of control might proudly state, "My equity curve is rising because I am a disciplined trader who faithfully follows my trading plan." Author: Louise Bedford Source: https://www.tradinggame.com.au/
    • SELF IMPROVEMENT.   The whole self-help industry began when Dale Carnegie published How to Win Friends and Influence People in 1936. Then came other classics like Think And Grow Rich by Napoleon Hill, Awaken the Giant Within by Tony Robbins toward the end of the century.   Today, teaching people how to improve themselves is a business. A pure ruthless business where some people sell utter bullshit.   There are broke Instagrammers and YouTubers with literally no solid background teaching men how to be attractive to women, how to begin a start-up, how to become successful — most of these guys speaking nothing more than hollow motivational words and cliche stuff. They waste your time. Some of these people who present themselves as hugely successful also give talks and write books.   There are so many books on financial advice, self-improvement, love, etc and some people actually try to read them. They are a waste of time, mostly.   When you start reading a dozen books on finance you realize that they all say the same stuff.   You are not going to live forever in the learning phase. Don't procrastinate by reading bull-shit or the same good knowledge in 10 books. What we ought to do is choose wisely.   Yes. A good book can change your life, given you do what it asks you to do.   All the books I have named up to now are worthy of reading. Tim Ferriss, Simon Sinek, Robert Greene — these guys are worthy of reading. These guys teach what others don't. Their books are unique and actually, come from relevant and successful people.   When Richard Branson writes a book about entrepreneurship, go read it. Every line in that book is said by one of the greatest entrepreneurs of our time.   When a Chinese millionaire( he claims to be) Youtuber who releases a video titled “Why reading books keeps you broke” and a year later another one “My recommendation of books for grand success” you should be wise to tell him to jump from Victoria Falls.   These self-improvement gurus sell you delusions.   They say they have those little tricks that only they know that if you use, everything in your life will be perfect. Those little tricks. We are just “making of a to-do-list before sleeping” away from becoming the next Bill Gates.   There are no little tricks.   There is no success-mantra.   Self-improvement is a trap for 99% of the people. You can't do that unless you are very, very strong.   If you are looking for easy ways, you will only keep wasting your time forgetting that your time on this planet is limited, as alive humans that is.   Also, I feel that people who claim to read like a book a day or promote it are idiots. You retain nothing. When you do read a good book, you read slow, sometimes a whole paragraph, again and again, dwelling on it, trying to internalize its knowledge. You try to understand. You think. It takes time.   It's better to read a good book 10 times than 1000 stupid ones.   So be choosy. Read from the guys who actually know something, not some wannabe ‘influencers’.   Edit: Think And Grow Rich was written as a result of a project assigned to Napoleon Hill by Andrew Carnegie(the 2nd richest man in recent history). He was asked to study the most successful people on the planet and document which characteristics made them great. He did extensive work in studying hundreds of the most successful people of that time. The result was that little book.   Nowadays some people just study Instagram algorithms and think of themselves as a Dale Carnegie or Anthony Robbins. By Nupur Nishant, Quora Profits from free accurate cryptos signals: https://www.predictmag.com/    
    • there is no avoiding loses to be honest, its just how the market is. you win some and hopefully more, but u do lose some. 
    • $CSCO Cisco Systems stock, nice top of range breakout, from Stocks to Watch at https://stockconsultant.com/?CSCOSEPN Septerna stock watch for a bottom breakout, good upside price gap
    • $CSCO Cisco Systems stock, nice top of range breakout, from Stocks to Watch at https://stockconsultant.com/?CSCOSEPN Septerna stock watch for a bottom breakout, good upside price gap
×
×
  • Create New...

Important Information

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