NexusFi: Find Your Edge


Home Menu

 





Manual entry, automated exit (Ninja Trader or other)?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one peaceland with 7 posts (0 thanks)
    2. looks_two MWinfrey with 6 posts (11 thanks)
    3. looks_3 monpere with 5 posts (12 thanks)
    4. looks_4 Xav1029 with 5 posts (6 thanks)
      Best Posters
    1. looks_one monpere with 2.4 thanks per post
    2. looks_two ThatManFromTexas with 2 thanks per post
    3. looks_3 MWinfrey with 1.8 thanks per post
    4. looks_4 Xav1029 with 1.2 thanks per post
    1. trending_up 17,294 views
    2. thumb_up 35 thanks given
    3. group 13 followers
    1. forum 35 posts
    2. attach_file 2 attachments




 
Search this Thread

Manual entry, automated exit (Ninja Trader or other)?

  #11 (permalink)
 
MWinfrey's Avatar
 MWinfrey 
Lubbock TX
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Stage 5 Trading
Trading: CL
Posts: 1,878 since Jul 2009
Thanks Given: 1,450
Thanks Received: 3,335


monpere View Post
I do this as well. I can open a position normally with Chart Trader, and exit with a strategy by pressing a button, or change the custom trade management while the trade is active by pressing another button, i.e. switch from a conservative trail management to an aggressive trail management, to a ratcheting trail management, and back again, etc. After you open a position normally with Chart Trader, you can get the open position data using:

NinjaTrader.Cbi.Globals.Accounts[i].Positions[k].MarketPosition
NinjaTrader.Cbi.Globals.Accounts[i].Positions[k].Quantity
NinjaTrader.Cbi.Globals.Accounts[i].Positions[k].AvgPrice

and other pertinent info about the position like Account, Instrument, etc..

Now that you have the open position data, you can write your exit code as you wish using that info, if needed.

That's awsome...that's exactly what I need to do.

Thank you

Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
NexusFi Journal Challenge - May 2024
Feedback and Announcements
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
MC PL editor upgrade
MultiCharts
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
35 thanks
Tao te Trade: way of the WLD
25 thanks
Bigger Wins or Fewer Losses?
24 thanks
GFIs1 1 DAX trade per day journal
21 thanks
  #12 (permalink)
 
Xav1029's Avatar
 Xav1029 
Tampa, FL
 
Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker: Mirus Futures/Zen-Fire
Trading: 6E, M6E, 6J
Posts: 1,375 since Dec 2011
Thanks Given: 1,452
Thanks Received: 3,377


monpere View Post
I do this as well. I can open a position normally with Chart Trader, and exit with a strategy by pressing a button, or change the custom trade management while the trade is active by pressing another button, i.e. switch from a conservative trail management to an aggressive trail management, to a ratcheting trail management, and back again, etc. After you open a position normally with Chart Trader, you can get the open position data using:

NinjaTrader.Cbi.Globals.Accounts[i].Positions[k].MarketPosition
NinjaTrader.Cbi.Globals.Accounts[i].Positions[k].Quantity
NinjaTrader.Cbi.Globals.Accounts[i].Positions[k].AvgPrice

and other pertinent info about the position like Account, Instrument, etc..

Now that you have the open position data, you can write your exit code as you wish using that info, if needed.

Thanks for the tip. Are Accounts[] and Position[] arrays? @vvhg was trying to access this info as well.

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #13 (permalink)
peaceland
Lomita, CA/USA
 
Posts: 8 since Sep 2012
Thanks Given: 0
Thanks Received: 0


A little new to all of this, so trying to make sense of everything. I sincerely appreciate all of the responses. Most of them, I do not yet know how to work with. Very much appreciate that "something is possible". I did receive an email from Ninja Trader that they appreciate my desire and have passed it along for consideration for future updates.

What is "ChartTrader"? I do have not seen it, and cannot find it. Is this in NT?

BTW, I have demo fx account w/MB Trading, and demo NT. Hoping to be able to paper trade both of them somehow.

You folks are amazing. Elite, here we come... ;-)

Reply With Quote
  #14 (permalink)
 
monpere's Avatar
 monpere 
Bala, PA, USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Mirus, IB
Trading: SPY, Oil, Euro
Posts: 1,854 since Jul 2010
Thanks Given: 300
Thanks Received: 3,371


