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 aussugardefender, Today, 01:07 AM
          0 responses
          1 view
          0 likes
          Last Post aussugardefender  
          Started by pvincent, 06-23-2022, 12:53 PM
          14 responses
          238 views
          0 likes
          Last Post Nyman
          by Nyman
           
          Started by TraderG23, 12-08-2023, 07:56 AM
          9 responses
          383 views
          1 like
          Last Post Gavini
          by Gavini
           
          Started by oviejo, Today, 12:28 AM
          0 responses
          1 view
          0 likes
          Last Post oviejo
          by oviejo
           
          Started by pechtri, 06-22-2023, 02:31 AM
          10 responses
          125 views
          0 likes
          Last Post Leeroy_Jenkins  
          Working...
          X