NexusFi: Find Your Edge


Home Menu

 





Launch sub account strategy in ninjascript


Discussion in NinjaTrader

Updated
    1. trending_up 1,655 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
talka
israel tel aviv
 
Posts: 7 since Jan 2015
Thanks Given: 8
Thanks Received: 1

Hello everyone,
I have this issue where my orders are colliding each other (I need to separate my long entry so it won't be used as an exit for my short but as a new entry), therefore I was thinking to use sub accounts.
I was wondering if anyone could help me understand how can I launch a strategy under a sub account.
I have this ninjascript code where you can see that I launch my strategy under my existing account, but I need to enter the sub account information.



MyStrategy childStrategy= new MyStrategy ();
childStrategy.Account = Account;
Period minutePeriod = new Period(PeriodType.Minute,1,MarketDataType.Last);
childStrategy.SetBarsPeriodInstrument(minutePeriod,Position.Instrument);
Strategies.Add(childStrategy);
if (!childStrategy.Enabled)
{
childStrategy.Enabled = true;
}



the line marked in red is the line where i want to replace - instead of using "Account" object i want to use something like "Sub Account".

Thanks!


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
I Have a Thing Called Iran -- Trump Stays in DC as Airsp …
Prediction Markets & Event Contracts
CFTC Launches Innovation Task Force for AI Trading Syste …
Traders Hideout
Prop Firms Are Banning Gold Trading as Record Prices Mak …
Funded Trading Evaluation Firms
Asia Equities Crash Overnight -- Nikkei -5.2%, KOSPI -6. …
Traders Hideout
NinjaTrader Parent Payward Acquires Bitnomial for $550M …
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
chrisplecker
Charlottesville, VA
 
Posts: 21 since Apr 2014
Thanks Given: 0
Thanks Received: 13


Being long and short at the same time is virtually the same as being flat. I don't understand what you are trying to do. If you are trading calendar spreads, then you should set the proper instrument. Wanting to go long and short the same instrument is utterly useless and a waste a time. It is no different than going flat.


Reply With Quote




Last Updated on June 11, 2015


© 2026 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 - Downloads - Top
no new posts