Also, is it possible to cap my number of day trades at three for the week?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Under 25K
Collapse
X
-
Under 25K
I am under 25K, so I am looking to swing trade rather than day trade. I thus need to make sure the position is exited on a day that is different than the day entered, but I can't find in the Ninjascript library where to get the day a position was entered or the current day. Can any one help?
Also, is it possible to cap my number of day trades at three for the week? -
Hello CriticalMind,
Sledge is correct in that with futures you do not have a minimum account balance to day trade so what you are asking may not even apply.
Both items you have mentioned however are perfectly possible within NinjaTrader using NinjaScript. To get the time an order was filled (the same as when a position is entered) you check the OnExecution method for order fills and then create a DateTime variable to hold the time the order filled. For example:
Code:#region Variables DateTime orderFilled; IOrder myOrder; #endregion protected override void OnBarUpdate() { if(myOrder == null) { myOrder = EnterLong(); //Submits the order } } protected override void OnExecution(IExecution e) { if(e.Order.OrderState == OrderState.Filled && e.Order == myOrder) { orderFilled = DateTime.Now; //Set the orderFilled time } }
Please let me know if you have any questions or if I may be of further assistance anytime.Michael M.NinjaTrader Quality Assurance
Comment
-
Thank you very much. I'll backtest both the futures and swing trading stocks, and find which is most effective.
Does anyone on the forum know a good place to get the symbol list for NYMEX? I entered some manually, and I got error messages for half of them.
Comment
-
You can find a list on the CME website at the following link: http://www.cmegroup.com/trading/prod...lse&exch=NYMEX
Please let me know if you cannot find one of these under Tools > Instrument Manager: http://ninjatrader.com/support/helpG...nt_manager.htm
Comment
-
-
-
Hello CriticalMind,
For backtesting you will likely want to replace the following code:
Code:orderFilled = DateTime.Now; //Set the orderFilled time
Code:orderFilled = Time[0]; //Set the orderFilled time
Michael M.NinjaTrader Quality Assurance
Comment
-
Thanks for the reply. It looks like it still doesn't work. Backtested the NASDAQ 100 since Jan 2015 and only one stock traded once. It normally trades about 20 times a week. Any other ideas. Thanks for your help.
Comment
-
Hello CriticalMind,
So that I can assist in the most efficient manner possible, can you please attach your code in an email to platformsupport[AT]ninjatrader[DOT]com with the subject line: "ATTN: Michael M http://www.ninjatrader.com/support/forum/showthread.php?t=78518"?
Thank you in advance.Michael M.NinjaTrader Quality Assurance
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Aviram Y, Today, 05:29 AM
|
0 responses
3 views
0 likes
|
Last Post
by Aviram Y
Today, 05:29 AM
|
||
Started by quantismo, 04-17-2024, 05:13 PM
|
3 responses
27 views
0 likes
|
Last Post Today, 05:23 AM | ||
Started by ScottWalsh, 04-16-2024, 04:29 PM
|
7 responses
35 views
0 likes
|
Last Post Today, 05:15 AM | ||
Started by cls71, Today, 04:45 AM
|
0 responses
6 views
0 likes
|
Last Post
by cls71
Today, 04:45 AM
|
||
Started by mjairg, 07-20-2023, 11:57 PM
|
3 responses
218 views
1 like
|
Last Post
by PaulMohn
Today, 04:22 AM
|
Comment