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

selecting one line from an indicator set

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

    selecting one line from an indicator set

    I would like to use a pivot indicator in a strategy.

    There are various pivots in the indicator, I only want to use one of the pivots

    How do i define the specific line i want to trade, in the strategy wizard?

    #2
    Hello ScottieDog,

    Thank you for writing in.

    You will need to select the specific Plot that you would like to use from within the Condition Builder.

    I have provided a screenshot showing what I am referring to.

    Please, let us know if we may be of further assistance.
    Attached Files
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      i see now. perfect. thanks

      Comment


        #4
        I tried to set up an example this afternoon, for a fade short to take place when price (ask) crosses above the PP of the standard pivots indicator set.

        I´m not sure why, but it won't execute any trades at all? It won't even plot the dot. I added a time condition, really just so I can start learning how to build something.



        Code:
        /// <summary>
                /// This method is used to configure the strategy and is called once before any strategy method is called.
                /// </summary>
                protected override void Initialize()
                {
                    Add(Pivots(NinjaTrader.Data.PivotRange.Daily, NinjaTrader.Data.HLCCalculationMode.CalcFromIntradayData, 0, 0, 0, 20));
                    SetProfitTarget("", CalculationMode.Ticks, Target);
                    SetStopLoss("", CalculationMode.Ticks, Stop, false);
        
                    CalculateOnBarClose = false;
                }
        
                /// <summary>
                /// Called on each bar update event (incoming tick)
                /// </summary>
                protected override void OnBarUpdate()
                {
                    // Condition set 1
                    if (CrossAbove(GetCurrentAsk(), Pivots(PivotRange.Daily, HLCCalculationMode.CalcFromIntradayData, 0, 0, 0, 20).PP, 1)
                        && ToTime(Time[0]) >= ToTime(9, 0, 0)
                        && ToTime(Time[0]) <= ToTime(14, 30, 0))
                    {
                        DrawDot("My dot" + CurrentBar, false, 0, High[0] + 5 * TickSize, Color.Crimson);
                        EnterShort(DefaultQuantity, "");
                    }
                }

        Comment


          #5
          Hello ScottieDog,

          If the dot is not being drawn, then this would denote that the condition you have created is not becoming true.

          Remember that all conditions must be true.

          I would suggest dividing your condition into multiple sets in the Strategy Wizard. For each set, have the condition "Print to output window" with a message that you can use to tell which condition is true.

          The Output Window can be opened from Tools -> Output Window in the Control Center.
          Zachary G.NinjaTrader Customer Service

          Comment


            #6
            I've reduced it to the one condition, by removing the time element. I can add the time later when I have sorted the issue. I'm just trying to get some simple conditions set to help me learn the code.

            Now I removed the time element, the strategy is executing some trades, but it seems to be picking and choosing when to fade the PP. I am quite stuck and would appreciate some assistance. Why would it execute sometimes, and not other times? As there is only one condition, it should do the same trade every time, surely?

            For the condition, I simply want to fade the PP, buy long when price hits the PP from above, sell short when price hits the PP from below. Maybe I am using the wrong type of condition to make this happen?

            Comment


              #7
              Hello ScottieDog,

              The entry will only occur if the condition you have specified is true. If the condition is not true, the entry will not be called.

              There are no long entries in the code you have provided, so your strategy will not submit any long orders.

              With the code you have provided, an enter short order will be called only when the ask price crosses above the Pivot indicator's PP plot value.

              You will need another condition set that will submit a long order if the price crosses below the Pivot indicator's PP plot value.
              Zachary G.NinjaTrader Customer Service

              Comment


                #8
                Thanks for the support.

                I´m going to have another go at this from fresh. I clearly messed it up, and it seemed so simple, lol.

                Really is quite hard for this old brain to start learning this. Quite a task ahead

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by PhillT, 04-19-2024, 02:16 PM
                4 responses
                34 views
                0 likes
                Last Post PhillT
                by PhillT
                 
                Started by ageeholdings, 05-01-2024, 05:22 AM
                5 responses
                37 views
                0 likes
                Last Post ageeholdings  
                Started by reynoldsn, Today, 02:34 PM
                0 responses
                12 views
                0 likes
                Last Post reynoldsn  
                Started by nightstalker, Today, 02:05 PM
                0 responses
                18 views
                0 likes
                Last Post nightstalker  
                Started by llanqui, Yesterday, 09:59 AM
                8 responses
                31 views
                0 likes
                Last Post llanqui
                by llanqui
                 
                Working...
                X