Xav1029 View Post
Thanks for the tip. Are Accounts[] and Position[] arrays? @vvhg was trying to access this info as well.

They are arrays. Use Intellisence to see what data is available. In the NT code editor, type 'NinjaTrader.Cbi.Globals.Accounts[0].Positions[0].' (No quotes). Once you type the '.' (dot) and stop, the Intellisence will pop up a scrollable list with brief explanations, for available fields, methods, events, etc for the object preceding the '.' This works for all sorts of objects in NT. That is the way I have discovered most of the non-standard code that I use.

Reply With Quote
Thanked by:
  #15 (permalink)
peaceland
Lomita, CA/USA
 
Posts: 8 since Sep 2012
Thanks Given: 0
Thanks Received: 0

So, I guess this is the question at this point. I need a reliable way to get in the market, and stay there for extended periods of time (hours, weeks, even months at a time), and have a reliable computer system that is not going to go down or reboot or something weird, and actually execute the exit strategy.

Is there a place (broker) that can do this?
How much would it cost me to build a "system" to do this?
Is there someone on this forum that does this kind of thing?

Very much appreciate being here, and would love to be able to just code it up myself, but my programming skills are far from ready at this point.

My other concern is that it appears MB Trading logs me off my demo account. My guess is a strategy is useless if you are continually being logged off. How do we maintain access to the account and make sure we are executing "automated" trades?

Reply With Quote
  #16 (permalink)
 
Xav1029's Avatar
 Xav1029 
Tampa, FL
 
Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker: Mirus Futures/Zen-Fire
Trading: 6E, M6E, 6J
Posts: 1,375 since Dec 2011
Thanks Given: 1,452
Thanks Received: 3,377


peaceland View Post
So, I guess this is the question at this point. I need a reliable way to get in the market, and stay there for extended periods of time (hours, weeks, even months at a time), and have a reliable computer system that is not going to go down or reboot or something weird, and actually execute the exit strategy.

Is there a place (broker) that can do this?
How much would it cost me to build a "system" to do this?
Is there someone on this forum that does this kind of thing?

Very much appreciate being here, and would love to be able to just code it up myself, but my programming skills are far from ready at this point.

My other concern is that it appears MB Trading logs me off my demo account. My guess is a strategy is useless if you are continually being logged off. How do we maintain access to the account and make sure we are executing "automated" trades?

Are you planning on swing trading? Does MB Trading log you off even if you have a position open? Depending on how the "exit strategy" is coded, you might not need to worry about short term disconnects. If it is an actual strategy, then yes this would be a problem. If it is ran through an indicator that accesses your current position, then getting disconnected would not cause a problem. Really depends on how it is coded.

Visit my NexusFi Trade Journal Reply With Quote
  #17 (permalink)
peaceland
Lomita, CA/USA
 
Posts: 8 since Sep 2012
Thanks Given: 0
Thanks Received: 0


Xav1029 View Post
Are you planning on swing trading? Does MB Trading log you off even if you have a position open? Depending on how the "exit strategy" is coded, you might not need to worry about short term disconnects. If it is an actual strategy, then yes this would be a problem. If it is ran through an indicator that accesses your current position, then getting disconnected would not cause a problem. Really depends on how it is coded.

MB shuts down every day for maintenance. So I would have to log on again. There is no way to "stay connected."

My system is pretty simple get in, follow the trend (stay in), when price crosses "x" EMA or SMA, get out. So, I basically just need a way to insure that once I have committed, I have a way out whether I am there or not at the helm. No, I don't think stop loss or TSL is the way to go. It will definitely get hit, that way.

I am wondering if there are services available who will babysit your trades for you in Forex. I know it sounds "wimpy", but if I am new to this and can't seem to figure this out, I am sure there are a lot of other people just as frustrated as I am.

If I had a staff to stay up all night and watch trades for me...

Do you guys on the West Coast stay up from midnight to 9am every morning so you can watch your trades? I'd love to see how everyone here solves that problem. Or do you just move to London or East Coast?

Reply With Quote
  #18 (permalink)
 
Xav1029's Avatar
 Xav1029 
Tampa, FL
 
Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker: Mirus Futures/Zen-Fire
Trading: 6E, M6E, 6J
Posts: 1,375 since Dec 2011
Thanks Given: 1,452
Thanks Received: 3,377


