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

Delay entry after conditions met

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

    Delay entry after conditions met

    HI ,
    I have simple donhian chanel strategy and I would like to enter long/short after delaying 1 day
    So basically when donhian = current price then skip next day and enter on high/low of skipped day(previous day)
    And is is possible to do this in wizard without unlocking the code
    Thank you

    #2
    Hello centurius,

    This may be possible using user variables.

    When the condition is true, set Variable0 to 1.

    Then if Variable0 is set to 1 and Misc -> SessionBreak == True then set Variable0 to 2.
    (if Variable0 == 1 && Bars.SessionBreak == True)

    If Variable0 is set to true, then place your order and set Variable0 to 0 to reset this for the next trade.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Delay entry after conditions met

      Hello Chelsea,
      I tried that but I just don't understand how variables work,
      I attached image of what I have so far,
      Thank you for your help
      Attached Files

      Comment


        #4
        Hello centurius,

        A variable is used to store a value.

        In this example, we are storing a number that we will use to represent a state.

        If the variable is storing a 0, this means that we are waiting for the condition to be true.

        If the variable is storing a 1, this means that we are waiting for the session break.

        If the variable is storing a 2, this means the order is ready to be placed.

        Attached is a screenshot of how to check the value of this variable (orange), and how to set the value of this variable (green).
        Attached Files
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Delay entry after conditions met

          Hello Chelsea,
          I tried to make it work I tried many different ways and still cant do it,
          I attached script zip file,
          Thank you for your help
          Attached Files

          Comment


            #6
            Hi centurius,

            My screenshot wasn't meant to provide you with working logic, the screenshot was just to show you where you can find the place to check the variable in a condition and where to set the variable.

            You will need to create logic that works with your strategy. You will need multiple condition sets because your logic has multiple stages.

            On condition set 1, you would be checking for whatever condition that sets part 1 of the trigger. (when donhian = current price)

            On condition set 2, you are checking that part 1 has already been hit and then you are waiting for the next session to be hit.

            On condition set 3, you are checking that both part 1 has already been hit and part 2 has already been hit and then you would place the order.

            If you would like, I can provide you with a list of consultants who could create this script for you, or instead a list of educators who can teach you the basics of c# programming.

            Would you like a link to a list of either of these professionals?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              I give up,
              thanks for trying

              Comment


                #8
                Hello centurius,

                While I don't have an example that has this logic exactly, and I am also not able to create scripts for our clients, I do have a script I've made previously where I am using Variable0 - Variable1 to save price values for a trail trigger.

                While your use would be different, this example does show how to set a variable and then check the value of the variable later.

                If you would like the script created for you or if you would like to work with an educator please let me know so that I may direct you to a list of these professionals.
                Attached Files
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Thank you Ill give it a try

                  Comment


                    #10
                    order condition

                    Hello,

                    is ther any way to place a long entry order (limit or Stop..) and if price reaches a certain lower level , then the order is canceled? and in shorts should be viceversa.


                    for example: (longs)actual price 2000, entry log stop order if price reaches 2100 .... but if price goes lower than 1900 , then cancel the orderr.

                    (shorts) actual privce 2000 entry short stop order if price reache 1900 but if price goes higher than 2100, the cancel the order

                    than should be a condition like the "oco" , not an automated strategy, because then I want to manage the trade manually, placing sotps and profits
                    thanks

                    Comment


                      #11
                      Hello PEPBOSCH,

                      If you are using the Strategy Wizard, orders will be submitted with liveUntilCancelled set to false.

                      What this means is, if the order has not filled by the time the bar closes, the order is automatically cancelled. If you want the order to remain alive, it must be resubmitted on each new bar.

                      So, if you want an order to cancel when using the Wizard, simply do not re-submit the order on the new bar and it will be cancelled automatically.

                      This means your logic will resubmit the order as long as the price is above 1900. If the price falls below this, the order is not resubmitted and is automatically cancelled.
                      Chelsea B.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by usazencort, Today, 01:16 AM
                      0 responses
                      1 view
                      0 likes
                      Last Post usazencort  
                      Started by kaywai, 09-01-2023, 08:44 PM
                      5 responses
                      603 views
                      0 likes
                      Last Post NinjaTrader_Jason  
                      Started by xiinteractive, 04-09-2024, 08:08 AM
                      6 responses
                      22 views
                      0 likes
                      Last Post xiinteractive  
                      Started by Pattontje, Yesterday, 02:10 PM
                      2 responses
                      21 views
                      0 likes
                      Last Post Pattontje  
                      Started by flybuzz, 04-21-2024, 04:07 PM
                      17 responses
                      230 views
                      0 likes
                      Last Post TradingLoss  
                      Working...
                      X