Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JimNinjaTrader Customer Service

    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.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by sylviannyc, Today, 09:07 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Started by warpinator, 05-16-2024, 10:44 AM
        4 responses
        35 views
        0 likes
        Last Post warpinator  
        Started by Grantx, 05-31-2020, 06:49 AM
        6 responses
        1,380 views
        0 likes
        Last Post TrueFlowTrading  
        Started by Shai Samuel, 05-02-2023, 01:32 AM
        8 responses
        127 views
        0 likes
        Last Post giulyko00  
        Started by suraj, 05-18-2024, 08:51 AM
        3 responses
        19 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X