Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
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)
Updated July 14, 2010
trending_up
5,237 views
thumb_up
2 thanks given
group
2 followers
forum
15 posts
attach_file
0 attachments
July 11th, 2010, 09:47 AM
Belgium
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110
Hi guys,
Can you direct me on how to write this :
if (5 sessions ago)
Thank you
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
July 12th, 2010, 06:24 PM
Berlin, Europe
Market Wizard
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,104
What do you need this for? Some session templates have several sessions per day, so it is not quite clear, where this is leading to. Est -ce que tu peux préciser un peu ta demande?
SARdynamite
Hi guys,
Can you direct me on how to write this :
if (5 sessions ago)
Thank you
July 12th, 2010, 10:26 PM
Belgium
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110
French friendly !
Sadly, ich spreche nicht deutsche. ;o)
Actually I wanted to compare the pre-market (market profile) total volume to the average pre-market volume of the past week (last 5 days).
I could also compare the ADR to the 5 latest ADR or the Initial Balance range.
Anyway nevermind me cause I just realised it could be done using DayOfWeek only.
Thanks nonetheless.
July 13th, 2010, 05:25 AM
Berlin, Europe
Market Wizard
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,104
This is not so easy. I think you have two options to do that
(1) You define a session template with two different sessions, one for pre-market or night session, the other one for the day session. OnBarUpdate would then run through all the bars, and when the defined pre-market session starts, add up volume and at session-end affect this to a variable.
(2) If you do not want to use two session templates, you would need two variables of type TimeSpan to define begin and end of your pre-market session, relative to the session-end of the main session.
You may have a look at the pivot indicators. These also run through highs and lows of a session and then store a value, albeit they only do this for a single day and not for five.
SARdynamite
French friendly !
Sadly, ich spreche nicht deutsche. ;o)
Actually I wanted to compare the pre-market (market profile) total volume to the average pre-market volume of the past week (last 5 days).
I could also compare the
ADR to the 5 latest ADR or the
Initial Balance range.
Anyway nevermind me cause I just realised it could be done using DayOfWeek only.
Thanks nonetheless.
July 13th, 2010, 01:27 PM
Belgium
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110
Hello mate,
I coded it just right now.
I did not check it yet but I'm pretty sure it should be valid.
I'm posting it for others because it might be reworked for other purposes
This one is the one week rolling average of the pre-market volume of European futures (8h-9h)
Get volIBavgWeek and declare all DataSeries
Code
if (DayOfWeek.Monday)
{
if (Bars.FirstBarOfSession)
{
volIBavgWeek.Set(volIBmonday[1]+volIBtuesday[0]+volIBwednesday[0]+volIBthursday[0]+volIBfriday[0]);
volIBmonday[1].Set(Volume[0]);
}
else
{
volIBavgWeek.Set(volIBavgWeek[1]);
if (ToTime(Time[0])<=90000) volIBmonday.Set(volIB[1]+Volume[0]);
else volIBmonday.Set(volIBmonday[1]);
}
volIBtuesday.Set(volIBtuesday[1]);
volIBwednesday.Set(volIBwednesday[1]);
volIBthursday.Set(volIBthursday[1]);
volIBfriday.Set(volIBfriday[1]);
}
else if (DayOfWeek.Tuesday)
{
if (Bars.FirstBarOfSession)
{
volIBavgWeek.Set(volIBmonday[0]+volIBtuesday[1]+volIBwednesday[0]+volIBthursday[0]+volIBfriday[0]);
volIBtuesday[1].Set(Volume[0]);
}
else
{
volIBavgWeek.Set(volIBavgWeek[1]);
if (ToTime(Time[0])<=90000) volIBtuesday.Set(volIB[1]+Volume[0]);
else volIBtuesday.Set(volIBtuesday[1]);
}
volIBmonday.Set(volIBmonday[1]);
volIBwednesday.Set(volIBwednesday[1]);
volIBthursday.Set(volIBthursday[1]);
volIBfriday.Set(volIBfriday[1]);
}
else if (DayOfWeek.Wednesday)
{
if (Bars.FirstBarOfSession)
{
volIBavgWeek.Set(volIBmonday[0]+volIBtuesday[0]+volIBwednesday[1]+volIBthursday[0]+volIBfriday[0]);
volIBwednesday[1].Set(Volume[0]);
}
else
{
volIBavgWeek.Set(volIBavgWeek[1]);
if (ToTime(Time[0])<=90000) volIBwednesday.Set(volIB[1]+Volume[0]);
else volIBwednesday.Set(volIBwednesday[1]);
}
volIBmonday.Set(volIBmonday[1]);
volIBtuesday.Set(volIBtuesday[1]);
volIBthursday.Set(volIBthursday[1]);
volIBfriday.Set(volIBfriday[1]);
}
else if (DayOfWeek.Thursday)
{
if (Bars.FirstBarOfSession)
{
volIBavgWeek.Set(volIBmonday[0]+volIBtuesday[0]+volIBwednesday[0]+volIBthursday[1]+volIBfriday[0]);
volIBmonday[1].Set(Volume[0]);
}
else
{
volIBavgWeek.Set(volIBavgWeek[1]);
if (ToTime(Time[0])<=90000) volIBthursday.Set(volIB[1]+Volume[0]);
else volIBthursday.Set(volIBthursday[1]);
}
volIBmonday.Set(volIBmonday[1]);
volIBtuesday.Set(volIBtuesday[1]);
volIBwednesday.Set(volIBwednesday[1]);
volIBfriday.Set(volIBfriday[1]);
}
else if (DayOfWeek.Friday)
{
if (Bars.FirstBarOfSession)
{
volIBavgWeek.Set(volIBmonday[0]+volIBtuesday[0]+volIBwednesday[0]+volIBthursday[0]+volIBfriday[1]);
volIBfriday[1].Set(Volume[0]);
}
else
{
volIBavgWeek.Set(volIBavgWeek[1]);
if (ToTime(Time[0])<=90000) volIBfriday.Set(volIB[1]+Volume[0]);
else volIBfriday.Set(volIBfriday[1]);
}
volIBmonday.Set(volIBmonday[1]);
volIBtuesday.Set(volIBtuesday[1]);
volIBwednesday.Set(volIBwednesday[1]);
volIBthursday.Set(volIBthursday[1]);
}
July 13th, 2010, 02:49 PM
Belgium
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110
sorry, the last code had some fills missing
here is an update with IB range and volume rolling weekly averages
the code is more dense and should work on ticks/volume/range charts too (precision = almost accurate, depending if the last candle is close to 9 o'clock) as long as the opening hour of the globex session is correctly set in the Session Manager
this is just a concept and it could be use for anything. i.e. rolling ADR , rolling whatever
this could be adaptated for US markets of course
get :
- volIBavgWeek
- rangeIBavgWeek
Code
if (Bars.FirstBarOfSession)
{
volIB.Set(Volume[0]);
IBhigh.Set(High[0]);
IBlow.Ser(Low[0]);
volIBavgWeek.Set(volIBmonday[0]+volIBtuesday[0]+volIBwednesday[0]+volIBthursday[0]+volIBfriday[0]);
rangeIBavgWeek.Set((rangeIBmonday[0]+rangeIBtuesday[0]+rangeIBwednesday[0]+rangeIBthursday[0]+rangeIBfriday[0])/5);
}
else
{
if (ToTime(Time[0])<=90000)
{
volIB.Set(volIB[1]+Volume[0]);
IBhigh.Set(Math.Max(IBhigh,High[0]));
IBlow.Set(Math.Min(IBlow,Low[0]));
}
else
{
volIB.Set(volIB[1]);
IBhigh.Set(IBhigh[1]);
IBlow.Set(IBlow[1]);
}
volIBavgWeek.Set(volIBavgWeek[1]);
rangeIBavgWeek.Set(rangeIBavgWeek[1]);
}
if (DayOfWeek.Monday)
{
if (Bars.FirstBarOfSession)
{
volIBmonday.Set(volIBmonday[1]);
volIBtuesday.Set(volIBtuesday[1]);
volIBwednesday.Set(volIBwednesday[1]);
volIBthursday.Set(volIBthursday[1]);
volIBfriday.Set(volIB[1]);
rangeIBmonday.Set(rangeIBmonday[1]);
rangeIBtuesday.Set(rangeIBtuesday[1]);
rangeIBwednesday.Set(rangeIBwednesday[1]);
rangeIBthursday.Set(rangeIBthursday[1]);
rangeIBfriday.Set(rangeIB[1]);
}
else
{
volIBmonday.Set(volIBmonday[1]);
volIBtuesday.Set(volIBtuesday[1]);
volIBwednesday.Set(volIBwednesday[1]);
volIBthursday.Set(volIBthursday[1]);
volIBfriday.Set(volIBfriday[1]);
rangeIBmonday.Set(rangeIBmonday[1]);
rangeIBtuesday.Set(rangeIBtuesday[1]);
rangeIBwednesday.Set(rangeIBwednesday[1]);
rangeIBthursday.Set(rangeIBthursday[1]);
rangeIBfriday.Set(rangeIBfriday[1]);
}
}
else if (DayOfWeek.Tuesday)
{
if (Bars.FirstBarOfSession)
{
volIBmonday.Set(volIB[1]);
volIBtuesday.Set(volIBtuesday[1]);
volIBwednesday.Set(volIBwednesday[1]);
volIBthursday.Set(volIBthursday[1]);
volIBfriday.Set(volIBfriday[1]);
rangeIBmonday.Set(rangeIB[1]);
rangeIBtuesday.Set(rangeIBtuesday[1]);
rangeIBwednesday.Set(rangeIBwednesday[1]);
rangeIBthursday.Set(rangeIBthursday[1]);
rangeIBfriday.Set(rangeIBfriday[1]);
}
else
{
volIBmonday.Set(volIBmonday[1]);
volIBtuesday.Set(volIBtuesday[1]);
volIBwednesday.Set(volIBwednesday[1]);
volIBthursday.Set(volIBthursday[1]);
volIBfriday.Set(volIBfriday[1]);
rangeIBmonday.Set(rangeIBmonday[1]);
rangeIBtuesday.Set(rangeIBtuesday[1]);
rangeIBwednesday.Set(rangeIBwednesday[1]);
rangeIBthursday.Set(rangeIBthursday[1]);
rangeIBfriday.Set(rangeIBfriday[1]);
}
}
else if (DayOfWeek.Wednesday)
{
if (Bars.FirstBarOfSession)
{
volIBmonday.Set(volIBmonday[1]);
volIBtuesday.Set(volIB[1]);
volIBwednesday.Set(volIBwednesday[1]);
volIBthursday.Set(volIBthursday[1]);
volIBfriday.Set(volIBfriday[1]);
rangeIBmonday.Set(rangeIBmonday[1]);
rangeIBtuesday.Set(rangeIB[1]);
rangeIBwednesday.Set(rangeIBwednesday[1]);
rangeIBthursday.Set(rangeIBthursday[1]);
rangeIBfriday.Set(rangeIBfriday[1]);
}
else
{
volIBmonday.Set(volIBmonday[1]);
volIBtuesday.Set(volIBtuesday[1]);
volIBwednesday.Set(volIBwednesday[1]);
volIBthursday.Set(volIBthursday[1]);
volIBfriday.Set(volIBfriday[1]);
rangeIBmonday.Set(rangeIBmonday[1]);
rangeIBtuesday.Set(rangeIBtuesday[1]);
rangeIBwednesday.Set(rangeIBwednesday[1]);
rangeIBthursday.Set(rangeIBthursday[1]);
rangeIBfriday.Set(rangeIBfriday[1]);
}
}
else if (DayOfWeek.Thursday)
{
if (Bars.FirstBarOfSession)
{
volIBmonday.Set(volIBmonday[1]);
volIBtuesday.Set(volIBtuesday[1]);
volIBwednesday.Set(volIB[1]);
volIBthursday.Set(volIBthursday[1]);
volIBfriday.Set(volIBfriday[1]);
rangeIBmonday.Set(rangeIBmonday[1]);
rangeIBtuesday.Set(rangeIBtuesday[1]);
rangeIBwednesday.Set(rangeIB[1]);
rangeIBthursday.Set(rangeIBthursday[1]);
rangeIBfriday.Set(rangeIBfriday[1]);
}
else
{
volIBmonday.Set(volIBmonday[1]);
volIBtuesday.Set(volIBtuesday[1]);
volIBwednesday.Set(volIBwednesday[1]);
volIBthursday.Set(volIBthursday[1]);
volIBfriday.Set(volIBfriday[1]);
rangeIBmonday.Set(rangeIBmonday[1]);
rangeIBtuesday.Set(rangeIBtuesday[1]);
rangeIBwednesday.Set(rangeIBwednesday[1]);
rangeIBthursday.Set(rangeIBthursday[1]);
rangeIBfriday.Set(rangeIBfriday[1]);
}
}
else if (DayOfWeek.Friday)
{
if (Bars.FirstBarOfSession)
{
volIBmonday.Set(volIBmonday[1]);
volIBtuesday.Set(volIBtuesday[1]);
volIBwednesday.Set(volIBwednesday[1]);
volIBthursday.Set(volIB[1]);
volIBfriday.Set(volIBfriday[1]);
rangeIBmonday.Set(rangeIBmonday[1]);
rangeIBtuesday.Set(rangeIBtuesday[1]);
rangeIBwednesday.Set(rangeIBwednesday[1]);
rangeIBthursday.Set(rangeIB[1]);
rangeIBfriday.Set(rangeIBfriday[1]);
}
else
{
volIBmonday.Set(volIBmonday[1]);
volIBtuesday.Set(volIBtuesday[1]);
volIBwednesday.Set(volIBwednesday[1]);
volIBthursday.Set(volIBthursday[1]);
volIBfriday.Set(volIBfriday[1]);
rangeIBmonday.Set(rangeIBmonday[1]);
rangeIBtuesday.Set(rangeIBtuesday[1]);
rangeIBwednesday.Set(rangeIBwednesday[1]);
rangeIBthursday.Set(rangeIBthursday[1]);
rangeIBfriday.Set(rangeIBfriday[1]);
}
}
July 13th, 2010, 05:15 PM
Belgium
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110
the problem with this simple code is that if someday the market unusually close for whatever reason, il will make it set false values !!
July 13th, 2010, 05:32 PM
Berlin, Europe
Market Wizard
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,104
Also did you take into account that Monday's session starts on Sunday evening?
Let me know one thing: What do you need pre-market volume for. Or what would you conclude, if pre-market volume was unusually high? Would you expect a trending day?
SARdynamite
the problem with this simple code is that if someday the market unusually close for whatever reason, il will make it set false values !!
July 13th, 2010, 05:35 PM
Belgium
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110
It could be a hint for a trading day.
Monday's session beginning sunday's evening ? Do you talk about forex ?
I coded it initially for european indices longing from 8h to 22h GMT+1 time from monday to friday.
Last Updated on July 13, 2010