| Coding Forum Collaborate, receive help, or discuss coding related issues. |
![]() | | Tweet | |
| | #1 | ||
![]() | Help with Formula 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. Code: 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); | ||
| |
|
| | #2 | ||
![]() | Re: Help with Formula Quote:
What is your chart resolution? are you looking at volume at each 5 min block? or volume since the market opening?
__________________ Only an idiot would reply to a stupid post | ||
| |
|
| | #3 | ||
![]() | Re: Help with Formula Quote:
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. | ||
| |
|
| | #4 | ||
![]() | Re: Help with Formula so that you can reference it later.
__________________ Only an idiot would reply to a stupid post Last edited by Tams; 12-13-2009 at 12:49 PM. | ||
| |
|
| The Following User Says Thank You to Tams For This Useful Post: | ||
TIKITRADER (12-19-2009) | ||
| | #5 | ||
![]() | Re: Help with Formula Quote:
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 ![]() I've tried something like, for counter = 1 to current bar begin, but naturally I've got no where ![]() 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. Code: 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); | ||
| |
|
| | #6 | ||
![]() | Re: Help with Formula So basically the code has a structure like this: Code: 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; | ||
| |
|
| The Following User Says Thank You to RichardTodd For This Useful Post: | ||
Tams (12-13-2009) | ||
| | #7 | ||
![]() | Re: Help with Formula Quote:
Array would be easiest method... that is, if you have overcame the Array hurdle. ;-)> here's some array help http://www.traderslaboratory.com/for...uage-5785.html
__________________ Only an idiot would reply to a stupid post | ||
| |
|
| | #8 | ||
![]() | Re: Help with Formula Quote:
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...
__________________ Only an idiot would reply to a stupid post | ||
| |
|
![]() |
| Tags |
| price volume relationship, volume |
| Thread Tools | |
| Display Modes | Help Others By Rating This Thread |
| |
| ∧ Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Tony Crabel's Opening Range Formula | Soultrader | E-mini Futures Trading Laboratory | 17 | 01-29-2010 12:18 PM |
| Help Needed Converting Easy Language Formula | Danaty | Coding Forum | 0 | 11-21-2008 06:10 PM |
| Please Help with ESignal Indicator/Formula - Price Pivots | tradinghumble | Technical Analysis | 0 | 09-04-2008 10:41 PM |
| Mark Fishers AC Stock Formula for All. | Szymon | Technical Analysis | 2 | 04-19-2008 06:11 AM |