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

Email for order pending/fill/target/stop

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

    #46
    Where have you commented out the variable? You should not be commenting the line in Variables region of your code, but rather the one here:

    Code:
    // If the order state is terminal, reset the order id value
                        if (status[2] == "Filled" || status[2] == "Cancelled" || status[2] == "Rejected")
                        {
                            orderId = string.Empty;
                            SendMail("[email protected]", "[email protected]", "Order", status[2]);
                        }
                    }
                } // If the strategy has terminated reset the strategy id
    else if (atmStrategyId.Length > 0 && GetAtmStrategyMarketPosition(atmStrategyId) == Cbi.MarketPosition.Flat)
    [B][COLOR=Red]                 atmStrategyId = string.Empty;[/COLOR][/B]
    Josh P.NinjaTrader Customer Service

    Comment


      #47
      I tried this, added an new print at the bottom:

      if (atmStrategyId.Length > 0)
      {
      // Print some information about the strategy to the output window
      Print("The current ATM Strategy market position is: " + GetAtmStrategyMarketPosition(atmStrategyId));
      Print("The current ATM Strategy position quantity is: " + GetAtmStrategyPositionQuantity(atmStrategyId));
      Print("The current ATM Strategy average price is: " + GetAtmStrategyPositionAveragePrice(atmStrategyId)) ;
      Print("The current ATM Strategy Unrealized PnL is: " + GetAtmStrategyUnrealizedProfitLoss(atmStrategyId)) ;
      Print("GetAtmStrategyStopTargetOrderStatus: " + GetAtmStrategyStopTargetOrderStatus("Target1", atmStrategyId));

      The output window prints this:

      GetAtmStrategyStopTargetOrderStatus: System.String[,]

      Comment


        #48
        Originally posted by NinjaTrader_Josh View Post
        Where have you commented out the variable? You should not be commenting the line in Variables region of your code, but rather the one here:

        Code:
        // If the order state is terminal, reset the order id value
                            if (status[2] == "Filled" || status[2] == "Cancelled" || status[2] == "Rejected")
                            {
                                orderId = string.Empty;
                                SendMail("[email protected]", "[email protected]", "Order", status[2]);
                            }
                        }
                    } // If the strategy has terminated reset the strategy id
        else if (atmStrategyId.Length > 0 && GetAtmStrategyMarketPosition(atmStrategyId) == Cbi.MarketPosition.Flat)
        [B][COLOR=Red]                 atmStrategyId = string.Empty;[/COLOR][/B]
        I did that and now in the output window there is not detailed info:

        The current ATM Strategy market position is: Flat
        The current ATM Strategy position quantity is: 0
        The current ATM Strategy average price is: 0
        The current ATM Strategy Unrealized PnL is: 0
        GetAtmStrategyStopTargetOrderStatus: System.String[,]


        Typically has this info:

        The current ATM Strategy market position is: Long
        The current ATM Strategy position quantity is: 10
        The current ATM Strategy average price is: 936.75
        The current ATM Strategy Unrealized PnL is: -625
        GetAtmStrategyStopTargetOrderStatus: System.String[,]
        Last edited by m3power222; 06-26-2009, 12:15 PM. Reason: More

        Comment


          #49
          m3power222,

          Not following you. You need to make sure your collections are not empty. If they are empty for sure you will get no prints. You should also be checking your Control Center logs for errors.

          I suggest you go back to SampleAtmStrategy and see how it works with the Output Window.
          Josh P.NinjaTrader Customer Service

          Comment


            #50
            Sort of got something working with this:

            if (atmStrategyId.Length > 0)
            SendMail("email", "email", "Target", "Realized PnL is: " + GetAtmStrategyRealizedProfitLoss(atmStrategyId).To String());

            I get a email on every single bar ending. I only want a email when it's > 0 or < 0. Can it be done? Tried a few different things but got compile errors saying CS0019.

            Strings cannot be compared with relational operators (<, >, <=, >=, ==, !=) to other object types. Strings can only be compared to other strings and only through the use of equality operators (==, !=).

            Comment


              #51
              m3power222, we would need to see the code that you're currently working on - also atmStrategyId.Length > 0 just checks for a valid ATM strategy id being used...so to get the status email not on every OnBarUpdate() you might want to limit with time filters to send an update for example each 30mins...
              BertrandNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Rapine Heihei, 04-23-2024, 07:51 PM
              2 responses
              30 views
              0 likes
              Last Post Max238
              by Max238
               
              Started by Shansen, 08-30-2019, 10:18 PM
              24 responses
              943 views
              0 likes
              Last Post spwizard  
              Started by Max238, Today, 01:28 AM
              0 responses
              9 views
              0 likes
              Last Post Max238
              by Max238
               
              Started by rocketman7, Today, 01:00 AM
              0 responses
              7 views
              0 likes
              Last Post rocketman7  
              Started by wzgy0920, 04-20-2024, 06:09 PM
              2 responses
              28 views
              0 likes
              Last Post wzgy0920  
              Working...
              X