Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

add parameters

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

    add parameters

    Hello all,

    How can I add these 2 Moving averages (both are SMA but with different periods) to the parameters section, so I can modify them and optimize them easily:

    {
    #region Variables

    #endregion

    /// <summary>
    /// This method is used to configure the indicator and is called once before any bar data is loaded.
    /// </summary>
    protected override void Initialize()
    {
    Overlay = true;
    CalculateOnBarClose = false;
    }

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

    if (SMA(20)[0] > SMA(50)[0])
    BackColor = Color.Green;
    if (SMA(20)[0] < SMA(50)[0])
    BackColor = Color.Pink;

    }

    Thanks,

    Alan

    #2
    Hello futuros,

    You would want to create user defined variable(s) so that you could specify what value you want it to be. Here is a link to an example of how to create user defined variable(s) that would be a a good reference.

    http://www.ninjatrader.com/support/f...ead.php?t=5782

    Let us know if we can be of further assistance
    JCNinjaTrader Customer Service

    Comment


      #3
      It worked!

      thanks JC...

      Comment


        #4
        Hello my question is about a bracket OCO order. I want to set one order to cancel only after a certain condition is met on the other open order. For example if im trading Forex. I set buy and sell entry points at 60 and 30. I enter buy at 60 but dont want the other sell order to cancel until I reach price of 75. How would i go about setting this up? thanks in advance

        Comment


          #5
          Hello Camron,

          If you are using the managed approach for order methods you will only be able to trade in one direction so NinjaTrader will automatically cancel your position for you. If you are using the unmanaged approach then you could use the CancelOrder() method and define what order you would like to cancel by the signal. Here is a link to a references that goes over CancelOrder() that you may use.

          http://www.ninjatrader.com/support/f...ad.php?t=18890

          Let us know if we can be of further assistance.
          JCNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by alifarahani, Today, 09:40 AM
          6 responses
          27 views
          0 likes
          Last Post alifarahani  
          Started by Waxavi, Today, 02:10 AM
          1 response
          17 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Started by Kaledus, Today, 01:29 PM
          5 responses
          13 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by Waxavi, Today, 02:00 AM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Started by gentlebenthebear, Today, 01:30 AM
          3 responses
          17 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X