Strategy Position and Account Position - NinjaTrader | futures io social day trading
futures io futures trading


Strategy Position and Account Position
Updated: Views / Replies:4,034 / 15
Created: by spinnybobo Attachments:1

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
 1  
 
Thread Tools Search this Thread
 

Strategy Position and Account Position

  #1 (permalink)
Elite Member
Crete, IL/USA
 
Futures Experience: Intermediate
Platform: NinjaTrader, Mt4
Broker/Data: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Favorite Futures: ES, CL, EUR/USD, TF
 
spinnybobo's Avatar
 
Posts: 171 since Aug 2009
Thanks: 99 given, 48 received

Strategy Position and Account Position

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

Reply With Quote
 
  #2 (permalink)
Administrator: Retired Backtester
 Vendor: speedytradingservers.com 
Rennes France
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB/Kinetick
Favorite Futures: Futures
 
sam028's Avatar
 
Posts: 3,366 since Jun 2009
Thanks: 3,573 given, 3,982 received

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.

Success requires no deodorant! (Sun Tzu)
Reply With Quote
The following user says Thank You to sam028 for this post:
 
  #3 (permalink)
Elite Member
Orlando, Florida
 
Futures Experience: Advanced
Platform: NinjaTrader, TradeStation, MultiCharts, eSignal, MetaTrader
Favorite Futures: ES
 
Posts: 56 since Aug 2010
Thanks: 3 given, 66 received


You may want to have a look at the Documentation for the NTDirect.DLL file. See the section on DLL functions at the link below:

NinjaTrader Version 7

If you have any questions about our products or services please contact me via Private Message
Reply With Quote
The following user says Thank You to MooreTech for this post:
 
  #4 (permalink)
Elite Member
Crete, IL/USA
 
Futures Experience: Intermediate
Platform: NinjaTrader, Mt4
Broker/Data: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Favorite Futures: ES, CL, EUR/USD, TF
 
spinnybobo's Avatar
 
Posts: 171 since Aug 2009
Thanks: 99 given, 48 received


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

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?

thanks
Spencer

Reply With Quote
 
  #5 (permalink)
Elite Member
Crete, IL/USA
 
Futures Experience: Intermediate
Platform: NinjaTrader, Mt4
Broker/Data: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Favorite Futures: ES, CL, EUR/USD, TF
 
spinnybobo's Avatar
 
Posts: 171 since Aug 2009
Thanks: 99 given, 48 received


MooreTech View Post
You may want to have a look at the Documentation for the NTDirect.DLL file. See the section on DLL functions at the link below:

NinjaTrader Version 7

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

Reply With Quote
 
  #6 (permalink)
Elite Member
Crete, IL/USA
 
Futures Experience: Intermediate
Platform: NinjaTrader, Mt4
Broker/Data: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Favorite Futures: ES, CL, EUR/USD, TF
 
spinnybobo's Avatar
 
Posts: 171 since Aug 2009
Thanks: 99 given, 48 received


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

Hey Sam.
can you give me an example of your using statement and the object you would create?
thanks
Spencer

Reply With Quote
 
  #7 (permalink)
Administrator: Retired Backtester
 Vendor: speedytradingservers.com 
Rennes France
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB/Kinetick
Favorite Futures: Futures
 
sam028's Avatar
 
Posts: 3,366 since Jun 2009
Thanks: 3,573 given, 3,982 received

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.

See the code to create a buy limit order :
 
Code
                            
    string accName ChartControl.Controls["pnlChartTrader"].Controls["ctrChartTraderControl"].Controls["cboAccount"].Text;

    
int quantity = (int)((NumericUpDown)ChartControl.Controls["pnlChartTrader"].Controls["ctrChartTraderControl"].Controls["nudQuantity"]).Value;
    if (
quantity 1)
        return;            
    
Account a null;    
    for (
int i=0;i<=NinjaTrader.Cbi.Globals.Accounts.Count-1;i++)
    {
        if (
NinjaTrader.Cbi.Globals.Accounts[i].Name == accName)
        {
            
NinjaTrader.Cbi.Globals.Accounts[i];
        }
    }            
    if (
!= null)
    {
        
Order o a.CreateOrder(Instrument,OrderAction.Buy,OrderType.Limit,TimeInForce.Day,quantity,(double)nudBuyLmtPr.Value,0,"","Buy");            
        
o.Submit();                
    }


Success requires no deodorant! (Sun Tzu)
Reply With Quote
The following 3 users say Thank You to sam028 for this post:
 
  #8 (permalink)
Elite Member
Crete, IL/USA
 
Futures Experience: Intermediate
Platform: NinjaTrader, Mt4
Broker/Data: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Favorite Futures: ES, CL, EUR/USD, TF
 
spinnybobo's Avatar
 
Posts: 171 since Aug 2009
Thanks: 99 given, 48 received


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

See the code to create a buy limit order :
 
Code
                            
    string accName ChartControl.Controls["pnlChartTrader"].Controls["ctrChartTraderControl"].Controls["cboAccount"].Text;

    
int quantity = (int)((NumericUpDown)ChartControl.Controls["pnlChartTrader"].Controls["ctrChartTraderControl"].Controls["nudQuantity"]).Value;
    if (
quantity 1)
        return;            
    
Account a null;    
    for (
int i=0;i<=NinjaTrader.Cbi.Globals.Accounts.Count-1;i++)
    {
        if (
NinjaTrader.Cbi.Globals.Accounts[i].Name == accName)
        {
            
NinjaTrader.Cbi.Globals.Accounts[i];
        }
    }            
    if (
!= null)
    {
        
Order o a.CreateOrder(Instrument,OrderAction.Buy,OrderType.Limit,TimeInForce.Day,quantity,(double)nudBuyLmtPr.Value,0,"","Buy");            
        
o.Submit();                
    }


thank you Sam. Your always so helpful. :-) I will give this a try

Reply With Quote
 
  #9 (permalink)
Elite Member
Houston Texas
 
Futures Experience: Advanced
Platform: NinjaTrader, MetaTrader, TradeStation
Favorite Futures: EUR/USD
 
Posts: 4 since Jun 2013
Thanks: 0 given, 0 received

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!

Reply With Quote
 
  #10 (permalink)
Elite Member
Crete, IL/USA
 
Futures Experience: Intermediate
Platform: NinjaTrader, Mt4
Broker/Data: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Favorite Futures: ES, CL, EUR/USD, TF
 
spinnybobo's Avatar
 
Posts: 171 since Aug 2009
Thanks: 99 given, 48 received



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

 
Code
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
           }

     }

}
hope this is what you mean

Spencer

Reply With Quote

Reply



futures io > > > > Strategy Position and Account Position

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
Call ATM Strategy on an automated strategy to control position jsengxx NinjaTrader Programming 7 May 31st, 2016 05:51 PM
Contract Rollover: Adopt Real World Position and manage per previous position entry RM99 EasyLanguage Programming 3 May 30th, 2012 07:55 AM
Account balance moving up/down after closing position??? Lord Sidious Reviews of Brokers and Data Feeds 5 May 29th, 2012 06:14 PM
Drawdown & Position Sizing Account Allocation dgresens Psychology and Money Management 7 February 10th, 2012 12:07 PM
Account position: How to differentiate positions arjfca The Elite Circle 5 February 5th, 2011 03:27 PM


All times are GMT -4. The time now is 05:56 PM.

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-15 in 0.14 seconds with 20 queries on phoenix via your IP 54.145.16.43