Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Base profit target and stop limits on bar size

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

    Base profit target and stop limits on bar size

    Is there a method that reports out the bar size (and type) being used which will allow a strategy to automatically set stops and profit targets based on the tick size of the bar? (I'm thinking range, or renko type bars in this case.)

    #2
    Daven,

    Thank you for your post.

    You would want to take a look at BarsPeriod for getting this value -
    http://www.ninjatrader.com/support/h...barsperiod.htm
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      I tried the following construct but it doesn't print out any values so I'm thinking I am using the incorrect syntax:

      Code:
      protected override void OnBarUpdate()
      {
         if (BarsInProgress == 1)
           {
           Profit = BarsPeriod.Value;
           Stop = BarsPeriod.Value;
           Print ("Profit is  "  + Profit   +  "Stop is  "  + Stop);
           }

      Comment


        #4
        Daven,

        What is your additional data series that you adding to the script?
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          My bad. I thought BarsInProgress was CurrentBar. I changed the value to 0 since there is only one data set in the strategy and it is working as expected.
          Thanks for your help.
          DaveN

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          65 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          41 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          23 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          26 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          52 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X