Page 1 of 1

Trailing_Limit_monitor

PostPosted: Mon Jul 16, 2018 7:26 am
by Apprentice
Based on request.
viewtopic.php?f=27&t=66259
Trailing_Limit_monitor.lua
(44 KiB) Downloaded 637 times

Re: Trailing_Limit_monitor

PostPosted: Mon Jul 16, 2018 8:32 am
by conjure
Thank you for all these lines you wrote Apprentice!!!!

I m trying it on a demo account but limit is not moving.
I m uploading a screenshot of settings.
Capture.JPG

Re: Trailing_Limit_monitor

PostPosted: Mon Jul 16, 2018 6:57 pm
by Reymondpolanco
I have the same problem with this similar strategy and no body solve it I wrote like 4 request to solve it and nothing.

viewtopic.php?f=31&t=65947&start=10

Re: Trailing_Limit_monitor

PostPosted: Tue Jul 17, 2018 6:15 am
by conjure
I tried to write to text the trade.Open and trade.Limit
and trade.Limit gives me result of 0

Code: Select all
function CreateController(trade)
    local offer = core.host:findTable("offers"):find("Instrument", trade.Instrument);
    local controller = {};
    controller.TradeID = trade.TradeID;
    controller.TrailingSize = instance.parameters.TrailingStep;
    controller.InitialLimit = math.abs(trade.Open - trade.Limit) / offer.PointSize;
   local file = io.open("trade.Open.txt", "w")
file:write(trade.Open)
file:close()
   local file = io.open("trade.Limit.txt", "w")
file:write(trade.Limit)
file:close()
    return controller;
end


Re: Trailing_Limit_monitor

PostPosted: Mon Aug 06, 2018 9:18 am
by Apprentice
I changed the algorithm a little bit to handle of trades with the limit set after the creation of the trade. I think that was the issue.
Trailing_Limit_monitor_1.lua
(44.1 KiB) Downloaded 585 times