Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

why wont this profit target compile?

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

    why wont this profit target compile?

    protected override void OnBarUpdate()
    {
    SetProfitTarget("", CalculationMode.Ticks, 10/10*ATR(25));

    #2
    Hello James 377,

    This is the error message I get when attempting to compile.

    Operator '*' cannot be applied to operands of type 'int' and 'NinjaTrader.Indicator.ATR' CS0019 - click for info 56 47

    Calculation Mode.Ticks requires an integer, and the value you're inputting is a DataSeries.

    What is it you're looking to do?
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      why is it a series?

      looking to set a profit target which takes a profitfactor and divides by 10 then multiplies by ATR(25). so i can give it a number like 25 which will be 2.5*ATR(25)

      Comment


        #4
        ATR() is a series. To reference a specific value, you need the index [ ] assigned to it.

        You should be able to use:
        SetProfitTarget("", CalculationMode.Ticks, 10/10*ATR(25)[0]);

        The following help guide article on basic NinjaScript syntax may be useful for you.
        http://www.ninjatrader-support.com/HelpGuideV6/BasicSyntax.html
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DynamicTest, Today, 11:18 PM
        0 responses
        3 views
        0 likes
        Last Post DynamicTest  
        Started by dcriador, Today, 01:43 AM
        3 responses
        19 views
        0 likes
        Last Post dcriador  
        Started by smartromain, Today, 10:50 PM
        0 responses
        5 views
        0 likes
        Last Post smartromain  
        Started by popecapllc, 08-09-2023, 07:42 PM
        10 responses
        1,366 views
        0 likes
        Last Post BartMan
        by BartMan
         
        Started by jbays87, Today, 09:46 PM
        0 responses
        6 views
        0 likes
        Last Post jbays87
        by jbays87
         
        Working...
        X