How upload an automated futures strategy to a server to run it 24/5?

Discussion in 'Automated Trading' started by Hiperfly, Mar 31, 2014.

  1. RedDuke

    RedDuke

    Hi Dom993,

    I am having an issue with ninja strategy. When I loose connection, how do I retrieve orders that I currently have in the market? I use order object not being null for various reasons including closing the positions. Once I loose connection, my order object is null after reconnect.

    Any help is greatly appreciated.

    Thanks,
    redduke
     
    #11     Apr 19, 2014
  2. dom993

    dom993

    As long as the current strategy instance is running, there is no reason for an IOrder to "disappear" (you wrote my order object is null after reconnect).

    If your strategy instance is terminated, and a new instance is started, then the new instance *cannot* access orders placed by the old instance. Of course when it starts, all of its IOrder variables are null.

    Can't really help you much more from your post - from here, I suggest contacting the NinjaTrader support forum - or contact me via email if you want to discuss your situation further with me.
     
    #12     Apr 19, 2014
  3. RedDuke

    RedDuke

    Dom993,

    Thanks for this info. How do you handle the weekends then when a strategy runs for few weeks? I currently used TWS from IB and not sure how to handle the weekends.

    Thanks
     
    #13     Apr 20, 2014
  4. dom993

    dom993

    The high-level idea:

    In OnTermination(), my strategies take note (in a file) of their current position & open-orders, then cancel all open-orders.

    When restarted, the strategies restore their current position (I do that using a MKT order while in Historical, and I make sure I don't issue any other order while in Historical), then on the 1st non-Historical bar I restore the prior open-orders.

    Note: To do this, you must use "Immediately submit live working historical orders" In Options / Strategies / NinjaScript.

    Having no open-orders while the strategy is stopped "guarantees" the existing position will be identical when the strategy is restarted.

    This way, I can stop & restart my strategies any-time.
     
    #14     Apr 21, 2014
  5. RedDuke

    RedDuke

    Hi Dom993,

    Thanks a lot for this info. Makes perfect sense. Do you know if I can create DB tables within Ninja and use them instead of files?

    Regards,
    redduke
     
    #15     Apr 21, 2014
  6. dom993

    dom993

    You really like living dangerously, don't you? :)

    Leave NinjaTrader DB alone, use your own files or your own DB if you think you need a DB.

    Cheers
    Dominique
     
    #16     Apr 21, 2014
  7. RedDuke

    RedDuke

    :) Thanks a lot
     
    #17     Apr 21, 2014
  8. DOM933 - This thread seem a year old, but I have this situation that refer to
    only problem i have using "Immediately submit live working historical orders" is
    when I start a chart for 1st time, it some times places orders in opposite direction of Trend in my chart. if my chart has SHORT trend, it places LONG
    I understand it places from live working historical orders, but how do I correct placing order in correct trend/direction of my chart
    thks and appreciate the help :)
     
    #18     Jan 16, 2015
  9. RedDuke

    RedDuke

    Is this a custom logic that you wrote or is it done via wizard ?
     
    #19     Jan 16, 2015
  10. I had a coder who wrote strategy for me. But I chose "Immediately submit live working historical orders" from NT --> options --> strategies Tab --> Ninjascript
     
    #20     Jan 16, 2015