Thanks for the precious help.
I have an unknown error (file attached) on the Bar-based indicator creation, in my strategy, when I try to apply your example.
I am using NAS100, I see the name correctly output.
- Code: Select all
function Prepare(nameOnly)
local source = instance.bid;
local name = profile:id() .. "(" .. source:name() .. ", " .. instance.bid:instrument() .. ")";
instance:name(name);
if nameOnly then
return;
end
assert(core.indicators:findIndicator("REM_AVERAGES_MASO") ~= nil, "Install REM_AVERAGES_MASO.LUA indicator");
assert(core.indicators:findIndicator("REM_CCI_STOCHASTIC") ~= nil, "Install REM_CCI_STOCHASTIC.LUA indicator");
Source = ExtSubscribe(1, nil, "m5", instance.parameters.Type == "Bid", "bar");
square_indicator = core.indicators:create("REM_AVERAGES_MASO", Source.close);
-- ERROR on this line:
arrow_indicator = core.indicators:create("REM_CCI_STOCHASTIC", Source);
end
My indicator is OK on standalone though. Here is the Init() sample:
- Code: Select all
function Init()
indicator:name("REM_CCI_STOCHASTIC");
indicator:description("");
indicator:requiredSource(core.Bar);
indicator:type(core.Oscillator);
-- Additional parameters here...
end
function Prepare(nameOnly)
local name = profile:id() .. "(" .. source:name() .. ", " .. tostring(CCIPeriod) .. ", " .. tostring(StochPeriod) .. ", " .. tostring(StochSmooth) .. ")";
instance:name(name);
source = instance.source;
cci = core.indicators:create("CCI", source, CCIPeriod);
end
If i refer to your example, it should be ok:
Strategy Example 1.lua:
- Code: Select all
function Prepare(nameOnly)
Source = ExtSubscribe(2, nil, TF, instance.parameters.Type == "Bid", "bar");
Indicator1 = core.indicators:create("INDICATOR_A", Source.close)
-- My code breaks here with the unreadable error message
Indicator2 = core.indicators:create("INDICATOR_B", Source);
end
Any idea what causes this error?
I can share you the whole files in PM if needed
Thank you for your time