Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error on chart with stop loss

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

    Error on chart with stop loss

    When I change my stop loss, I get a discrepancy between the Output window, which shows the correct value, and the Chart, which consistenly shows 2 pips less.

    I want to change the stop loss on a long position from 10 (the variable 'stop2') to breakeven plus 1. The output window shows the correct new stop loss value (in this case 1.3180), but the chart shows 'Trade2' closing at 1.3178.

    This happens on every similar trade. Why the difference? How do I get the chart right?

    Many thanks,
    Attached Files

    #2
    Hi adam_norsworthy,

    Thanks for the post and welcome to the NinjaTrader forums!

    Is this a real time or historical trade? Is the issue with the fill price of the order, or the actual price that it's working at?

    You could check the exact price of the order through the control center to verify that the code matches your expectations, or programatically is available with this technique:


    If the issue is just that the real time fill price is 2 pips worse on a stop market order, then this is unfortunately something you will see happen with this order type. You would want to use stop limit instead if you want to enforce the worst fill price you're willing to take instead.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi RyanM, thanks for the response. I followed your link and added the Monitor code to my strategy. Attached is a photo of the output window.

      The is based on historical trade.This issue is with the execution of the trade, happening at 1.3178 and not 1.3180. The stop loss should be set at 1.3180, but the trade executes at 1.3178.

      The order type is coded as a SetStopLoss. Where am I going wrong? In the attached Output window file it shows the value I am attempting to assign (1.3180) when I print it to the output window, but it also shows the value of 1.3178 as printed by the new Monitor code I added.

      Kind regards, Adam.
      Attached Files

      Comment


        #4
        Thanks. I took another look at the code picture in your first post. In your code block where you make the MarketPosition == long check, it seems like you want to use CalculationMode.Price rather than .Ticks.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Yup - that worked!

          Hey RyanM,

          Awesome. You were stop on. I changed it to Price and its working fine. Thank you.

          Can you point me in the direction of information on working with two charts at the same time. I want to enter a long position based on moving averages in a candle chart (I have coded this now), and also as a further condition, when I see two complete Renko bricks in the same direction.

          Many thanks,

          Comment


            #6
            Yes, this is possible with multiseries NinjaScript. They aren't joined by charts, but by code you add in your strategy. You can see a sample through Tools > Edit NinjaScript > Strategy > SampleMultiTime frame.

            Documentation for this is here:


            There is dedicated AddRenko() method to add these series programatically:
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            648 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            369 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            108 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            572 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            574 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X