NexusFi: Find Your Edge


Home Menu

 





NinjaTrader Crash Recovery


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one TraderDJB with 6 posts (0 thanks)
    2. looks_two MXASJ with 3 posts (0 thanks)
    3. looks_3 ilikeatr with 1 posts (0 thanks)
    4. looks_4 zeller4 with 1 posts (0 thanks)
    1. trending_up 5,973 views
    2. thumb_up 0 thanks given
    3. group 4 followers
    1. forum 12 posts
    2. attach_file 1 attachments




 
Search this Thread

NinjaTrader Crash Recovery

  #11 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800


TraderDJB View Post
Right, that's the info displayed in the control panel tabs.

You will see an instance in cache (for want of a better word) for every enable/disable/enable cycle of each strategy, and GC does not clear it.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
Better Renko Gaps
The Elite Circle
MC PL editor upgrade
MultiCharts
ZombieSqueeze
Platforms and Indicators
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
GFIs1 1 DAX trade per day journal
16 thanks
My NQ Trading Journal
14 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
13 thanks
  #12 (permalink)
 
TraderDJB's Avatar
 TraderDJB 
Michigan
 
Experience: Intermediate
Platform: NinjaTrader, TradeStation, Thinkorswim
Broker: MB Trading
Trading: Forex
Posts: 46 since Jan 2010
Thanks Given: 7
Thanks Received: 28

I've been trying to get to the list produced by the Strategy Analyzer in a similar fashion to no avail, as well as...


Quoting 
// There is only 1 in this.Strategies, so this doesn't work...
//foreach (StrategyBase strategy in this.Strategies)
//{
// Strategy.Print("Profit Factor: " + strategy.Performance.AllTrades.TradesPerformance.ProfitFactor);
//}

Have you had any success in this?

Do or do not, there is no try. - Yoda
Started this thread Reply With Quote
  #13 (permalink)
ilikeatr
London
 
Posts: 4 since Aug 2010
Thanks Given: 1
Thanks Received: 1



TraderDJB View Post
Update: I have successfully accessed from within the strategy the global values that are listed in the Executions, Positions, and Accounts tabs using this code:

 
Code
// To access Executions or Accounts, replace "Positions" with the appropriate change.
                Print("Positions: " + Account.Positions.Count);
                System.Collections.IEnumerator Test = Account.Positions.GetEnumerator();
                for (int i = 0; i < Account.Positions.Count; i++)
                {
                    Test.MoveNext();
                    Print("Current" + Test.Current);
                }
It seems that the current status of the broker isn't kept into separate orders that the strategy placed but rather is the running sum. So, I'll have to have the strategy infer based on the current quantity and direction (long/short) where it is at then it will know for sure. Since it uses multiple orders of fixed sizes, it won't be hard to infer how many it has active to match the broker position.

It still doesn't solve how to recreate the IOrder... but I suppose the strategy doesn't need to, it could keep track at that point by something else instead of IOrder == null...... more updates to come.

Interesting thread and it's something that has been on my mind as I've been trying to learn NT7 over the last few weeks. This stuff is important not just for crash handling but in the event of power failure/etc too where you want to resume the trade. After NT7 restarts after a crash/reboot, will the strategy remain in the Strategies tab and be checked Enabled?

Bear in mind I'm still new to NT and maybe this is new to NT7 also but I can see Account.Orders in there which is an OrderCollection. Give that you know already (or at least you should!) what the order signal name is for a given strategy you should be able to query each order in the collection, match its status and signal name to retrieve it.

In this code example I'm just guessing that you can cast to IOrder from the OrderCollection. When I did backtesting using the following code I found the count was always 0, which I suppose is understandable for a backtest, but it didn't really answer my question properly. Maybe someone with a live trading account can give it a shot?

 
Code
System.Collections.IEnumerator Test = Account.Orders.GetEnumerator();
                for (int i = 0; i < Account.Orders.Count; i++)
                {
                    IOrder TestOrder = (IOrder) Test.Current;
                    Print("Current " + Test.Current);
                    Test.MoveNext();
                }
Aside from that I'm being careful to avoid any loose-hanging variables that are set on the fly that would need to be re-filled during the OnStartUp() after you've got the orders back out of the collection. And personally I don't really like that practice anyway.

Reply With Quote




Last Updated on August 18, 2010


© 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