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 fx.practic, 10-15-2013, 12:53 AM
          5 responses
          5,404 views
          0 likes
          Last Post Bidder
          by Bidder
           
          Started by Shai Samuel, 07-02-2022, 02:46 PM
          4 responses
          95 views
          0 likes
          Last Post Bidder
          by Bidder
           
          Started by DJ888, Yesterday, 10:57 PM
          0 responses
          8 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by MacDad, 02-25-2024, 11:48 PM
          7 responses
          160 views
          0 likes
          Last Post loganjarosz123  
          Started by Belfortbucks, Yesterday, 09:29 PM
          0 responses
          9 views
          0 likes
          Last Post Belfortbucks  
          Working...
          X