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)
Broker: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Trading: ES, CL, EUR/USD, TF
Posts: 173 since Aug 2009
Thanks Given: 105
Thanks Received: 61
Hello,
I am currently working on a strategy that allows me to enter the trade manually in NinjaTrader and then apply a Strategy to it with stops and targets.
It seems as though I am having a hard time accessing the Account Position direction and AvgPrice from the Strategy.
When I Sync Account Position = True, it simply Flattens the position that I am already in. I don't want it to flatten, I want it to show up as a Position somewhere.
Maybe I can do it as an Unmanaged = True and just program it in a way that I handle everything, so no OCO needed
I was hoping to access something that said what my position is OnStartUp() and Cancel any open orders, then apply my stop using SubmitOrder(.....) and then tighten it accordingly.
I kind of want my entries to be manual, and the stops to be from the strategy. But I don't want to use ATM since I need to have control of how it is tightened based on the "Swing" indicator.
So I don't think there is anything supported and I am actually somewhat surprised since it seems like I have heard of people complaining that they don't want the Sync Account Position to "Flatten" their position, but simply add some trade management to an already existing position.
So, thinking maybe a workaround to this is possible if I can at least access the Object for Account Position that is not from the Strategy but from the manual position.
thanks
Spencer
Can you help answer these questions from other members on NexusFi?
You should try to use an indicator, and not a strategy, which has more "controls".
Take a look at NinjaTrader.Cbi.Globals.Accounts and its methods, that will allow you to control your orders yourself, without the strategy (safe) controls.
Highly unsupported, of course, but it works.
Broker: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Trading: ES, CL, EUR/USD, TF
Posts: 173 since Aug 2009
Thanks Given: 105
Thanks Received: 61
Hi Sam
so Indicators have more things available through its inheritance?
that is interesting. I will check it out.
But do place trades you would need a strategy right? So, I guess you would use the indicator to check for the account position through the strategy?
Broker: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Trading: ES, CL, EUR/USD, TF
Posts: 173 since Aug 2009
Thanks Given: 105
Thanks Received: 61
Hi MooreTech
thanks I will look into it. It seems like most of those files are located in C:\Program Files (x86)\NinjaTrader 7\bin
I tried to reference things from there like NTDirect.dll or NinjaTrader.Client.dll
but at least with the Client, it gave a bunch of problems to Ninja things when compiled. I think this is because this can mess up the "arrow direction" of the dependencies by probably creating a "dependency loop"
if you could give me an example of NTDirect.dll that would be great. thanks
Spencer
In fact all can be done in an indicator. What's I've done is adding some extra buttons and fields to the "ChartTrader", so it's then possible to get the account name, then create an order.
After submitting "Account" order from "Account" object (let's say limit order) - how to get notification when that order gets fully or partially filled (limit order - not the market one)?
I tried looking at internal methods in the Account.cs file of NinjaTrader:
public event ExecutionUpdateEventHandler Execution;
public event OrderStatusEventHandler OrderStatus;
public event PositionUpdateEventHandler PositionUpdate;
Should I create inherited class from Account? Will then I be able to get notified when some event has occured (like Position has been updated, or Order has changed its status)?
Any sample code/idea would be very appreciated!
Broker: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Trading: ES, CL, EUR/USD, TF
Posts: 173 since Aug 2009
Thanks Given: 105
Thanks Received: 61
ninjauser
Great Thread!
I have a follow up question.
After submitting "Account" order from "Account" object (let's say limit order) - how to get notification when that order gets fully or partially filled (limit order - not the market one)?
I tried looking at internal methods in the Account.cs file of NinjaTrader:
public event ExecutionUpdateEventHandler Execution;
public event OrderStatusEventHandler OrderStatus;
public event PositionUpdateEventHandler PositionUpdate;
Should I create inherited class from Account? Will then I be able to get notified when some event has occured (like Position has been updated, or Order has changed its status)?
Any sample code/idea would be very appreciated!
Hello
so I might be interpreting you incorrect, but it sounds like you want to know the status of the order : i.e. PartiallyFilled, or Filled, etc..
From my experience, this is all handled via IOrders
private IOrder entryOrder = null;
private IOrder stopOrder = null;
private IOrder targetOrder = null;
protected override void OnOrderUpdate(IOrder order)
{
if (entryOrder != null && entryOrder == order)
{
if (order.OrderState == OrderState.Filled)
{
// do this
}
if (order.OrderState == OrderState.PartiallyFilled)
{
// do this
}
}
}