Timed exit in auto strategy - NinjaTrader Programming | futures io social day trading
futures io futures trading


Timed exit in auto strategy
Updated: Views / Replies:1,414 / 2
Created: by nanobiotech 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
 

Timed exit in auto strategy

  #1 (permalink)
Elite Member
Brisbane, Australia
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Mirus/Zen-Fire
Favorite Futures: CL
 
nanobiotech's Avatar
 
Posts: 670 since Jun 2009
Thanks: 134 given, 428 received

Timed exit in auto strategy

I know you can set the Session begin and end time in Chart properties - is this a reliable way to limit the time an auto strategy runs?

Also, is there a practical way to code this in the strategy? Say to limit the time the strategy runs for 2 hours or a time variable only?

Nano

Reply With Quote
 
  #2 (permalink)
 Vendor: www.probabletrades.com 
OC, California, USA
 
Futures Experience: Advanced
Platform: IB/TWS, NinjaTrader, thinkorswim
Favorite Futures: stocks, options, futures, VIX
 
shodson's Avatar
 
Posts: 1,860 since Jun 2009
Thanks: 480 given, 3,255 received


nanobiotech View Post
I know you can set the Session begin and end time in Chart properties - is this a reliable way to limit the time an auto strategy runs?

Also, is there a practical way to code this in the strategy? Say to limit the time the strategy runs for 2 hours or a time variable only?

Nano

Sure. Here's how the OnBarUpdate() of all of my strats look like

 
Code
                            
protected override void OnBarUpdate()
{
    if (
TimeToTrade)
    {
        if (
InPosition)
            
ManageTrade();
    
        if (!
InPosition)
            
LookForTrade();
    }
    else
    {
        if (
InPosition)
            
FlattenPosition();
    }
}

.........


private 
bool TimeToTrade
{
    
get
    
{
        if (
_tradeTimeBegin == || _tradeTimeEnd == 0)
            return 
true;
        else
        {
            if (
_tradeTimeBegin _tradeTimeEnd)    // sessions that begin previous day and end next day
              
return ToTime(Time[0]) >= _tradeTimeBegin || ToTime(Time[0]) <= _tradeTimeEnd;
            else
              return 
ToTime(Time[0]) >= _tradeTimeBegin && ToTime(Time[0]) <= _tradeTimeEnd;
        }
    }
}    

...............

private 
int _tradeTimeBegin 0// Default setting for TTB
[Description("Beginning trading time")]
[
Category("Parameters")]
public 
int TTB
{
    
get { return _tradeTimeBegin; }
    
set _tradeTimeBegin Math.Max(0value); }
}

private 
int _tradeTimeEnd 0// Default setting for TT
[Description("Ending trading time")]
[
Category("Parameters")]
public 
int TTE
{
    
get { return _tradeTimeEnd; }
    
set _tradeTimeEnd Math.Max(0value); }

So when I run/backtest the strat I set the TTB and TTE to the times I want trading to begin/end, regardless of the session time as defined by Ninja because often you have indicators that rely on previous bars of data that are outside of your trading range.

Reply With Quote
The following 2 users say Thank You to shodson for this post:
 
  #3 (permalink)
Elite Member
Brisbane, Australia
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Mirus/Zen-Fire
Favorite Futures: CL
 
nanobiotech's Avatar
 
Posts: 670 since Jun 2009
Thanks: 134 given, 428 received


Thanks Shodson, I appreciate your help. I'll give this a go.
Nano

Reply With Quote

Reply



futures io > > > > > Timed exit in auto strategy

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Combined auto-entry and manual-exit strategy as a money management device nanobiotech Psychology and Money Management 10 January 31st, 2015 08:51 AM
Strategy Entry/Exit Visualization zeller4 NinjaTrader Programming 6 November 8th, 2012 11:22 AM
Fed Weighed More Stimulus—As Well as an Exit Strategy Quick Summary News and Current Events 0 July 12th, 2011 04:40 PM
FOMC Minutes – Fed Starts Talking Exit Strategy Process, But Not Yet Timing kbit News and Current Events 0 May 18th, 2011 06:18 PM
Stock Market Rally at Risk as Fed Considers Exit Strategy Quick Summary News and Current Events 0 April 3rd, 2011 06:50 PM


All times are GMT -4. The time now is 10:58 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-18 in 0.10 seconds with 19 queries on phoenix via your IP 54.226.113.250