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 algospoke, Yesterday, 06:40 PM
    2 responses
    18 views
    0 likes
    Last Post algospoke  
    Started by ghoul, Today, 06:02 PM
    3 responses
    14 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by jeronymite, 04-12-2024, 04:26 PM
    3 responses
    44 views
    0 likes
    Last Post jeronymite  
    Started by Barry Milan, Yesterday, 10:35 PM
    7 responses
    20 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by AttiM, 02-14-2024, 05:20 PM
    10 responses
    180 views
    0 likes
    Last Post jeronymite  
    Working...
    X