money management double to float
money management double to float
07 Jul 2015, 17:28
[Parameter(DefaultValue = 1, MinValue = 0.1)]
public double Faktor { get; set; }
[Parameter(DefaultValue = 10, MinValue = 1)]
public double SL { get; set; }
protected override void OnStart()
{
double volume = ((Account.Balance * Faktor) / (100 * SL * Symbol.PipSize));
PlaceStopOrder(TradeType.Buy, Symbol, volume, Symbol.Ask + (Symbol.PipSize * SL));
}
Error CS1502: The best overloaded method match for 'cAlgo.API.Robot.PlaceStopOrder(cAlgo.API.TradeType, cAlgo.API.Internals.Symbol, long, double)' has some invalid arguments
Error CS1503: Argument 3: cannot convert from 'double' to 'long'
how to make from double balance float volume?
Replies
aysos75
14 Jul 2015, 21:55
RE:
torokbalint1986
If you want to use double volume, you can use this instructions :
double volume = moneyManagement(RiskPercent, StopLoss);
long normalizedVolume = Symbol.NormalizeVolume(volume, RoundingMode.ToNearest)
ExecuteMarketOrder(tradeType, Symbol, normalizedVolume, _instanceLabel, StopLoss, TakeProfit, 10, comment);
@aysos75
Spotware
07 Jul 2015, 17:42
Dear Trader,
Please take a look at the third example in the following link: /api/reference/internals/algo/symbol
We hope this helps you.
@Spotware