NexusFi: Find Your Edge


Home Menu

 





Design a DayTrader Scalping Order Flow Indicator


Discussion in Traders Hideout

Updated
      Top Posters
    1. looks_one hyperscalper with 136 posts (239 thanks)
    2. looks_two Chof with 22 posts (12 thanks)
    3. looks_3 Connor with 16 posts (8 thanks)
    4. looks_4 justtrader with 14 posts (8 thanks)
      Best Posters
    1. looks_one bobwest with 2 thanks per post
    2. looks_two hyperscalper with 1.8 thanks per post
    3. looks_3 SpeculatorSeth with 1 thanks per post
    4. looks_4 Chof with 0.5 thanks per post
    1. trending_up 47,677 views
    2. thumb_up 328 thanks given
    3. group 55 followers
    1. forum 248 posts
    2. attach_file 80 attachments




 
Search this Thread

Design a DayTrader Scalping Order Flow Indicator

  #151 (permalink)
 Chof 
Edmonton AB. / Canada
 
Experience: Intermediate
Platform: NT 8
Broker: Amp / CQG
Trading: NQ index
Frequency: Several times daily
Duration: Seconds
Posts: 47 since Apr 2017
Thanks Given: 29
Thanks Received: 50

Hi HS,

Please take no offence, I'm not trying to point out error - I'm just trying to
understand how to sign volume according to MM's actions like you do.

double midPrice = 0.5 * ( bidPrice + askPrice ); // halfway between

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

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
Trade idea based off three indicators.
Traders Hideout
REcommedations for programming help
Sierra Chart
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
use extra computer for optimisation
NinjaTrader
 
  #152 (permalink)
 hyperscalper 
boise idaho
 
Experience: Advanced
Platform: NinjaTrader C# Custom
Broker: NinjaTrader LeeLoo Rithmic
Trading: Nasdaq Futures NQ/MNQ
Posts: 314 since Apr 2020
Thanks Given: 15
Thanks Received: 522


Chof View Post
Hi HS,

Please take no offence, I'm not trying to point out error - I'm just trying to
understand how to sign volume according to MM's actions like you do.

double midPrice = 0.5 * ( bidPrice + askPrice ); // halfway between

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

Hey, there's no problem here at all.

No offense taken anywhere.

You don't need to copy my convention; just be sure you
are consistent in your own conventions.

I think in the code that I represent Retail Selling, where
the trade is nearer the Bid price or below the MidPrice;
as a negative number.

hyperscalper

Started this thread Reply With Quote
  #153 (permalink)
 Chof 
Edmonton AB. / Canada
 
Experience: Intermediate
Platform: NT 8
Broker: Amp / CQG
Trading: NQ index
Frequency: Several times daily
Duration: Seconds
Posts: 47 since Apr 2017
Thanks Given: 29
Thanks Received: 50


Hi HS,

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".

Bet you knew I'd have a problem with this eh?

cheers,

C

Reply With Quote
  #154 (permalink)
 
trendisyourfriend's Avatar
 trendisyourfriend 
Quebec Canada
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG
Trading: ES, NQ, YM
Frequency: Daily
Duration: Minutes
Posts: 4,527 since Oct 2009
Thanks Given: 4,176
Thanks Received: 6,020


Chof View Post
Hi HS,

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".

Bet you knew I'd have a problem with this eh?

cheers,

C

I think your tradeLotSize should be defined as a series to be able to compute the EMA():
private Series<double> tradeLotSize;

Reply With Quote
Thanked by:
  #155 (permalink)
 Chof 
Edmonton AB. / Canada
 
Experience: Intermediate
Platform: NT 8
Broker: Amp / CQG
Trading: NQ index
Frequency: Several times daily
Duration: Seconds
Posts: 47 since Apr 2017
Thanks Given: 29
Thanks Received: 50

Bonjour Quebecois !

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..

thanx I'll try it,

Chuck

Reply With Quote
Thanked by:
  #156 (permalink)
 hyperscalper 
boise idaho
 
Experience: Advanced
Platform: NinjaTrader C# Custom
Broker: NinjaTrader LeeLoo Rithmic
Trading: Nasdaq Futures NQ/MNQ
Posts: 314 since Apr 2020
Thanks Given: 15
Thanks Received: 522


Chof View Post
Hi HS,

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".

Bet you knew I'd have a problem with this eh?

cheers,

C

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...

hyperscalper

Started this thread Reply With Quote
Thanked by:
  #157 (permalink)
 Chof 
Edmonton AB. / Canada
 
Experience: Intermediate
Platform: NT 8
Broker: Amp / CQG
Trading: NQ index
Frequency: Several times daily
Duration: Seconds
Posts: 47 since Apr 2017
Thanks Given: 29
Thanks Received: 50

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).

Chuck

Reply With Quote
  #158 (permalink)
 hyperscalper 
boise idaho
 
Experience: Advanced
Platform: NinjaTrader C# Custom
Broker: NinjaTrader LeeLoo Rithmic
Trading: Nasdaq Futures NQ/MNQ
Posts: 314 since Apr 2020
Thanks Given: 15
Thanks Received: 522


Chof View Post
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).

Chuck

Glad you got something working !!!

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...

hyperscalper

Started this thread Reply With Quote
Thanked by:
  #159 (permalink)
 Chof 
Edmonton AB. / Canada
 
Experience: Intermediate
Platform: NT 8
Broker: Amp / CQG
Trading: NQ index
Frequency: Several times daily
Duration: Seconds
Posts: 47 since Apr 2017
Thanks Given: 29
Thanks Received: 50

Hi HS,

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?

Have a good evening,

C

Reply With Quote
Thanked by:
  #160 (permalink)
 hyperscalper 
boise idaho
 
Experience: Advanced
Platform: NinjaTrader C# Custom
Broker: NinjaTrader LeeLoo Rithmic
Trading: Nasdaq Futures NQ/MNQ
Posts: 314 since Apr 2020
Thanks Given: 15
Thanks Received: 522



Chof View Post
Hi HS,

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?

Have a good evening,

C

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 !

hyperscalper

Started this thread Reply With Quote
Thanked by:




Last Updated on January 26, 2023


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts