Skip to content

Symbol.PipsForProportionalRisk

method · Symbol · cAlgo.API.Internals

DesktopCLICloud

Calculates the stop loss (in pips) for the proportional amount to be risked based on the specified volume. Note that the result of this calculation may be imprecise as the exact degree of risk always depends on market movement and is impossible to predict.

Definition

double PipsForProportionalRisk(ProportionalAmountType type, double percentage, double volume)
api.Symbol.PipsForProportionalRisk(type: ProportionalAmountType, percentage: float, volume: float) -> float

Parameters

Name C# type Python type Description
type ProportionalAmountType ProportionalAmountType The type of the amount to be risked (either balance or equity).
percentage double float The percentage of equity or balance to be risked.
volume double float The volume to be traded.

Returns double — The calculated stop loss in pips.

Examples

using cAlgo.API;

namespace cAlgo.Robots;

public partial class TestExample : Robot
{
    protected override void OnStart()
    {
        var tradeVolume = Symbol.VolumeInUnitsMin;
        var riskPercentage = 1;

        var stopLossInPips = Symbol.PipsForProportionalRisk(ProportionalAmountType.Equity, riskPercentage, tradeVolume);

        Print($"If you trade {tradeVolume} with a risk of losing {riskPercentage}% of your account equity you should use {stopLossInPips} Pips as your StopLoss");
    }
}
import clr

clr.AddReference("cAlgo.API")

# Import cAlgo API types
from cAlgo.API import *

# Import trading wrapper functions
from robot_wrapper import *

class Test():
    def on_start(self):
        tradeVolume = api.Symbol.VolumeInUnitsMin
        riskPercentage = 1
        stopLossInPips = api.Symbol.PipsForProportionalRisk(ProportionalAmountType.Equity, riskPercentage, tradeVolume)
        print(f"If you trade {tradeVolume} with a risk of losing {riskPercentage}% of your account equity you should use {stopLossInPips} Pips as your StopLoss")
{
  "AccessRights": "None"
}