Data Recording

Here you can post and download custom indicators. PLEASE: Do not start topics unless you are posting your own indicator, they will be moved to appropriate section even if you do.

Moderator: admin

Data Recording

Postby LeTigre30 » Tue Oct 23, 2018 11:23 pm

Data Recording.lua
(3.36 KiB) Downloaded 581 times

Hello to all,

for all those who are followers of excel sheets and who want to record the data of the indicators during the trading, to be able to make a subsequent analysis, I add in my indi's these code :

Code: Select all
Function init()
...
        indicator.parameters:addGroup("Data Recording");
   indicator.parameters:addBoolean("SetRecording", "Activate Data Recording", "", false);
   indicator.parameters:addString("File", "File's name", "", ".\\Data Recording\\Rec_AZZR_XAU_m30.csv");
...
end

-- Variables declaration
local mm;
local FileRec;
local Record;
local Title;
local Time;
local Str;
local Counter = 0;

Function Prepare()
...
-- Data Recording
   Record = instance.parameters.SetRecording;
   if Record then      -- Add a tick or prices counter like counter = counter +1
      FileRec = io.open(instance.parameters.File, "a+");
      assert(FileRec ~= nil, "FileRec == Nil");
      Time = core.host:execute("convertTime", core.TZ_LOCAL, core.TZ_TS, core.now());
      Time = core.dateToTable(core.now());
      mm = Time.min;
      Title = "Recording Started on " .. Time.day .. "/" .. Time.month .. "/" .. Time.year .. " " .. Time.hour .. ":" .. Time.min .. ":" .. Time.sec .. '\n';
      Title = Title .. "Chrono" .. ";" .. "Date Hour" .. ";" .. "period" .. ";" .. "MaxPrice" .. ";" .. "MinPrice" .. ";" .. "Open" .. ";" .. "High" .. ";" .. "Low" .. ";" .. "Close" .. ";" .. "B/S" .. '\n';
      FileRec:write(Title);
   end

...
end

function Update(period, mode)
...
...
-- Record Datas
if Record then
        -- For data's dating
        Counter = Counter + 1;
   Time = core.host:execute("convertTime", core.TZ_EST, core.TZ_LOCAL, source:date(period));
   Time = core.dateToTable(Time);
   Str = Counter .. ";" .. Time.day .. "/" .. Time.month .. "/" .. Time.year .. " " .. Time.hour .. ":" .. Time.min .. ":" .. Time.sec;
      if mm ~= Time.min then
      Str = Str .. ";" .. period .. ";" .. MaxPrice .. ";" .. MinPrice .. ";" .. source.open[period] .. ";" .. source.high[period] .. ";" .. source.low[period] .. ";" .. source.close[period] .. ";" .. sens ..'\n';
      FileRec:write(Str);
      mm = Time.min;
      end
   end
...
...
end


NB : Here, MaxPrice, MinPrice, Sens are variables for the calculation of the Indicator.

Hope it will help those who want to know the real things

Rgds,

LeTigre30
User avatar
LeTigre30
FXCodeBase: Initiate
 
Posts: 173
Joined: Sun Dec 19, 2010 5:10 am
Location: Nimes (France)

Re: Data Recording

Postby LeTigre30 » Thu Oct 25, 2018 1:04 am

Hello to all,

Regarding my original post, the code that i produced CANNOT be used as it alone,
the traders who want use it, must integrate the different parts of the code in their own parts.

Pay attention : the lua file is not my code and it seems that Mario Jemic want take profit of my work;

If you want donate, you can do it via Paypal at jmvenet@magic.fr

Rgds,
LeTigre30
User avatar
LeTigre30
FXCodeBase: Initiate
 
Posts: 173
Joined: Sun Dec 19, 2010 5:10 am
Location: Nimes (France)


Return to Custom Indicators

Who is online

Users browsing this forum: Bing [Bot] and 155 guests