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

Left is the short strategy and right-side long strategy, long side working perfect.

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

    Left is the short strategy and right-side long strategy, long side working perfect.

    For the short side strategy, on the left, I'm doing something incorrectly. By looking at these screenshots where could I be going wrong?
    I left out the 6th pic, too many. But it's StopPrice <= GetCurrentAsk(Default Input) vs StopPrice >= GetCurrentBid(Default Input)
    Attached Files

    #2
    Hello trdninstyle,

    Thank you for your note.

    What is the behavior your strategy is displaying vs. what you expect? One thing I notice has to do with the price for StopPrice and TriggerPrice; these may need to be adjusted as Position.AveragePrice plus or minus a value based on whether you are long or short. Profit and loss are in different directions depending on whether you are long or short. It looks like in both screenshots you are adding (+) to calculate the StopPrice and TriggerPrice but you may need to subtract (-) in some scenarios.

    Please let me know if I may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      In the set 3 I might have to change it from + to minus - then? Where I have a square indicating.

      Must not be the actual plus sign+ that you are referring to, I tried changing that. I can change what is inside of the parenthesis.
      Is that what you mean?
      Attached Files
      Last edited by trdninstyle; 11-23-2022, 11:34 AM.

      Comment


        #4
        They both are saying 'InitialStopDistance' .
        Attached Files

        Comment


          #5
          Hello trdninstyle,

          Thank you for your reply.

          I apologize for any confusion; it appears that your inputs are either negative or positive depending on whether it is the long or short strategy. I still do not understand the difference between how your strategy is behaving vs. how you are expecting it to behave. The lines in your screenshots don't demonstrate to me what part of the strategy "ends up not calculating" - please provide a more in-depth description of what you want your strategy to do and what part of it is not taking the desired action so I may better understand and assist you. What is the difference between how the long strategy is performing vs. the short strategy?

          I look forward to your reply.
          Emily C.NinjaTrader Customer Service

          Comment


            #6
            Well, I'm expecting the short side to behave like long side but of course the opposite. The long side is the one thats working, except for a minor hiccup, I guess.

            I think in set 1 it's supposed to be the same as the long setup in set 1. Being TriggerState >= 2 but I have it <= the opposite.
            Later on, when I have the short working properly & I make it as one strategy, up and down, don't I leave set 1 for both of them? And the set 5, leave the same? That is when they are both together as one strategy.

            If I do, then thats the first mistake I made, this, <= and >=

            The short side strategy is supposed to take profit at -6 ticks, the breakeven -1 triggered at -5 ticks, Initial stop loss at 4 ticks.
            As I scroll back before the long black line where it appears to work, (but it doesn't) the profits are for 1 tick or in & out at the same spot.

            It will come, it's the journey that I enjoy, when it's all figured out what do I do then? lol

            The breakeven -1 is not in the inputs though, the -1. But the trigger is in the input set at -5 to trigger the b.e. at -1.

            The limit order short 1 is the input, so I can toggle that feature back & forth for testing. (it's +1 not -1, I type it wrong here)
            Last edited by trdninstyle; 11-23-2022, 02:02 PM.

            Comment


              #7
              Have a good Thanksgiving tomorrow, you can follow up Friday or Monday. God bless.

              Comment


                #8
                Hello trdninstyle,

                Thank you for your patience.

                I recommend adding Print() statements to understand the variables and values being used (such as StopPrice and TriggerPrice) inside of your conditions. We have more detailed information about using prints as a debugging tool, including a video about how to add prints in the Strategy Builder, at the following links:




                This can help you to see how the different values are evaluated throughout the life of the script and better understand what is causing different strategy behaviors. I am glad to hear that this is a journey you enjoy! We are always glad to answer questions about NinjaScript development and provide resources from our help guide as well as simple examples. We also assist with guidance through the debugging process in order to understand unexpected behavior.

                Please let me know if I may be of further assistance.
                Emily C.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by lightsun47, Today, 03:51 PM
                0 responses
                4 views
                0 likes
                Last Post lightsun47  
                Started by 00nevest, Today, 02:27 PM
                1 response
                8 views
                0 likes
                Last Post 00nevest  
                Started by futtrader, 04-21-2024, 01:50 AM
                4 responses
                44 views
                0 likes
                Last Post futtrader  
                Started by Option Whisperer, Today, 09:55 AM
                1 response
                13 views
                0 likes
                Last Post bltdavid  
                Started by port119, Today, 02:43 PM
                0 responses
                9 views
                0 likes
                Last Post port119
                by port119
                 
                Working...
                X