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 merc410, Today, 03:41 AM
          2 responses
          8 views
          0 likes
          Last Post merc410
          by merc410
           
          Started by sugalt, 04-30-2024, 04:02 AM
          2 responses
          13 views
          0 likes
          Last Post sugalt
          by sugalt
           
          Started by Ndakotan1313, 03-14-2024, 05:02 PM
          2 responses
          61 views
          0 likes
          Last Post blaise_code  
          Started by claxxical, 05-30-2017, 12:30 PM
          37 responses
          4,460 views
          0 likes
          Last Post Padan
          by Padan
           
          Started by SugarDefwebsite, Today, 02:18 AM
          0 responses
          4 views
          0 likes
          Last Post SugarDefwebsite  
          Working...
          X