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

Strategy Analyzer query- order quantity

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

    Strategy Analyzer query- order quantity

    Hi

    Is there a way with the strategy analyser to backtest a strategy, and set a % of my capital I'd like to risk on every trade, so the backtest results show the $ amount I would make or lose?

    e.g. To input that I have a starting capital amount of $100,000, and I'd like to risk 1% ($1,000) on every trade, across the portfolio that I'm backtesting.

    If my capital went down after a loss to, say, $99,000 I'd like the analyser to still trade 1% of my pot, but this time, it would only be committing $990 on the next trade. If this lost, I'd like the analyser to trade $980. So on, and so forth...

    I'm new to NT and seem to be struggling to program this part in, although it is probably really simple!

    Many thanks
    Steve

    #2
    Hello Steve,

    I put together a sample to demonstrate this.

    The strategy enters trades and uses a 7 tick Stop Loss, with order quantity being dynamic.

    You should set the bool isBacktest to true if you'd like to input your starting account size, and test the strategy historically, otherwise if its set to false the strategy will only run in real time and your account size will be pulled from NT Sim 101 account.

    The strategy will adjust the trade size based on account size value.

    Please let us know if you need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by bmartz, 03-12-2024, 06:12 AM
    4 responses
    32 views
    0 likes
    Last Post bmartz
    by bmartz
     
    Started by Aviram Y, Today, 05:29 AM
    4 responses
    12 views
    0 likes
    Last Post Aviram Y  
    Started by algospoke, 04-17-2024, 06:40 PM
    3 responses
    28 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by gentlebenthebear, Today, 01:30 AM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by cls71, Today, 04:45 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X