require("iuplua")
local interrupted
function OnStop()
interrupted = true
end
--[[
function sleep(n) -- standalone
if n > 0 then
os.execute("ping -n "..
tonumber(n) .." localhost > nul")
end
end
--]]
function main()
local btn1 = iup.button { title = "Show Dialog", }
function btn1:action()
local r = iup.Alarm("", "Main Title doesn't update!", "Exit")
if r == 1 then
interrupted = true
end
end -- btn1:action()
local btn2 = iup.button { title = "Show menu", }
function btn2:action()
local item = iup.item { title = "Exit", }
function item:action()
interrupted = true
end
local menu = iup.menu {
iup.item { title = "Dialog title doesn't update!",
active = "NO", }, item
}:popup(iup.MOUSEPOS, iup.-- График должен быть открыт в Quik'е
Class = "SPBFUT" -- "CETS_MTL" "CETS"
SecId="BRK4" -- "NGJ4" "GLDRUB_TOM" "USD000UTSTOM" "SiZ3"
Intrvl = INTERVAL_H1 -- D1 -- M5
Header = "<TICKER>;<PER>;<DATE>;<TIME>;"..
"<OPEN>;<HIGH>;<LOW>;<CLOSE>;<VOL>"
Period = "60" -- Дневки - 0, W1, MN1, H4, H2 - недопустимо
function Log (i)
local t = DS:T(i)
local ymd = string.format ("%04d%02d%02d", t.year, t.month, t.day)
local hms = string.format ("%02d%02d%02d", t.hour, t.min, t.sec);
if not (IniDt <= ymd and ymd <= FinDt) or
not (IniTm <= hms and hms <= FinTm) then return end
local str = string.format ("%s;%s;%s;%s;%.4f;%.4f;%.4f;%.4f;%.0f\n"
,SecId, Period, ymd, hms
,DS:O(i), DS:H(i), DS:L(i), DS:C(i), DS:V(i))
F:write (str)
end -- Log()
function OnInit (scriptPath)
qu = require ("QuikUtil(qu)") -- lu,qc,tu
ScriptDir, ScriptName = lu.
local Titles, Entries, Desk = {}, {}, {}
local Wn1_Hndl
local Wn1_Field1, Wn1_Field2, Wn1_Field3, Wn1_Field4, Wn1_Field5
= "Код CALL", "Страйк", "Дельта CALL", "Дельта расч", "Теор. расч"
function OnInit (scriptPath)
qu = require ("QuikUtil(qu)") -- qc, lu, tu
blk = require ("BlackScholes(blk)")
glb_ScriptDir, glb_ScriptName = lu.SplitPath (scriptPath)
message (glb_ScriptName .." started")
server = require ("OptionDesk")
end -- OnInit()
function OnStop (signal)
if Wn1_Hndl then DestroyTable (Wn1_Hndl) end
StopFlag = true
return 1000 -- 1 sec
end
local function ShowWin (cols)
for k = 1, #Desk do
local calCode = Desk[k][Entries[Wn1_Field1]]
if calCode:sub (3,3) == "0" then
calCode = calCode:sub (1,2) .