peaceland View Post
MB shuts down every day for maintenance. So I would have to log on again. There is no way to "stay connected."

My system is pretty simple get in, follow the trend (stay in), when price crosses "x" EMA or SMA, get out. So, I basically just need a way to insure that once I have committed, I have a way out whether I am there or not at the helm. No, I don't think stop loss or TSL is the way to go. It will definitely get hit, that way.

I am wondering if there are services available who will babysit your trades for you in Forex. I know it sounds "wimpy", but if I am new to this and can't seem to figure this out, I am sure there are a lot of other people just as frustrated as I am.

If I had a staff to stay up all night and watch trades for me...

Do you guys on the West Coast stay up from midnight to 9am every morning so you can watch your trades? I'd love to see how everyone here solves that problem. Or do you just move to London or East Coast?

Well if MB Trading shuts down, you couldn't monitor the trades regardless. Have you maybe looked at other brokers that do not shut down if you are so worried about it? I could not have a broker that crossed my mind more than once a month. How long do they shut down for?

Visit my NexusFi Trade Journal Reply With Quote
  #19 (permalink)
 
monpere's Avatar
 monpere 
Bala, PA, USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Mirus, IB
Trading: SPY, Oil, Euro
Posts: 1,854 since Jul 2010
Thanks Given: 300
Thanks Received: 3,371


peaceland View Post
So, I guess this is the question at this point. I need a reliable way to get in the market, and stay there for extended periods of time (hours, weeks, even months at a time), and have a reliable computer system that is not going to go down or reboot or something weird, and actually execute the exit strategy.

Is there a place (broker) that can do this?
How much would it cost me to build a "system" to do this?
Is there someone on this forum that does this kind of thing?

Very much appreciate being here, and would love to be able to just code it up myself, but my programming skills are far from ready at this point.

My other concern is that it appears MB Trading logs me off my demo account. My guess is a strategy is useless if you are continually being logged off. How do we maintain access to the account and make sure we are executing "automated" trades?

There are all sorts of issues with MB Trading if your want to do anything innovative. Their systems and infrastructure are just antiquated. They have to shutdown after market everyday for maintenance, their responses to order executions and modifications are slow, they have regular unscheduled outages, the market will go through your orders by several ticks and you will not get fills. The only redeeming things I found were are that you can trade micro lots, and they pay you when you provide liquidity with limit orders. That's been my experience with them.

You can do most the things you want with various other brokers. I personally use Interactive Brokers and Mirus Futures to reliably do some of these things.

Reply With Quote
  #20 (permalink)
 
MWinfrey's Avatar
 MWinfrey 
Lubbock TX
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Stage 5 Trading
Trading: CL
Posts: 1,878 since Jul 2009
Thanks Given: 1,450
Thanks Received: 3,335



monpere View Post
I do this as well. I can open a position normally with Chart Trader, and exit with a strategy by pressing a button, or change the custom trade management while the trade is active by pressing another button, i.e. switch from a conservative trail management to an aggressive trail management, to a ratcheting trail management, and back again, etc. After you open a position normally with Chart Trader, you can get the open position data using:

NinjaTrader.Cbi.Globals.Accounts[i].Positions[k].MarketPosition
NinjaTrader.Cbi.Globals.Accounts[i].Positions[k].Quantity
NinjaTrader.Cbi.Globals.Accounts[i].Positions[k].AvgPrice

and other pertinent info about the position like Account, Instrument, etc..

Now that you have the open position data, you can write your exit code as you wish using that info, if needed.

Ok...for me this is uncharted territory. I have the buttons working and attempting to add the code that will manage the trade. However, I'm having issues.

 
Code
if (NinjaTrader.Cbi.Globals.Accounts[0].Positions[0].MarketPosition == MarketPosition.Long)
... do something
However, I get an error saying "You are accessing an index with a value that is invalid since its out of range." Which doesn't surprise me. However, how do I set Accounts[0] and Positions[0] to something meaningful so I don't get that error? I had to swallow a bit of pride just to ask this question because I should be able to figure this out without asking. But, not getting anywhere.

Thanks,
Mike

Reply With Quote




Last Updated on March 1, 2020


© 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