Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
So, am I wrong in assuming if she is buying from retail sellers the volume in the
trade should be counted as + ?.. As in this case : tradePrice < midPrice; // as defined above
(I used the "volume < 0" snip as that is used a lot in volume-based indicators). Of
course they're all using bar based volume which I'd like to stay away from, but its
been my only experience so far...
C
Can you help answer these questions from other members on NexusFi?
So, I was able to get this to compile, and it looks like what I want to work with..
if ( tradePrice < midPrice ) { // this is a Retail Sell Trade to Bid, or Market Maker Buy
// retail sell processing (MM is Buying from a Seller)
// we use+tradeLotSize to represent that
double tradeLotSize = (double)dataPacket.Volume; // integer # contracts in the Trade
}
else { // retail Buy processing
// retail buy processing (MM is Selling to a Buyer)
// we use -tradeLotSize to represent that
double tradeLotSize = (double)dataPacket.Volume * -1;
}
When I try to use "tradeLotSize" in a simple averaging equation like
TV = EMA(tradeLotSize,Period)[0];
VZO[0] = 100 * (TV);
I'm getting an error saying that "the name 'tradeLotSize' does not exist in the current context."
This isn't making sense to me 'cause it's defined as a double in the previous line of code. I'm
thinking I have to declare this 'tradeLotSize' as a variable somehow before I use it in the
averaging equation. I've scoured your code for an example but you don't do that anywhere in
"TradeFlowRisk".
Yes, that's logical - (just shows my self-taught coding shortfalls) Really, assigning
properties in the line of code you're using it in is really new to me in general. Doing
the same with a series is another one. I guess that's what an education can do for
someone..
Please refer to the topic of "scope" with languages like
C#
Variables declared within a "scope" are not visible to
scopes outside.
int aValue= 0;
if ( true ) {
aValue= 1;
}
else {
aValue= 2;
}
// now print the value of aValue
// will be the value 1
// HOWEVER THIS IS DIFFERENT
if ( true ) {
int aValue= 1;
}
else {
int aValue= 2;
}
// now print the value of aValue ??
// NO, BECAUSE IT IS NOT DEFINED IN THIS OUTER SCOPE
[edit] Also, whereas you may have a reason to think of the
Volume as a double; it is usually (in futures) an int (integer)
or integral value. Now, you may have reasons to treat it as
a double precision floating point number; but just consider
why you are using it as a double here... Also, I know you're
not finished here; but always strive to make your comments
match up with the code you are writing...
I'll post this to help those learning as this is what finally compiled and plotted.
(I'm hoping the "live" data will plot more timely values)
The original question was related to 'tradeLotSize' not being recognized "does not exist
in the current context" and I WAS able to fix that by doing the calculation (EMA
equation) in the area that I defined it in...
if ( tradePrice < midPrice ); // this is a Retail Sell Trade to Bid, or Market Maker Buy
// retail sell processing (MM is Buying from a Seller)
// we use+tradeLotSize to represent that
tradeLotSize[0] = (double) dataPacket.Volume; // integer # contracts in the trade
// else // retail Buy processing
// retail buy processing (MM is Selling to a Buyer)
// we use -tradeLotSize to represent that
tradeLotSize[0] = (double) dataPacket.Volume * -1; // integer # contracts in the trade
TV = EMA(tradeLotSize, Period)[0];
AND to make 'tradeLotSize' work as a double[0] for the EMA equation, (the <double>
its defined as in this space wouldn't work)
I had to make a Series variable tradeLotSize[0] (the way I always did it - there may
be a more proper way) under the name as :
public class ROCVolumeOMDD : Indicator
{
private Series<double> tradeLotSize;
}
and again under DataLoaded :
else if (State == State.DataLoaded)
{
tradeLotSize = new Series<double>(this);
}
This worked, but if there is a better or more proper way please please teach us how
to make it better. Oh and thanks for your post(s).
As this is not a class on coding style and technique, I wouldn't
say anything except that there are always more "elegant" ways
of doing anything; and knowing the basic idioms of C#, which
is not a "script" but a fully capable compiled object-oriented language
with the ability to scale to high levels of performance and reliability...
Read as much as you can on "best practices" in C# software engineering.
Just keep learning more as you go along; no need to be a genius
for most of these Indicator applications...
Just a note on the Sunday open - using the > midPrice equation and signing volume
using the below/above midPrice logic and dataPacket.volume.... It doesn't appear to
be any different than using the close[0]>close[1] logic and regular volume so far...
The settings made with the indicators using both methods don't change the outcomes
appreciably either.
Will the participation rates (Volume totals per second or say 10 seconds) show a difference
or will I likely not see that big a change?
Glad you're working and thinking about this stuff.
What I'd have to say is that "the Devil is in the details" and
the Indicator code I provided is correct so far as it goes.
What you've done is not completely clear to me; so I don't
have any way of helping; I'd have to see the code, but then
we would be getting into a bunch of "tech support by forum"
and I'm not sure I have time to do that...
When i write code, I want to know what every moving
part of the code does exactly. There are Indicator experts
on the forum who use techniques which I haven't used
myself. For example, I don't use other Indicators "called"
from within my Indicator. Just haven't done it.
If I want an Averager, I just write my own, so I know
exactly what it's doing.
If you have code you need critiqued, then maybe you
could post it; or ask about specific snippets of code; and
we might be able to help...
I have used Retention Intervals "moving windows of data" down to
about 10 seconds; but that's because I use a derivative embedded
algorithm, and need to have fast triggers from it.
If you have a very short Retention Interval, then your potential
"summation deflections" will be limited by the incoming Trade Rates,
and you might need to Multiply the deflection to see anything....
just an idea... In after hours conditions, the Time and Sales
trade rates might simply be too slow to get much data inside
a 10 second moving window, of course !