Moderator: admin
fxcatty wrote:I really need standard code to add to this strategy for it to check the balance of an account. I was hit with a margin call because it kept opening positions! Please just share the code that would check the balance before opening a trade. If the code that would limit the number of open positions! Sorry for the repeat post but I've been hit again.
Thanks,
Matt
strategy.parameters:addInteger("MaxTrades", "Max open positions (0 == unlimited)", "", 0, 0, 100);
local MaxTrades;
function Prepare(nameOnly)
-- check moving average parameters
OB=instance.parameters.OB;
OS= instance.parameters.OS;
SIDE= instance.parameters.SIDE;
AllowMultiple= instance.parameters.AllowMultiple;
MaxTrades = instance.parameters.MaxTrades;
Users browsing this forum: No registered users and 26 guests