Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator compiles but strategy gives compile error

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

    Indicator compiles but strategy gives compile error

    Need help with a compile problem. This code below compiles but once in strategy it throws a compile error and goes into recursive loop of throwing errors. Meaning scripts wont compile and neither will strategy. does not give a specific script error but gives in strategy error screenshot below. Before including in strategy the script compiles fine. I have to delete the strategy then everything compiles until i include it in the strategy again that again throws compile error.

    protected override void OnBarUpdate()
    {
    //zero[0]= 0;
    if (CurrentBar < Period)
    return;


    double lowerTimeAvg = EMA(LowerTimeSlope)[0];
    double higherTimeAvg = EMA(HigherTimeSlope)[0];

    double heightslope = lowerTimeAvg - higherTimeAvg;

    double angleBetweenAvg = (Math.Atan(heightslope / (Period * interval)) * convert);




    double slopeAvgLower = EMA(slopeAvg,LowerTimeSlope)[0];
    double slopeAvgHigher = EMA(slopeAvg,HigherTimeSlope)[0];
    double heightslopeofslope = slopeAvgLower - slopeAvgHigher;
    double angleBetweenSlopes = (Math.Atan(heightslopeofslope / (Period * interval)) * convert);

    EMA slopeofSlopeAvg = EMA((int)angleBetweenSlopes);

    SlopeLine[0] = angleBetweenAvg;




    if(IsRising(Value))
    {
    //if(ColorSlope)
    PlotBrushes[0][0] = UpColor;
    }
    if(IsFalling(Value))
    //if(degreesOutput1 < degreesOutput2)
    {
    //if(ColorSlope)
    PlotBrushes[0][0] = DnColor;
    }

    Attached Files

    #2
    Hello rocketstock,

    Thanks for your post.

    All scripts are compiled into the NinjaTrader.Custom.dll assembly. If there are errors in a script that is not open, you will see orange colored errors. If there are errors in a script that is currently in view, the errors will be beige.

    The errors you see are from a script called demand.cs. You can double click on the error to open that script and be brought to the lines of code that are generating the errors so you can correct them, or you can right click in the error list and select Exclude From Compilation to exclude that script from compilation.

    The errors mention brackets are used on a type that cannot be indexed.

    Please let us know if there is anything else we can do to help.

    Comment


      #3
      Hi Jim,

      demand.cs is strategy script. when i click the orange error it does not open any script. the code above is a ninja script that used by demand.cs. there seems to be a runtime error in strategy script.
      Attached Files

      Comment


        #4
        Hello rocketstock,

        These are compile errors. A runtime error would be encountered after the scripts are compiled and then the script hits a programming error when it is executing.

        Did you single click or double click on the errors to see the code that generates the errors?

        Did you try right clicking and selecting Exclude from Compilation to prevent the the system from compiling the script which contains syntax errors?

        Do you see demand.cs when you look in the Documents\NinjaTrader 8\bin\Custom folder? Please check within the subfolders here to find this script. You may remove the file to get the system compiling, or you can correct the syntax errors.

        We look forward to assisting.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        566 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        330 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        547 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        548 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X