Happy New Year。。。
I'm very sorry, because I can not open a new post questions, so only here to ask questions.
I think through reference to existing positions opening to limit the next opening when the opening price. My strategy for the preparation of a problem, I would like to ask how to write.
local trades = core.host:findTable("trades");
local haveTrades = (trades:find('AccountID', Account) ~= nil)
if (haveTrades) then
local enum = trades:enumerator();
while true do
local row = enum:next();
if row == nil then break end
local OrderPL=row.PL;
if row.AccountID == Account and row.OfferID == Offer then
local MaxB=0;
local MinS=100000000;
if row.BS == 'B' then
MaxB=math.max(MaxB,row.Open);
elseif row.BS == 'S' then
MinS=math.min(MinS,row.Open);
end
My goal is to refer to the existing largest and smallest positions opening price opening price and assigned to " MaxB " and " MinS ". Ask how to modify?
Thanks a million!