NexusFi: Find Your Edge


Home Menu

 





if TODAY (only)


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one SARdynamite with 13 posts (0 thanks)
    2. looks_two cory with 4 posts (1 thanks)
    3. looks_3 MXASJ with 3 posts (0 thanks)
    4. looks_4 Fat Tails with 2 posts (0 thanks)
    1. trending_up 6,777 views
    2. thumb_up 5 thanks given
    3. group 5 followers
    1. forum 23 posts
    2. attach_file 1 attachments




 
Search this Thread

if TODAY (only)

  #11 (permalink)
 
aslan's Avatar
 aslan 
Madison, WI
 
Experience: Advanced
Platform: ALT
Trading: ES
Posts: 625 since Jan 2010
Thanks Given: 356
Thanks Received: 1,127

Historical is really used to discern between historical quotes and live quotes, not really for "today".

If you are checking bar data, you do the following:

if (Time[0].Date == DateTime.Now.Date) ....

Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Better Renko Gaps
The Elite Circle
ZombieSqueeze
Platforms and Indicators
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
27 thanks
Diary of a simple price action trader
26 thanks
Tao te Trade: way of the WLD
23 thanks
My NQ Trading Journal
14 thanks
HumbleTraders next chapter
9 thanks
  #12 (permalink)
 SARdynamite 
Belgium
 
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110

Thanks for the explanations. It now works like a charm.

Is there a way to code just the same but for YESTERDAY or say DAY-2 (only) ?

Started this thread Reply With Quote
  #13 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
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,102


for yesterday you can use:

 
Code
                            
if (Time[0].Date == DateTime.Now.AddDays(-1).Date) ... 

-> but you might run into trouble with weekends and holidays



SARdynamite View Post
Thanks for the explanations. It now works like a charm.

Is there a way to code just the same but for YESTERDAY or say DAY-2 (only) ?


Reply With Quote
  #14 (permalink)
 SARdynamite 
Belgium
 
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110

Thanks.

Yeah the goal is to avoid daybreaks to move back in time only for real trading sessions.

I did not look at your sessionPivots indicator yet (actually, just a bit and it is very complete) but it seems to me that cory with his "ADR_cory" indicator already programmed that.

Now, I'll have to dig into it enough because it's not sweet candy for my brain.

Attached Files
Elite Membership required to download: ADR_Cory.cs
Started this thread Reply With Quote
  #15 (permalink)
 SARdynamite 
Belgium
 
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110

Actually not, it does not seem to exclude day breaks neither.

Started this thread Reply With Quote
  #16 (permalink)
 
shodson's Avatar
 shodson 
OC, California, USA
Quantoholic
 
Experience: Advanced
Platform: IB/TWS, NinjaTrader, ToS
Broker: IB, ToS, Kinetick
Trading: stocks, options, futures, VIX
Posts: 1,976 since Jun 2009
Thanks Given: 533
Thanks Received: 3,709

All of my strats have this

 
Code
private DateTime Now { get { if (Historical) return Time[0]; else return DateTime.Now; } }
So in OnBarUpdate() I just use "Now" and it'll work for backtesting and real-time trading. For example, if I want to only trade between 9:30 am (930) and 1:15 pm (1315)

 
Code
if (ToTime(Now)/100 >= 930 && ToTime(Now)/100 <= 1315)
    trade();
Or, if I do NOT want to trade between 10:15 and 10:45 every Wednesday because of oil inventory reports I would

 
Code
if (ToTime(Now)/100 >= 1015 && ToTime(Now)/100 <= 1045 && Now.DayOfWeek == DayOfWeek.Wednesday)
    dontTrade();

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #17 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090


SARdynamite View Post
Actually not, it does not seem to exclude day breaks neither.

it calculates the days with data only.

Reply With Quote
  #18 (permalink)
 SARdynamite 
Belgium
 
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110

Really ? So you can tell it to examine only 3 or 5 session days back ? (excluding weekends, holidays, misc closed days)

I read on your parameters description that it would include Saturdays and Sundays so I'm a bit lost.

Started this thread Reply With Quote
  #19 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090


SARdynamite View Post
Really ? So you can tell it to examine only 3 or 5 session days back ? (excluding daybreaks)

I read on your parameters description that it would include Saturdays and Sundays so I'm a bit lost.

you read it from a programmer stand point. My comment is for a regular user when they want 5 days back they may not realize there is no data on Sat. and depending on the session time they may not even have data on Sun. Thus 5 days to them could be = 3 days with data.

Reply With Quote
  #20 (permalink)
 SARdynamite 
Belgium
 
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110


Understood.

So could you be able to exclude non data days ? i.e. if it is set to 5, then take the last 5 sessions with data (skipping holidays, weekends, etc)

If you have the code for this by hand easily, I'd be really grateful if you can isolate it and share it. It's not that easy to navigate through someone else's code.

This way I can finish an idea of an overall indicator framing volatility (I have 2-3 ideas to include)

Started this thread Reply With Quote




Last Updated on July 15, 2010


© 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