Page 1 of 1

Display strategy internal variables

PostPosted: Tue May 15, 2018 5:51 am
by MaximT
Hi all!

What is the simplest way to display an internal runtime variables of the strategy? Is the only way is to use special indicator and interop between indicator and strategy?

Re: Display strategy internal variables

PostPosted: Wed May 16, 2018 4:26 am
by Apprentice
Code: Select all
core.host:trace("Add a message here.");


In the debugger the trace will be written to the output pane of the debugger. In Marketscope the trace will be written to the "trace" tag of the strategies/indicator log pane.


ExtTrace("Some Note");

Code: Select all
function ExtTrace(message)
    local theDate = core.dateToTable(core.host:execute("convertTime", 1, 4, math.max(instance.bid:date(instance.bid:size() - 1), instance.ask:date(instance.ask:size() - 1))));
    core.host:trace(string.format("%d/%02d/%02d %02d:%02d:%02d ", theDate.year, theDate.month, theDate.day, theDate.hour, theDate.min, theDate.sec) .. " " .. message);
end