Написал небольшой скрипт, который контролирует стоп-лос моей позиции. Почему то утром прихожу к терминалу и мой скрипт все время обнулен, как будто ночью-утром сам quik нажимает кнопку "Начать расчет заново".
Как можно решить данную проблему и с чем может быть связано?
--------------
Код
PORTFOLIO_EX RTS_LAST15;
DESCRIPTION RTS_LAST15;
CLIENTS_LIST ALL_CLIENTS;
FIRMS_LIST FIRM_ID;
USE_CASE_SENSITIVE_CONSTANTS;
INCLUDE info\function.qpl;
PROGRAM
error=0
path="\"
client=READ_LINE (path&"ClientBox.txt", GET_FILE_LEN(path&"ClientBox.txt"), error)
depo=READ_LINE (path&"DepoBox.txt", GET_FILE_LEN(path&"DepoBox.txt"), error)
code=READ_LINE (path&"SecCode.txt", GET_FILE_LEN(path&"SecCode.txt"), error)
quant=READ_LINE (path&"lotSize.txt", GET_FILE_LEN(path&"lotSize.txt"), error) +0
new_global("losLevel", 0)
servertime=GET_INFO_PARAM ("SERVERTIME")
class=get_class(code)
market=get_market(class)
SecInfo = GET_SECURITY_INFO(class, code)
Lot = GET_VALUE (SecInfo, "LOT_SIZE")
id_base=code
CBPLPLANNED=get_CBPLPLANNED(market,client)
TOTAL_NET=get_total_net(market,client,code)
if market&""=="micex"
TOTAL_NET=TOTAL_NET/Lot
end if
line=0
string=create_map()
delete_all_items()
last= GET_PARAM (class, code , "LAST")
bid = GET_PARAM (class, code , "BID")
offer = GET_PARAM (class, code , "OFFER")
SEC_PRICE_STEP=get_value(get_param_ex(class, code, "SEC_PRICE_STEP"),"PARAM_VALUE")+0
slip = SEC_PRICE_STEP * 2
if total_net + 0 == 0
' ############################## REMOVE ON PRODUCTION
losLevel = 0
end if
if(total_net + 0 < 0 and last + 0 > 0)
if(last > losLevel and losLevel != 0)
message("Покупка лося!"&(offer+slip),1)
operation(client,depo,"b",offer+slip,total_net * -1,code,class,market)
end if
end if
if(total_net + 0 > 0 and last + 0 > 0)
if(last < losLevel and losLevel != 0)
message("Продажа лося!"&(bid-slip),1)
operation(client,depo,"s",bid-slip,total_net,code,class,market)
end if
end if
END_PROGRAM
END_PORTFOLIO_EX
Как можно решить данную проблему и с чем может быть связано?
--------------
Код
PORTFOLIO_EX RTS_LAST15;
DESCRIPTION RTS_LAST15;
CLIENTS_LIST ALL_CLIENTS;
FIRMS_LIST FIRM_ID;
USE_CASE_SENSITIVE_CONSTANTS;
INCLUDE info\function.qpl;
PROGRAM
error=0
path="\"
client=READ_LINE (path&"ClientBox.txt", GET_FILE_LEN(path&"ClientBox.txt"), error)
depo=READ_LINE (path&"DepoBox.txt", GET_FILE_LEN(path&"DepoBox.txt"), error)
code=READ_LINE (path&"SecCode.txt", GET_FILE_LEN(path&"SecCode.txt"), error)
quant=READ_LINE (path&"lotSize.txt", GET_FILE_LEN(path&"lotSize.txt"), error) +0
new_global("losLevel", 0)
servertime=GET_INFO_PARAM ("SERVERTIME")
class=get_class(code)
market=get_market(class)
SecInfo = GET_SECURITY_INFO(class, code)
Lot = GET_VALUE (SecInfo, "LOT_SIZE")
id_base=code
CBPLPLANNED=get_CBPLPLANNED(market,client)
TOTAL_NET=get_total_net(market,client,code)
if market&""=="micex"
TOTAL_NET=TOTAL_NET/Lot
end if
line=0
string=create_map()
delete_all_items()
last= GET_PARAM (class, code , "LAST")
bid = GET_PARAM (class, code , "BID")
offer = GET_PARAM (class, code , "OFFER")
SEC_PRICE_STEP=get_value(get_param_ex(class, code, "SEC_PRICE_STEP"),"PARAM_VALUE")+0
slip = SEC_PRICE_STEP * 2
if total_net + 0 == 0
' ############################## REMOVE ON PRODUCTION
losLevel = 0
end if
if(total_net + 0 < 0 and last + 0 > 0)
if(last > losLevel and losLevel != 0)
message("Покупка лося!"&(offer+slip),1)
operation(client,depo,"b",offer+slip,total_net * -1,code,class,market)
end if
end if
if(total_net + 0 > 0 and last + 0 > 0)
if(last < losLevel and losLevel != 0)
message("Продажа лося!"&(bid-slip),1)
operation(client,depo,"s",bid-slip,total_net,code,class,market)
end if
end if
END_PROGRAM
END_PORTFOLIO_EX