x sessions ago - NinjaTrader Programming | futures io social day trading
futures io futures trading


x sessions ago
Updated: Views / Replies:2,164 / 15
Created: by SARdynamite Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

x sessions ago

  #1 (permalink)
Elite Member
Belgium
 
Futures Experience: Advanced
Platform: SaxoTrader
Broker/Data: SaxoBank
Favorite Futures: ESTX
 
Posts: 290 since Dec 2009
Thanks: 242 given, 109 received

x sessions ago

Hi guys,

Can you direct me on how to write this :

if (5 sessions ago)

Thank you

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,597 received
Forum Reputation: Legendary


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 View Post
Hi guys,

Can you direct me on how to write this :

if (5 sessions ago)

Thank you


Reply With Quote
 
  #4 (permalink)
Elite Member
Belgium
 
Futures Experience: Advanced
Platform: SaxoTrader
Broker/Data: SaxoBank
Favorite Futures: ESTX
 
Posts: 290 since Dec 2009
Thanks: 242 given, 109 received

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.

Reply With Quote
 
  #5 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,597 received
Forum Reputation: Legendary

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


Reply With Quote
 
  #6 (permalink)
Elite Member
Belgium
 
Futures Experience: Advanced
Platform: SaxoTrader
Broker/Data: SaxoBank
Favorite Futures: ESTX
 
Posts: 290 since Dec 2009
Thanks: 242 given, 109 received

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]);
            }

Reply With Quote
The following user says Thank You to SARdynamite for this post:
 
  #7 (permalink)
Elite Member
Belgium
 
Futures Experience: Advanced
Platform: SaxoTrader
Broker/Data: SaxoBank
Favorite Futures: ESTX
 
Posts: 290 since Dec 2009
Thanks: 242 given, 109 received

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]);    
                }
            }


Last edited by SARdynamite; July 13th, 2010 at 06:39 PM.
Reply With Quote
The following user says Thank You to SARdynamite for this post:
 
  #8 (permalink)
Elite Member
Belgium
 
Futures Experience: Advanced
Platform: SaxoTrader
Broker/Data: SaxoBank
Favorite Futures: ESTX
 
Posts: 290 since Dec 2009
Thanks: 242 given, 109 received

the problem with this simple code is that if someday the market unusually close for whatever reason, il will make it set false values !!

Reply With Quote
 
  #9 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,597 received
Forum Reputation: Legendary

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 View Post
the problem with this simple code is that if someday the market unusually close for whatever reason, il will make it set false values !!


Reply With Quote
 
  #10 (permalink)
Elite Member
Belgium
 
Futures Experience: Advanced
Platform: SaxoTrader
Broker/Data: SaxoBank
Favorite Futures: ESTX
 
Posts: 290 since Dec 2009
Thanks: 242 given, 109 received


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.

Reply With Quote

Reply



futures io > > > > > x sessions ago

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Correct Sessions for Your Charts Fat Tails The Elite Circle 59 August 29th, 2017 05:38 AM
background for diffenrt sessions template razorbuzz NinjaTrader 46 May 20th, 2016 02:00 PM
Plot PIVOT POINTS as horizontal lines for trading sessions in MultiCharts virginiatrader The Elite Circle 7 June 22nd, 2013 04:28 PM
HSBC Profit 'Well Ahead' of Year Ago, Bad Debts Fall Quick Summary News and Current Events 0 November 5th, 2010 06:40 AM
Multi-time series strategy in NT using different sessions? zwentz NinjaTrader Programming 1 April 2nd, 2010 08:20 AM


All times are GMT -4. The time now is 07:47 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-11 in 0.14 seconds with 19 queries on phoenix via your IP 54.226.132.197