Risk Management – Variable Position Size

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #247615 quote
    titleist311
    Participant
    New

    Hi everyone,

    I have a question regarding my PRT Code.  I wanted to define the position size so that the same risk in terms of $ value applies for each trade. Once I perform a backtest the position size varies and most of the time it is doing what it should. But there is also a significant number of exceptions where the result deviates too much from the original intention with 1:1 Risk/Reward.

    Please find below the code and attached also a picture of the results with yellow marked deviations.

    SL = (High - Low)
    R = 500
    Tickvalue = 2
    OrderQty = Round ((R / SL) / Tickvalue),0)
    
    //Conditions for Direction Short
    IF .... THEN
    Direction = -1
    ENDIF
    
    IF NOT OnMarket AND Direction = -1 THEN
    SELLSHORT OrderQty CONTRACT AT (Low - 0.25*pipsize) Stop
    SET STOP PLOSS (SL)*pipsize
    InitialSL = SL
    ENDIF
    
    //Exit Short 1:1
    IF ShortOnMarket THEN
    SET STOP PLOSS (1*InitialSL)
    SET TARGET PPROFIT (1*InitialSL)
    ENDIF

    The average position size is like 10-15 contracts, so it is not the problem that it is only 1 contract.

    What is wrong in my code and what can I do better in order to have a proper position size for risk/reward calculation?

    Thank you very much for your support.

    Best regards

    Simon

    #247649 quote
    JS
    Participant
    Senior

    Hi Simon,

    In “Risk Management,” it’s common practice to risk only 1% of your capital per trade and base your position size on this, for example:

    // Money Management

    Capital = 10000 Risk = 0.01 StopLoss = 10

    // Calculate number of contracts

    Equity = Capital + StrategyProfit

    MaxRisk = round(Equity * Risk)

    PositionSize = abs(round((MaxRisk / StopLoss) / PointValue) * pipsize)

    A lot has already been written on the forum about money/risk management, and if you check the library or search for “money management,” you’ll find plenty of useful information…

    robertogozzi and Iván González thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Risk Management – Variable Position Size


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by JS
8 months, 3 weeks ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/26/2025
Status: Active
Attachments: No files
Logo Logo
Loading...