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 ender_wiggum, Today, 09:50 AM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by rajendrasubedi2023, Today, 09:50 AM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by geotrades1, Today, 10:02 AM
          0 responses
          4 views
          0 likes
          Last Post geotrades1  
          Started by bmartz, Today, 09:30 AM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by geddyisodin, Today, 05:20 AM
          3 responses
          25 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X