Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

help in unmanaged order

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    help in unmanaged order

    hello, i try to use the unmanaged order, but the strategy not enter..why? using managed order it place the order...
    under there is the code;



    #region Using declarations
    using System;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Xml.Serialization;
    using NinjaTrader.Cbi;
    using NinjaTrader.Data;
    using NinjaTrader.Indicator;
    using NinjaTrader.Gui.Chart;
    using NinjaTrader.Strategy;
    #endregion

    // This namespace holds all strategies and is required. Do not change it.
    namespace NinjaTrader.Strategy
    {
    /// <summary>
    /// Enter the description of your strategy here
    /// </summary>
    [Description("Enter the description of your strategy here")]
    public class confermatrand2 : Strategy
    {
    #region Variables
    // Wizard generated variables
    private IOrder entryOrder = null;
    private IOrder stopOrder = null;
    private IOrder targetOrder = null;
    private int target = 20;
    private int stop = 40;

    // User defined variables (add any user defined variables below)
    #endregion

    /// <summary>
    /// This method is used to configure the strategy and is called once before any strategy method is called.
    /// </summary>
    protected override void Initialize()
    {
    DisconnectDelaySeconds = 120;
    //ConnectionLossHandling = ConnectionLossHandling.StopStrategy;
    BarsRequired = 0;
    TraceOrders = true;
    SetProfitTarget("1", CalculationMode.Ticks, Target);
    // SetStopLoss("1", CalculationMode.Ticks, Stop, false);
    SetTrailStop("1", CalculationMode.Ticks, Stop, false);

    CalculateOnBarClose = true;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {


    if ( Condition set 1
    && entryOrder == null
    )
    {
    entryOrder = EnterLong(1,"1");
    }


    if (Condition set 2
    && entryOrder == null)
    {
    entryOrder = EnterShort(1,"1");
    }
    }
    }

    /// <summary>
    /// Called on each incoming order event
    /// </summary>
    protected override void OnOrderUpdate(IOrder order)
    {
    // Handle entry orders here. The entryOrder object allows us to identify that the order that is calling the OnOrderUpdate() method is the entry order.
    if (entryOrder != null && entryOrder == order)
    {
    // Reset the entryOrder object to null if order was cancelled without any fill
    if (order.OrderState == OrderState.Cancelled && order.Filled == 0)
    {
    entryOrder = null;
    }
    }
    }
    #region Properties
    [Description("")]
    [GridCategory("Parameters")]
    public int Target
    {
    get { return target; }
    set { target = Math.Max(1, value); }
    }

    [Description("")]
    [GridCategory("Parameters")]
    public int Stop
    {
    get { return stop; }
    set { stop = Math.Max(1, value); }
    }

    #endregion
    }
    }

    #2
    Hello person,

    Thank you for your post.

    Unmanaged needs to be set to True and you would use the SubmitOrder() method. Please visit the following link for information on the Unmanaged Approach: http://www.ninjatrader.com/support/h...d_approach.htm

    Please let me know if you have any questions.

    Comment


      #3
      what is the action in this code?
      entryOrder = SubmitOrder(0, OrderAction.Buy, OrderType.Limit, 1, GetCurrentBid(), 0, "", "Long Limit");
      the first 0 is data series? and then?
      thank's

      Comment


        #4
        Hello bergimax,

        Thank you for your post.

        If you added additional bar series to your script you would reference them as 1, 2, 3, etc. in order to send orders to those bar series. You can find information on multiple bar series (time frames and instruments) in your code at the following link: http://www.ninjatrader.com/support/h...nstruments.htm

        Comment


          #5
          thank's for the replay and the assistance.
          and what is the other instruction in the code?

          Comment


            #6
            Hello,

            The syntax for the SubmitOrder() method can be found at the following link, including details on the parameters: http://www.ninjatrader.com/support/h...ubmitorder.htm

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by wzgy0920, 04-20-2024, 06:09 PM
            2 responses
            27 views
            0 likes
            Last Post wzgy0920  
            Started by wzgy0920, 02-22-2024, 01:11 AM
            5 responses
            32 views
            0 likes
            Last Post wzgy0920  
            Started by wzgy0920, 04-23-2024, 09:53 PM
            2 responses
            49 views
            0 likes
            Last Post wzgy0920  
            Started by Kensonprib, 04-28-2021, 10:11 AM
            5 responses
            193 views
            0 likes
            Last Post Hasadafa  
            Started by GussJ, 03-04-2020, 03:11 PM
            11 responses
            3,235 views
            0 likes
            Last Post xiinteractive  
            Working...
            X