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

Best way to manage account

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

    Best way to manage account

    I would like to write a strategy that helps me to stop trading when I am having a bad day.
    I would like to monitor the account value and ultimately found out which are my losses.
    I then need to read the actual overall account cash value and if I am flat, if I have any position open so I know that my numbers are correct.
    What are the proper code instructions tot do this? Any suggestion?
    Maybe I can then later think to differentiate the evaluation based on symbol but this could be a later project.
    Thank You.
    G

    #2
    Hello giogio1,

    Are the entry orders submitted by a fully automated NinjaScript Strategy or are these manually placed orders?

    For a NinjaScript Strategy it is possible to prevent new entries using logic. Below is a link to an example made for NinjaTrader 7.


    If the orders are manually placed orders there are no supported methods to prevent these. My suggestion would be to use a NinjaScript Strategy that adds buttons to the chart. When the button is manually pressed this triggers the strategy to submit the order through the strategy. With this the logic could be in place to decide if the order is submitted.
    Below is a link to an example of submitting orders from a button click through a NinjaScript Strategy.
    This strategy will add buttons to the chart toolbar to sell or buy 1 lot but only when certain condition is true. By default the condition to buy is that Price has to close above the prior two bar. Anything can be changed in the script so each trader can define his own discretionary entry […]



    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you Chelsea. Your answer address two aspects of my question. I am also look into using in the script the functions of SystemPerformance.RealtimeTrade of NT7.
      I would like to get the Cash available in the account and if I have any open position left and possibly also the daily P&L but I want to look at my actual broker account numbers, not what reside in my computer. This script would look into the account numbers regardless of whether the trades were executed manually or via a strategy.
      From that I would follow your suggestion to create appropriate buttons or feed the information into a running strategy.

      In other words I would like to get the main numbers that appear in the Accounts tab and possibly Positions
      tab of the control center from a script.
      Best
      Giogio

      Comment


        #4
        Hello Giogio,

        GetAccountValue() can be used to get the CashValue and RealizedProfitLoss as seen in the Accounts tab of the Control Center.

        Get CashValue() - https://ninjatrader.com/support/help...countvalue.htm

        While not documented/supported in NinjaTrader 7, you could check the Account's Position collection to check open positions on the account. Checking the NinjaTrader 8 documentation can help to give some hints, although we cannot make the same guarantees as the NinjaTrader 8 documentation. What you try should be checked in NT7 to see if it works the same way and can be used for your needs.

        NT8 Account object - https://ninjatrader.com/support/help...ount_class.htm

        NT8 Account Positions collection - https://ninjatrader.com/support/help...ns_account.htm

        NT7 IPosition - https://ninjatrader.com/support/help.../iposition.htm

        Code:
        if (Historical)
            return;
        Print(GetAccountValue(AccountItem.CashValue));
        foreach (IPosition pos in Account.Positions)
        {
            Print(pos.Instrument + " " + pos.MarketPosition);
        }
        We look forward to assisting.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by GussJ, 03-04-2020, 03:11 PM
        16 responses
        3,279 views
        0 likes
        Last Post Leafcutter  
        Started by WHICKED, Today, 12:45 PM
        2 responses
        19 views
        0 likes
        Last Post WHICKED
        by WHICKED
         
        Started by Tim-c, Today, 02:10 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Taddypole, Today, 02:47 PM
        0 responses
        5 views
        0 likes
        Last Post Taddypole  
        Started by chbruno, 04-24-2024, 04:10 PM
        4 responses
        51 views
        0 likes
        Last Post chbruno
        by chbruno
         
        Working...
        X