/// <summary> /// Calculate Trade Risk/Reward Ratio and Position Sizing /// </summary> /// <returns></returns> public Indicator.a1RiskReward_v2 a1RiskReward_v2(Data.IDataSeries input, int fixedShares, FXLotsType lotsType, double userAcctRisk, double userAcctSize, double userDollarRisk) { if (InInitialize && input == null) throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method"); return _indicator.a1RiskReward_v2(input, fixedShares, lotsType, userAcctRisk, userAcctSize, userDollarRisk); }
public Indicator.a1RiskReward_v2 a1RiskReward_v2(int fixedShares, FXLotsType lotsType, double userAcctRisk, double userAcctSize, double userDollarRisk) { return _indicator.a1RiskReward_v2(Input, fixedShares, lotsType, userAcctRisk, userAcctSize, userDollarRisk); }
/// <summary> /// Calculate Trade Risk/Reward Ratio and Position Sizing /// </summary> /// <returns></returns> public a1RiskReward_v2 a1RiskReward_v2(Data.IDataSeries input, int fixedShares, FXLotsType lotsType, double userAcctRisk, double userAcctSize, double userDollarRisk) { if (cachea1RiskReward_v2 != null) for (int idx = 0; idx < cachea1RiskReward_v2.Length; idx++) if (cachea1RiskReward_v2[idx].FixedShares == fixedShares && cachea1RiskReward_v2[idx].LotsType == lotsType && Math.Abs(cachea1RiskReward_v2[idx].UserAcctRisk - userAcctRisk) <= double.Epsilon && Math.Abs(cachea1RiskReward_v2[idx].UserAcctSize - userAcctSize) <= double.Epsilon && Math.Abs(cachea1RiskReward_v2[idx].UserDollarRisk - userDollarRisk) <= double.Epsilon && cachea1RiskReward_v2[idx].EqualsInput(input)) return cachea1RiskReward_v2[idx]; lock (checka1RiskReward_v2) { checka1RiskReward_v2.FixedShares = fixedShares; fixedShares = checka1RiskReward_v2.FixedShares; checka1RiskReward_v2.LotsType = lotsType; lotsType = checka1RiskReward_v2.LotsType; checka1RiskReward_v2.UserAcctRisk = userAcctRisk; userAcctRisk = checka1RiskReward_v2.UserAcctRisk; checka1RiskReward_v2.UserAcctSize = userAcctSize; userAcctSize = checka1RiskReward_v2.UserAcctSize; checka1RiskReward_v2.UserDollarRisk = userDollarRisk; userDollarRisk = checka1RiskReward_v2.UserDollarRisk; if (cachea1RiskReward_v2 != null) for (int idx = 0; idx < cachea1RiskReward_v2.Length; idx++) if (cachea1RiskReward_v2[idx].FixedShares == fixedShares && cachea1RiskReward_v2[idx].LotsType == lotsType && Math.Abs(cachea1RiskReward_v2[idx].UserAcctRisk - userAcctRisk) <= double.Epsilon && Math.Abs(cachea1RiskReward_v2[idx].UserAcctSize - userAcctSize) <= double.Epsilon && Math.Abs(cachea1RiskReward_v2[idx].UserDollarRisk - userDollarRisk) <= double.Epsilon && cachea1RiskReward_v2[idx].EqualsInput(input)) return cachea1RiskReward_v2[idx]; a1RiskReward_v2 indicator = new a1RiskReward_v2(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.FixedShares = fixedShares; indicator.LotsType = lotsType; indicator.UserAcctRisk = userAcctRisk; indicator.UserAcctSize = userAcctSize; indicator.UserDollarRisk = userDollarRisk; Indicators.Add(indicator); indicator.SetUp(); a1RiskReward_v2[] tmp = new a1RiskReward_v2[cachea1RiskReward_v2 == null ? 1 : cachea1RiskReward_v2.Length + 1]; if (cachea1RiskReward_v2 != null) cachea1RiskReward_v2.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cachea1RiskReward_v2 = tmp; return indicator; } }
/// <summary> /// Calculate Trade Risk/Reward Ratio and Position Sizing /// </summary> /// <returns></returns> public Indicator.a1RiskReward_v2 a1RiskReward_v2(Data.IDataSeries input, int fixedShares, FXLotsType lotsType, double userAcctRisk, double userAcctSize, double userDollarRisk) { if (InInitialize && input == null) { throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method"); } return(_indicator.a1RiskReward_v2(input, fixedShares, lotsType, userAcctRisk, userAcctSize, userDollarRisk)); }
public Indicator.a1RiskReward_v2 a1RiskReward_v2(int fixedShares, FXLotsType lotsType, double userAcctRisk, double userAcctSize, double userDollarRisk) { return(_indicator.a1RiskReward_v2(Input, fixedShares, lotsType, userAcctRisk, userAcctSize, userDollarRisk)); }
/// <summary> /// Calculate Trade Risk/Reward Ratio and Position Sizing /// </summary> /// <returns></returns> public a1RiskReward_v2 a1RiskReward_v2(Data.IDataSeries input, int fixedShares, FXLotsType lotsType, double userAcctRisk, double userAcctSize, double userDollarRisk) { if (cachea1RiskReward_v2 != null) { for (int idx = 0; idx < cachea1RiskReward_v2.Length; idx++) { if (cachea1RiskReward_v2[idx].FixedShares == fixedShares && cachea1RiskReward_v2[idx].LotsType == lotsType && Math.Abs(cachea1RiskReward_v2[idx].UserAcctRisk - userAcctRisk) <= double.Epsilon && Math.Abs(cachea1RiskReward_v2[idx].UserAcctSize - userAcctSize) <= double.Epsilon && Math.Abs(cachea1RiskReward_v2[idx].UserDollarRisk - userDollarRisk) <= double.Epsilon && cachea1RiskReward_v2[idx].EqualsInput(input)) { return(cachea1RiskReward_v2[idx]); } } } lock (checka1RiskReward_v2) { checka1RiskReward_v2.FixedShares = fixedShares; fixedShares = checka1RiskReward_v2.FixedShares; checka1RiskReward_v2.LotsType = lotsType; lotsType = checka1RiskReward_v2.LotsType; checka1RiskReward_v2.UserAcctRisk = userAcctRisk; userAcctRisk = checka1RiskReward_v2.UserAcctRisk; checka1RiskReward_v2.UserAcctSize = userAcctSize; userAcctSize = checka1RiskReward_v2.UserAcctSize; checka1RiskReward_v2.UserDollarRisk = userDollarRisk; userDollarRisk = checka1RiskReward_v2.UserDollarRisk; if (cachea1RiskReward_v2 != null) { for (int idx = 0; idx < cachea1RiskReward_v2.Length; idx++) { if (cachea1RiskReward_v2[idx].FixedShares == fixedShares && cachea1RiskReward_v2[idx].LotsType == lotsType && Math.Abs(cachea1RiskReward_v2[idx].UserAcctRisk - userAcctRisk) <= double.Epsilon && Math.Abs(cachea1RiskReward_v2[idx].UserAcctSize - userAcctSize) <= double.Epsilon && Math.Abs(cachea1RiskReward_v2[idx].UserDollarRisk - userDollarRisk) <= double.Epsilon && cachea1RiskReward_v2[idx].EqualsInput(input)) { return(cachea1RiskReward_v2[idx]); } } } a1RiskReward_v2 indicator = new a1RiskReward_v2(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.FixedShares = fixedShares; indicator.LotsType = lotsType; indicator.UserAcctRisk = userAcctRisk; indicator.UserAcctSize = userAcctSize; indicator.UserDollarRisk = userDollarRisk; Indicators.Add(indicator); indicator.SetUp(); a1RiskReward_v2[] tmp = new a1RiskReward_v2[cachea1RiskReward_v2 == null ? 1 : cachea1RiskReward_v2.Length + 1]; if (cachea1RiskReward_v2 != null) { cachea1RiskReward_v2.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cachea1RiskReward_v2 = tmp; return(indicator); } }