public _2ProfitTargets(double _stoplossperunit, double _profit1perunit, double _profit2perunit, TargetExitQuantity _target1exitquantity, TargetExitQuantity _target2exitquantity) { stoplossperunit = _stoplossperunit; profit1perunit = _profit1perunit; profit2perunit = _profit2perunit; target1exitquantity = _target1exitquantity; target2exitquantity = _target2exitquantity; }
public int Units(TargetExitQuantity teq) { if (teq == TargetExitQuantity.Half) { return(Math.Max(1, (int)(units / 2))); } if (teq == TargetExitQuantity.None) { return(0); } if (teq == TargetExitQuantity.OneThird) { return(Math.Max(1, (int)(units / 3))); } if (teq == TargetExitQuantity.ThreeQuarters) { return(Math.Max(1, (int)(3 * units / 4))); } return(units); }