Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Working with second instrument

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

    Working with second instrument

    Could you please explain what are the options of trading the second instrument (AAPL) on the first one (MSFT)?
    I tried to create a very simple one with Advanced Order Handling, but it does not work.. Could you help me figure our what is wrong?

    protected override void Initialize()
    {
    Add("AAPL", PeriodType.Minute, 1);
    CalculateOnBarClose = true;
    }
    private IOrder entryOrder = null;
    protected override void OnBarUpdate()
    {
    if (BarsInProgress == 0)
    {
    if (CrossAbove(SMA(5), SMA(10), 1)
    if (entryOrder == null)
    entryOrder = EnterLong(1, 100, "AAPLOrder");
    }
    }


    Thank you.

    #2
    Hello,

    Thank you for the question.

    Can you please clarify what you mean by "it does not work"? Are you not seeing results, or getting an error?

    I ran the paste and saw two executions in the historical when loaded on a 1 minute MSFT chart. These were placed on AAPL so it appears to have worked at least once.

    Can you please clarify is this the same result and the question is the number of results or is there a different result on your end?

    I look forward to being of further assistance.

    Comment


      #3
      I do not see any trades, any action, by the strategy. I test it in Market Replay, together with other straight forward strategies. Others work, but this one, though can be enabled, does not trigger anything... I tried other instruments, and an index as a primary instrument... still nothing...

      Do you know what I should look at? to figure out what is the reason it does not work?

      Thank you.

      Comment


        #4
        Hello,

        You would need to debug your strategy to find the cause as to why it is not trading.

        We have some basics listed in this post regarding debugging: http://ninjatrader.com/support/forum...ead.php?t=3418

        Prints are a good starting point to see if your conditions are happening or to print the values your conditions use. This will tell you what is happening each time you think it should happen.

        I would suggest start with printing values or before and during conditions to see where the logic is being missed and that should give you a good direction to start looking.

        I look forward to being of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        558 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 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
        545 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X