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 sjsj2732, Yesterday, 04:31 AM
                0 responses
                38 views
                0 likes
                Last Post sjsj2732  
                Started by NullPointStrategies, 03-13-2026, 05:17 AM
                0 responses
                287 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                289 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                134 views
                1 like
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                95 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Working...
                X