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 Haiasi, 04-25-2024, 06:53 PM
          2 responses
          16 views
          0 likes
          Last Post Massinisa  
          Started by Creamers, Today, 05:32 AM
          0 responses
          4 views
          0 likes
          Last Post Creamers  
          Started by Segwin, 05-07-2018, 02:15 PM
          12 responses
          1,785 views
          0 likes
          Last Post Leafcutter  
          Started by poplagelu, Today, 05:00 AM
          0 responses
          3 views
          0 likes
          Last Post poplagelu  
          Started by fx.practic, 10-15-2013, 12:53 AM
          5 responses
          5,407 views
          0 likes
          Last Post Bidder
          by Bidder
           
          Working...
          X