Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

calculate on first instrument and execute on second instrument

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

    calculate on first instrument and execute on second instrument

    Hi, I have an issue for a simple test code.
    I want to generate signal on first instrument and anter trade on second of this code:

    protected override void Initialize()
    {
    CalculateOnBarClose = true;
    Add("ES ##-##", PeriodType.Minute, 20);
    }
    protected override void OnBarUpdate()
    {

    if (BarsInProgress == 0)
    return;

    //if this condition is verified
    if (CrossBelow(SMA(1), Bollinger(2, 14).Lower, 1)
    {
    //enter long on second instrument
    }

    thanks again!

    #2
    kantkant2, you would then need to use the advanced overload for EnterLong() that would let you specify the BarsInProgress you want to submit when your signal is seen.



    So try something like this please -

    EnterLong(1, DefaultQuantity, "LongBIP1")
    BertrandNinjaTrader Customer Service

    Comment


      #3
      thanks Bertrand, now the entry logic works but the exits are incorrect....
      I don't understand the "fromentrysignal" concept...
      I have trie with:
      ExitLong(1, DefaultQuantity, "LongBIP1", "");

      but work wrong...

      Comment


        #4
        I would suggest trying this changed call instead -

        ExitLong(1, DefaultQuantity, "ExitLongBIP1", "LongBIP1");

        With the fromEntrySignal you can tie the qty to a specific entry you've done. The first string here would be your exit signal name then, thus you would have to switch them around like above.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          now the backtest works fine!
          Today I have enabled the strategy on live account...
          the strategy run on fdax future, the orders are sent on cfd dax to fxcm... the position was open and close correctly, but I note a "PendingSubmit" order on orders list, referred to exit signal....what does it mean??
          thanks

          Comment


            #6
            Hello kantkant2,

            It looks like there is an order that is stuck. Is this order on your live account? If so, you may want to call your broker to make sure there is not an order.

            After you have verified that you may repair your database to remove the order from NinjaTrader.

            To repair your database please go to Tools -> Options -> Data -> and click Repair DB.
            If this does not remove the order then the order will be removed when your broker resets their servers.

            Note that if the order was submitted to the Sim101 account, you may just want to reset the Sim101 account to remove the order.

            To reset the Sim101 account please go to Tools -> Options -> Simulator tab -> and click Reset.

            Happy to be of further assistance.
            JCNinjaTrader Customer Service

            Comment


              #7
              yes, is on my live account.
              on broker platform I don't see any order.... now after clicking repair db button it seems disappeared... but I don't know why this issue become...
              thanks again ninja support!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by rdtdale, Today, 01:02 PM
              0 responses
              3 views
              0 likes
              Last Post rdtdale
              by rdtdale
               
              Started by alifarahani, Today, 09:40 AM
              3 responses
              15 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by RookieTrader, Today, 09:37 AM
              4 responses
              18 views
              0 likes
              Last Post RookieTrader  
              Started by PaulMohn, Today, 12:36 PM
              0 responses
              8 views
              0 likes
              Last Post PaulMohn  
              Started by love2code2trade, 04-17-2024, 01:45 PM
              4 responses
              41 views
              0 likes
              Last Post love2code2trade  
              Working...
              X