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

Multi Instrument Strategy need help.

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

    Multi Instrument Strategy need help.

    Hi. I am trying to use the linear slope indicator from ^SP500 on to other script chart. Could you please check what is wrong with the below code. When I use the script on the same ^SP500 chart any time frame, it works. But doesn't when I put it on the chart of a different script. I have also attached the full script. Thanks.


    else if (State == State.Configure)
    {
    AddDataSeries("^SP500", Data.BarsPeriodType.Tick, 4, Data.MarketDataType.Last);
    }
    else if (State == State.DataLoaded)
    {
    LinRegSlope1 = LinRegSlope(BarsArray[1], 14);
    }
    }

    protected override void OnBarUpdate()
    {
    if (BarsInProgress == 0)
    {


    // Set 1
    if (LinRegSlope1[0] > 0)
    {
    EnterLong(Convert.ToInt32(DefaultQuantity), "");
    }

    // Set 2
    if (LinRegSlope1[0] < 0)
    {
    ExitLong(Convert.ToInt32(DefaultQuantity), "", "");
    }
    }
    Attached Files

    #2
    Hello victorNT,

    You will need to look for any runtime errors on the Log tab of the Control Center, then you will need to enabled TraceOrders and print all values used in the conditions, with lables, and with the time of the bar.

    This debugging process is necessary anytime a script is not behaving as you expect.

    Below are links to the help guide on TraceOrders and Print().



    Below is a link to a forum post that demonstrates using prints to understand behavior.


    Are there errors appearing on the Log tab of the Control Center?

    I am happy to assist with analyzing the output from TraceOrders and prints if you would like to save these to a text file and post this with your next post.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      My Bad. The plots and markers were set off. Thanks much.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by yertle, Yesterday, 12:24 PM
      1 response
      10 views
      0 likes
      Last Post yertle
      by yertle
       
      Started by Mr Bread, Today, 04:25 AM
      2 responses
      9 views
      0 likes
      Last Post Mr Bread  
      Started by kandise, Today, 09:41 AM
      0 responses
      2 views
      0 likes
      Last Post kandise
      by kandise
       
      Started by Mubeen Haider, Today, 09:41 AM
      0 responses
      5 views
      0 likes
      Last Post Mubeen Haider  
      Started by nicbizz, Today, 09:02 AM
      0 responses
      7 views
      0 likes
      Last Post nicbizz
      by nicbizz
       
      Working...
      X