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 madb123, Today, 04:03 AM
        0 responses
        5 views
        0 likes
        Last Post madb123
        by madb123
         
        Started by pjsmith, Today, 03:29 AM
        0 responses
        8 views
        0 likes
        Last Post pjsmith
        by pjsmith
         
        Started by PatientTrader, 02-05-2009, 10:46 PM
        3 responses
        2,608 views
        0 likes
        Last Post pjsmith
        by pjsmith
         
        Started by joergtomann, 02-09-2025, 03:29 AM
        2 responses
        37 views
        0 likes
        Last Post joergtomann  
        Started by jm_test19, Yesterday, 10:20 PM
        0 responses
        8 views
        0 likes
        Last Post jm_test19  
        Working...
        X