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 Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                558 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                324 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                101 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                545 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                547 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X