First of all i would like to thank all of you for the amazing work.
Second i would like to apologize for my bad english (i'm french).
I 'm not a programmer and i'm just starting to look at some possibilities whith lua, in hopes of developing some strategies.
If anyone could help me with some newbie questions i would much apreciate.
i'm struggling to find how to access indicators data.
I would like to create an indicator that prints on the chart the information we can get from the source in diferent time frames, and an indicator (say BB).
example:
- Code: Select all
function Init()
indicator:name("Test_002");
indicator:description("Indicator de test");
indicator:requiredSource(core.Bar);
indicator:type(core.Indicator);
indicator.parameters:addGroup("Style");
indicator.parameters:addColor("clr", "Color", "Color", core.rgb(255, 0, 0));
indicator.parameters:addInteger("FontSize", "Font size", "", 12);
indicator.parameters:addString("TF", "Time frame", "", "m5");
indicator.parameters:setFlag("TF", core.FLAG_PERIODS);
end
local source, SRCask, SRCbid, TFsource;
local TF;
local font;
local loading;
function Prepare()
source = instance.source;
SRCask = core.host:execute("getAskPrice");
SRCbid = core.host:execute("getBidPrice");
-- source info
BS = source:barSize(-1);
D = source:date(-1);
F = source:first(-1);
GDP = source:getDisplayPrecision(-1);
GP = source:getPrecision(-1);
HD = source:hasData(-1);
I = source:instrument(-1);
IA = source:isAlive(-1);
IB = source:isBar(-1);
IBD = source:isBid(-1);
N = source:name(-1);
PS = source:pipSize(-1);
S = source:serial(-1);
SZ = source:size(-1);
T = source:tick(-1);
TSRCask = SRCask:tick(-1);
TSRCbid = SRCbid:tick(-1);
local name = profile:id() .. "(" .. source:name() .. ")";
instance:name(name);
font = core.host:execute("createFont", "Arial", instance.parameters.FontSize, true, false);
end
function Update()
local Text="".. BS .. " barSize, ".. D .. " date, ".. F .. " first, ".. GDP .. " getDisplayPrecision, ".. GP .. " getPrecision, ".. I .. " instrument, ".. N .. " name, ".. PS .. " pipSize, ".. S .. " Serial, ".. SZ .. " size, ".. T .. " tick, ".. TSRCask .. " Ask tick, ".. TSRCbid .. " Bid tick, ";
core.host:execute("drawLabel1", 1,0, core.CR_RIGHT,10, core.CR_TOP, core.H_Left, core.V_Center, font, instance.parameters.clr, Text);
end
How could i get the same information for other time frames (say D1) in my 5m chart, and for BB indicator (MA and deviations)?? (is it possible??).
Besides the great fxcodebase, could someone advise me on learning programming lua for finance (books or other)?
Thank you in advance for your time and attention.