Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Visual stops and limits

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

    Visual stops and limits

    I have created a few systems using the wizard. Is there a way to display the initial stop and intial limit visually on the chart when the strategy enters a position? Is there a way also to display the trailing stop in real time?

    Can you also assist with this piece of code?
    I wish to exit a long position by using a limit order one ATR(5) from my entry price. ExitLongLimit(ATR(5)[0],'''',""). I am not sure what to use to show entry price.

    Thanks

    #2
    Hi cptrader, to reference the entry price you can use 'Average Position Price' from the 'Strategy' category. Visualizing your stops would unfortunately need custom coding outside of the wizard.

    Comment


      #3
      ATR Initial Stop

      ExitLongStop(Position.AvgPrice - ATR(5)[0] , "", "");

      The above initial stop would be entry price less ATR(5).
      The ATR would be calculated on each new bar. Correct?
      How would I reference the ATR to the entry bar only?

      Comment


        #4
        You would need to store the ATR value in a variable when you enter and then reference this in your order as offset for the stop.

        Comment


          #5
          Stored ATR value

          Thanks for your feedback Bertrum

          I am not entirely sure how to store the ATR value in a variable when you enter. I have included sample code with a stored ATR value of 5.

          private int aTRPeriod = 5; // Default setting for ATRPeriod

          {// Condition set 1
          if (Low[0] > SMA(High, 10)[0])
          {
          EnterLong(DefaultQuantity, "SMAabove");
          }

          // Condition set 2
          if (Position.MarketPosition == MarketPosition.Long)
          {
          ExitLongLimit(Position.AvgPrice + ATR(aTRPeriod)[0] , "SMAaboveExit", "SMAabove");

          Comment


            #6
            Hi cptrader, with storing I meant doing something like this
            Code:
             
            if (Position.MarketPosition == MarketPosition.Long)
            {
            double myATR = ATR(5)[0]; 
            ExitLongLimit(Position.AvgPrice + myATR);
            }
            which I find simply more convenient, but your code should do it also.

            Comment


              #7
              Just to verify since I'm using simple profit and loss stops. Without doing code is there any way to plot say plus and minus 10% from the entry price lines on a chart?

              Comment


                #8
                Unfortunately not bkout, you would need to create an indicator were you enter your entryprice and then you can calculate and display those levels.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by charlesugo_1, 05-26-2026, 05:03 PM
                0 responses
                60 views
                0 likes
                Last Post charlesugo_1  
                Started by DannyP96, 05-18-2026, 02:38 PM
                1 response
                147 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by CarlTrading, 05-11-2026, 05:56 AM
                0 responses
                161 views
                0 likes
                Last Post CarlTrading  
                Started by CarlTrading, 05-10-2026, 08:12 PM
                0 responses
                97 views
                0 likes
                Last Post CarlTrading  
                Started by Hwop38, 05-04-2026, 07:02 PM
                0 responses
                284 views
                0 likes
                Last Post Hwop38
                by Hwop38
                 
                Working...
                X