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

Order quantity based on risk

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

    Order quantity based on risk

    Not really a technical question, just hoping someone can help me figure out the math here, it's got me utterly confused...

    What I'm trying to do is have my strategy define order size (forex) based on a risk in USD. Let's say the ammount I'm willing to risk on any trade is USD$100.

    Risk would be the stoploss amount; let's say I'm using ATR*2.

    -What would be the formula for currency pairs involving USD (EURUSD/USDJPY...)?

    -What would be the formula for pairs not involving USD (Say EURJPY)? I assume I will need to use the EUR/USD exchange rate, or the USD/JPY exchange rate, or both?

    Any help would be appreciated!

    #2
    Hello Marktheshark,

    Thank you for your note.

    If your risk is your Entry minus your stop, times your trade size,

    Code:
    (Entry-Stop)*TradeSize=Risk
    Then, if my math is correct,

    Code:
    TradeSize = Risk / (Entry-Stop)
    An example,

    You buy EUR/USD at 1.1700, the ATR is at 1.1600 and you wish to risk $100.

    Code:
    TradeSize = $100 / (1.1700-1.1600)
    You would then trade a size of 10,000.

    I highly suggest doing your own research into whether this is correct.

    Regarding the EUR/JPY ratio, I would suggest searching the net for Cross Currency trades along with how to calculate the stop point.

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

    Comment


      #3
      Thank you for your help - I figured it out.

      I realise this is basic stuff but in case anyone is interested, this is what I did:

      double PipValueUSD = (1/ExchangeRate);
      double StopLossValueUSD = 2*ATR1[1]*PipValueUSD;
      double OrderSize_double = 100/StopLossValueUSD;
      int OrderSize = (int)OrderSize_double;
      ExchangeRate is a configurable parameter in my strategy. The value should be the exchange rate of the USD to the second currency in the pair. For trading EURAUD, use the USDAUD value (1.4). For EURJPY use 111. For pairs with USD as second currency, enter 1.

      The "100" is the risk in USD I'm willing to take on the trade.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by algospoke, 04-17-2024, 06:40 PM
      5 responses
      45 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by arvidvanstaey, Today, 02:19 PM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Zachary  
      Started by mmckinnm, Today, 01:34 PM
      3 responses
      5 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by f.saeidi, Today, 01:32 PM
      2 responses
      8 views
      0 likes
      Last Post f.saeidi  
      Started by alifarahani, 04-19-2024, 09:40 AM
      9 responses
      55 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X