AccountTradeLog

Strategies are published here.

Moderator: admin

AccountTradeLog

Postby Apprentice » Thu Jul 20, 2017 4:50 am

AccountTradeLog.lua
(9.22 KiB) Downloaded 364 times

Based on the request.
viewtopic.php?f=27&t=64923
MT4/MQ4 version.
viewtopic.php?f=38&t=66948
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 21604
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: AccountTradeLog

Postby conjure » Thu Aug 23, 2018 5:00 pm

Is it possible to also export the DISTANCE, of STOP and LIMIT, from current market rate , in pips?
conjure
FXCodeBase: Initiate
 
Posts: 114
Joined: Sat Jul 22, 2017 7:27 am

Re: AccountTradeLog

Postby conjure » Fri Aug 24, 2018 11:33 am

i found a way... i think its right

Code: Select all
function logTable(fileHandle, tableName, tableColumns)

    local enum, row,value;
    enum = core.host:findTable(tableName):enumerator();
    row = enum:next();
    while row ~= nil do
        for column = 1, #tableColumns do
            value = row:cell(tableColumns[column])
            fileHandle:write(tostring(value) .. Separator);
        end
symbol=row.Instrument              
         local enum2, row2;
   enum2 = core.host:findTable("offers"):enumerator();
   row2 = enum2:next();
   while row2 ~= nil do
if row2.Instrument==symbol then   
pips=row2.PointSize;
end
       row2 = enum2:next();
   end
   

   limit= math.abs(row.Close - row.Limit) / pips;
   stop= math.abs(row.Close - row.Stop) / pips;
limit=math.floor(limit)
stop=math.floor(stop)

               fileHandle:write(limit);
               fileHandle:write(",");
               fileHandle:write(stop);

       fileHandle:write("\n")
       row = enum:next();
    end
    ---fileHandle:flush(MergeFileHandle);
         fileHandle:close()

end


conjure
FXCodeBase: Initiate
 
Posts: 114
Joined: Sat Jul 22, 2017 7:27 am


Return to Custom Strategies

Who is online

Users browsing this forum: Exabot [Bot] and 5 guests