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

default strategy inpu

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

    default strategy inpu

    Is it possible to have a Strategy InPut as a variable as to Minutes: 15 Bars to Load: 50

    and then plot the strategy results on a 1 Minute charts as to entry and exit triggers

    #2
    i have created a user input for the number of ticks to set for a StopLoss and I also created a bool to Turn the Stop Loss ON or OFF





    but i do not see how to incorporate the bool statement into the settings on the stop loss




    Comment


      #3
      Also Have some Condition Drive Exits that are triggering exits from Positions, BUT the Profit target and Stop Loss orders are not canceling after the Position is closed

      Comment


        #4
        Hello DTSSTS,

        Unfortunately, dynamically adding series is not supported.

        From the help guide:

        "Arguments supplied to AddDataSeries() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input). Attempting to add a data series dynamically is NOT guaranteed and therefore should be avoided. Trying to load bars dynamically may result in an error similar to: Unable to load bars series. Your NinjaScript may be trying to use an additional data series dynamically in an unsupported manner."
        https://ninjatrader.com/support/help...dataseries.htm

        I will submit a feature request on your behalf to be able to dynamically add series.


        A bool is a true or a false value. I'm not understanding how you are wanting to use this as a number of ticks.
        You can use an integer (a number) for the value of SetStopLoss().
        https://ninjatrader.com/support/help...etstoploss.htm



        SetStopLoss() will automatically cancel if the target is filled and SetProfitTarget() will automatically cancel if the stop is filled. Are you using other exit orders to exit the position?

        Are you printing the order object in OnOrderUpdate() to show that these are not being cancelled?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          i always use tick, they work perfectly and can be used easily with Futures as well.

          Setting the Value of StopLoss work as designed with the ticks and scripts.

          I need to Turn ON or OFF the use of the Stop Loss, Profit Target, and Trailing Stop (per users preferences - for a swing trade I may want to let the stock run and exit on Condition Exits and NOT turn on the Profit Target for example.

          YES I am using other exit order to exit the positions and they most likely will cause the exit rather that the StopLoss (i did state that "Also Have some Condition Drive Exits that are triggering exits from Positions, BUT the Profit target and Stop Loss orders are not canceling after the Position is closed"

          I have not found in the strategy builder an OnOrderUpdate() to try to use (also in Order Management I would think there would be a cancelorders command that could be used when the OTHER exit orders trigger to cancel the Profit Target, StopLoss etc

          Thanks

          Comment


            #6
            Hello DTSSTS,

            Once a Set method such as SetStopLoss() is set (per signal name), there is no way to unset this. Set methods are basically intended to be set once and then forgotten without any other exit methods involved.
            You can place new orders without a Set method by choosing a new unique signal name for the entry order.

            It is also not advised to use multiple orders to exit a single entry order.

            If you need to cancel the exit order, I would recommend using Exit methods such as ExitLongStop() and not using Set methods. You can assign this to an Order variable in OnOrderUpdate() and then cancel this at a later time if you choose to with CancelOrder(). (You can also detect the order being cancelled and then send an other order such as a market order to cancel the order)

            OnOrderUpdate() triggers when an order updates. Coding logic here is more advanced than what the Strategy Builder is capable of.

            With strategies built in the Strategy Builder Exit method orders will automatically cancel when the bar closes if they are not resubmitted. (Due to isLiveUntilCancelled defaulting to false when not being used)
            You can take advantage of this if you want to change the exit by not resubmitting the order when the bar closes and on the next bar placing a different exit method such as a market order to exit that entry.

            I do have a simple example created with the Strategy Builder that uses exit orders.
            https://ninjatrader.com/support/foru...427#post527427
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              i have alot of left of Cancel Pending orders from those test that I hoped might cancel on the Open but did not as well







              Comment


                #8
                ok seems i have wasted a min of 100 hours, too many limitations to really use unless you only want to use 1 single type setup MOVE to trash and rethink all

                Comment


                  #9
                  how to set a trailing stop DO YOU see any issue with this


                  Comment


                    #10
                    Hello DTSSTS

                    SetStopLoss() and SetTrailStop() cannot be used at the same time on the same signal name.

                    From the help guide:

                    "The SetTrailStop() method can NOT be used concurrently with the SetStopLoss() method for the same position, if both methods are called for the same position (fromEntrySignal) the SetStopLoss() will always take precedence. You can however, use both methods in the same strategy if they reference different signal names."



                    You will need to remove the call to SetStopLoss() to be able to use SetTrailStop().
                    Chelsea B.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Mestor, 03-10-2023, 01:50 AM
                    16 responses
                    388 views
                    0 likes
                    Last Post z.franck  
                    Started by rtwave, 04-12-2024, 09:30 AM
                    4 responses
                    31 views
                    0 likes
                    Last Post rtwave
                    by rtwave
                     
                    Started by yertle, Yesterday, 08:38 AM
                    7 responses
                    29 views
                    0 likes
                    Last Post yertle
                    by yertle
                     
                    Started by bmartz, 03-12-2024, 06:12 AM
                    2 responses
                    22 views
                    0 likes
                    Last Post bmartz
                    by bmartz
                     
                    Started by funk10101, Today, 12:02 AM
                    0 responses
                    7 views
                    0 likes
                    Last Post funk10101  
                    Working...
                    X