position sizing for volatility

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #124743 quote
    Dr ManhattanDr Manhattan
    Participant
    Senior

    Speaking about volatility and position sizing I usually just take:

    atr = averageTrueRange[20](Close)
    positionsize = account / (atr)

    and make some number up in account to fit that particular market. Anyone else have some nice algorithm for position sizing for volatility?

    #145266 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    This one I almost always use:

    ONCE nLots                   = 1
    ONCE LotManagement           = 0      //1=enable LOT size management
    ONCE NeverDecrease           = 1      //1=do not decrease lot size when losing,
    //                                      0=decrease lot size according to strategyprofit
    ONCE MinLots                 = 1      //1   Min lots allowed
    ONCE MaxLots                 = 99     //99  Max lots allowed
    ONCE MyDrawDown              = 200    //200 DrawDown as from backtest
    ONCE MyMargin                = 70     //70  Margin required
    ONCE DD                      = 3      //3   DrawDown multiplier
    Capital                      = (MyMargin + (MyDrawDown * DD)) * nLots
    Equity                       = Capital + StrategyProfit
    IF LotManagement = 1 AND BarIndex > 0 THEN
       nLots                     = max(MinLots,min(MaxLots,Equity / Capital))
       IF NeverDecrease = 1 THEN
          nLots                  = max(nLots,nLots[1])
       ENDIF
    ENDIF
    
    • Line  1:     Number of lots (default)
    • Line  2:    1=lot management enabled, 0=disabled
    • Line  3:    1=do not decrease after a loss,  0=decrease the number of lots after a loss
    • line   5:    Minimum lots allowed (can be < 1, if allowed by your broker)
    • line   6:    Maximum lots allowed
    • line   7:    DrawDown show by backtest
    • line   8:    Margin required by the broker
    • line   9:    DrawDown Multiplier (3 is the value I use by default)

    You should start with line 2 se to 0 (lot management disabled), until you have finished optimizing, then write the correct value at lines 7 and 8 and backtest it again to save it and see the results.

    You should backtest using a CAPITAL that is exactly (rounded) the one calculated at line 10 (nLots used here is the initial lot size set at line 1).

    nLots is the number of lots you want to BUY/SELLAHORT.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

position sizing for volatility


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzirobertogozzi
6 years ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/05/2020
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...