<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title>Форум QUIK [тема: Ошибка, attempt to compare two table values]</title>
		<link>http://forum.quik.ru</link>
		<description>Новое в теме Ошибка, attempt to compare two table values форума  на сайте Форум QUIK [forum.quik.ru]</description>
		<language>ru</language>
		<docs>http://backend.userland.com/rss2</docs>
		<pubDate>Sun, 03 May 2026 00:34:08 +0300</pubDate>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27814/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Здравствуйте,<br /><br />Видим, что идет обращение к переменной Lot:<br />SetCell(TableID,1,3,Lot)<br />в то время, как сама переменная закомментирована:<br />--Lot= &nbsp;getFuturesHolding(firmid,TorShet,InstrumentKod,0).totalnet<br /><br />И рекомендуем переменную задать глобально, а не внутри функции, например вначале скрипта. &nbsp; <br />
			<i>21.11.2017 10:57:13, Egor Zaytsev.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27814/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27814/topic3197/</guid>
			<pubDate>Tue, 21 Nov 2017 10:57:13 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27799/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_TDdw5zg4" href="/user/17/" bx-tooltip-user-id="17">Sergey Gorokhov</a> написал:<br /> Алексей &nbsp;, <br /><br />функция getFuturesHolding вызывается внутри функции obnov(), которая нигде в коде не используется. Либо в этом и есть причина, либо Вы опять привели не полный код скрипта.<br />И Вы так и не представили скриншот таблицы позиций по клиентским счетам, на котором видно что данные которые Вы запрашиваете, действительно существуют.<br />=============<br />dofile(getScriptPath()..&quot;\\param.lua&quot;)<br /><br />is_run = true ---переменная для повторения цикла<br />LogFile = getScriptPath()..&quot;\\LogFile.txt&quot;<br /><br />function &nbsp;OnInit() &nbsp; &nbsp;-- выполняетя 1 раз перез запуском доп потока<br />CreateTable()<br />WriteToEndOfFile(LogFile,&quot;Робот Запущен!&quot;)<br />test()<br /><br />end<br /><br />function main()<br /><br />while (is_run== true) do <br /><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DataTable()<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Time()<br />		 &nbsp; obnov()<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --trade()<br />		 &nbsp; <br />		 &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--ОСновные вычисления<br />		 &nbsp;<br />end<br /><br />end<br /><br />function OnTrade(TradeX)<br /><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-----------ДЕЙСТВИЯ ПРИ ПОЯВЛЕНИИ НОВОЙ СДЕЛКИ	<br /><br />end<br /><br />function OnOrder(OrderX)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-----действия при появлении новой заявки<br />end <br /><br /><br />function &nbsp;OnStopOrder()<br /><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ---Действия при появлении стоп заявки.<br />end<br /><br />function OnStop()<br /><br /> &nbsp; &nbsp; message('Робот остановлен, все позиции по контрактам закрыты!') &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ----Действия При нажатии кновки ОСТАНОВИТЬ,(Закрытие всех сделок выход в лот 0)<br /> &nbsp; &nbsp; WriteToEndOfFile(LogFile,&quot;Робот остановлен, все позиции по контрактам закрыты!&quot;)<br />	 DestroyTable(TableID)<br />	 <br />	 <br />end<br /><br /><br /><br />файл param.lua<br /><br /><br /><br /><br />dofile(getScriptPath()..&quot;\\Options.lua&quot;)<br /><br />id_trans = 777<br />trans_id = id_trans + 1<br /><br /><br />function obnov()<br />priceMax = getParamEx(KodClass,InstrumentKod,&quot;PRICEMAX&quot;).param_value<br />tekPrice = getParamEx(KodClass,InstrumentKod,&quot;LAST&quot;).param_value<br />priceMin= getParamEx(KodClass,InstrumentKod,&quot;PRICEMIN&quot;).param_value<br />--Lot= &nbsp;getFuturesHolding(firmid,TorShet,InstrumentKod,0).totalnet<br /> -- tekMarzha= <br />end<br /><br />function test()<br /><br /><br /><br />local Transaction={<br /><br />		<br /> &nbsp; &nbsp;&#91;'TRANS_ID'&#93; &nbsp;= tostring(trans_id), &nbsp; -- Номер транзакции<br /> &nbsp; &nbsp;&#91;'ACCOUNT'&#93; &nbsp; = TorShet, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-- Код счета<br /> &nbsp; &nbsp;&#91;'CLASSCODE'&#93; = KodClass, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -- Код класса<br /> &nbsp; &nbsp;&#91;'SECCODE'&#93; &nbsp; = InstrumentKod, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -- Код инструмента<br /> &nbsp; &nbsp;&#91;'ACTION'&#93; &nbsp; &nbsp;= 'NEW_ORDER', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-- Тип транзакции ('NEW_ORDER' - новая заявка)<br /> &nbsp; &nbsp;&#91;'OPERATION'&#93; = 'B', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-- Операция ('B' - buy, или 'S' - sell)<br /> &nbsp; &nbsp;&#91;'TYPE'&#93; &nbsp; &nbsp; &nbsp;= 'L', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-- Тип ('L' - лимитированная, 'M' - рыночная)<br /> &nbsp; &nbsp;&#91;'QUANTITY'&#93; &nbsp;= '1', &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-- Количество<br /> &nbsp; &nbsp;&#91;'PRICE'&#93; &nbsp; &nbsp; = tostring(tekPrice) &nbsp; -- Цена<br />}<br /><br /><br />local Res = sendTransaction(Transaction)<br /><br />end<br /><br /><br />-- function trade()<br /><br /><br />-- if(tonumber(tekPrice)==nil or tonumber(priceMin) == nil or tonumber(priceMax)==nil)then<br /><br />-- SetCell(TableID,2,4,&quot;Не удалось получить цены с графика, нет соеденения с сервером!&quot;)<br />-- WriteToEndOfFile(LogFile,&quot;Не удалось получить цены с графика, нет соеденения с сервером!&quot;)<br /><br /><br />-- end<br /><br /><br />-- if(tonumber(tekPrice) &lt; tonumber(priceMin) )then &nbsp; &nbsp;-- &nbsp;25 строка<br /><br /><br />-- transaction = {<br />-- ACCOUNT=TorShet,<br />-- CLIENT_CODE=KodClient,<br />-- TYPE=&quot;M&quot;,<br />-- TRANS_ID=&quot;7&quot;,<br />-- CLASSCODE=KodClass,<br />-- SECCODE=InstrumentKod,<br />-- ACTION=&quot;NEW_ORDER&quot;,<br />-- OPERATION=&quot;B&quot;,<br />-- PRICE=tostring(tekPrice),<br />-- QUANTITY=tostring(LotUp)<br />-- }<br /><br />-- transaction.TRANS_ID = &quot;12345&quot;<br />-- sendTransaction(transaction)<br /><br />-- elseif(tonumber(tekPrice) &gt; tonumber(priceMax))then<br />-- transaction = {<br />-- ACCOUNT=TorShet,<br />-- CLIENT_CODE=KodClient,<br />-- TYPE=&quot;M&quot;,<br />-- TRANS_ID=&quot;8&quot;,<br />-- CLASSCODE=KodClass,<br />-- SECCODE=InstrumentKod,<br />-- ACTION=&quot;NEW_ORDER&quot;,<br />-- OPERATION=&quot;S&quot;,<br />-- PRICE=tostring(tekPrice),<br />-- QUANTITY=tostring(LotUp)<br />-- }<br /><br />-- transaction.TRANS_ID = &quot;12345&quot;<br />-- sendTransaction(transaction)<br /><br /><br />-- end<br /><br />-- end<br /><br /><br /><br /><br />function PutDataToTableInit()<br />Clear(TableID)<br />SetWindowCaption(TableID,&quot;Робот ИНТЕЛЕКТ! Автор: Алексей Егоров.&quot;)<br />SetWindowPos(TableID,100,200,888,100) &nbsp;-- Крдинаты 100,200,ширина и высота &nbsp;888,100<br />InsertRow(TableID,1) &nbsp;-- вставка строки в таблицу<br />InsertRow(TableID,2)<br />InsertRow(TableID,3)<br />SetColor(TableID,2,QTABLE_NO_INDEX,RGB(255,255,0),RGB(0,0,0),RGB(0,220,220),RGB(0,0,0))<br />SetColor(TableID,3,QTABLE_NO_INDEX,RGB(255,255,0),RGB(0,0,0),RGB(0,220,220),RGB(0,0,0))<br />end<br /><br />function WriteToEndOfFile(sFile,sDataString) &nbsp; -- запись лог файла<br /><br />local serverTime= GetInfoParam(&quot;SERVERTIME&quot;)<br />local serverDate= GetInfoParam(&quot;TRADEDATE&quot;)<br />sDataString = serverDate..&quot;:&quot;..serverTime..&quot;:&quot;..sDataString..&quot;\n&quot;<br />local f = io.open(sFile,&quot;r+&quot;)<br />if(f==nil)then<br />f = io.open(sFile,&quot;w&quot;)<br />end<br /><br />if(f~=nil)then<br />f:seek(&quot;end&quot;,0)<br />f:write(sDataString)<br />f:flush()<br />f:close()<br />end<br /><br />end<br /><br />function CreateTable() &nbsp; --создание таблицы<br />TableID = AllocTable() &nbsp; &nbsp; &nbsp;--иницилизация таблицы(создание)<br />AddColumn(TableID,1,&quot;ВРЕМЯ СЕРВЕРА&quot;,true, QTABLE_STRING_TYPE,20)<br />AddColumn(TableID,2,&quot;КОД ИНСТРУМЕНТА&quot;,true, QTABLE_STRING_TYPE,20) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -- Добавление колонок в таблицу<br />AddColumn(TableID,3,&quot;ЛОТ-КОНТРАКТЫ&quot;,true, QTABLE_STRING_TYPE,20)<br />AddColumn(TableID,4,&quot;КОМЕНТАРИИ&quot;,true, QTABLE_STRING_TYPE,60)<br />AddColumn(TableID,5,&quot;КОД КЛАССА&quot;,true, QTABLE_STRING_TYPE,20)<br />CreateWindow(TableID)<br />PutDataToTableInit(TableID)<br />SetColor(TableID,1,QTABLE_NO_INDEX,RGB(255,255,255),RGB(0,0,0),RGB(0,220,220),RGB(255,0,255))<br /><br />end<br /><br />function Time()<br /><br />ServerTime= GetInfoParam(&quot;SERVERTIME&quot;)<br />if(ServerTime==nil or ServerTime==&quot;&quot;)then<br />Errortime=&quot;Время не полученно, подключитесь к серверу!&quot;<br /><br />WriteToEndOfFile(LogFile,&quot;Время не полученно, подключитесь к серверу!&quot;)<br />else<br /><br />Errortime=&quot;&quot;<br /><br />end<br /><br />SetCell(TableID,1,1,ServerTime) &nbsp; &nbsp;<br />SetCell(TableID,1,4,Errortime) &nbsp; &nbsp; &nbsp; &nbsp; -- запись данных в строку 1 и колонку 4<br /><br />sleep(1000)<br />end<br /><br />function DataTable() &nbsp; --Данные в таблице<br /><br /><br /><br /><br /><br />SetCell(TableID,1,2,InstrumentKod)<br />SetCell(TableID,1,5,KodClass)<br />SetCell(TableID,1,3,Lot)<br />SetCell(TableID,3,1,&quot;Где сработает заявка&quot;)<br />SetCell(TableID,3,2,priceMin)<br />SetCell(TableID,3,3,priceMax)<br />SetCell(TableID,3,4,&quot;текущая цена ==&gt;&quot;)<br />SetCell(TableID,3,5,tekPrice)<br />sleep(100)<br /> <br /> <br /><br />if(IsWindowClosed(TableID))then<br />CreateWindow(TableID)<br />PutDataToTableInit()<br />SetColor(TableID,1,QTABLE_NO_INDEX,RGB(0,230,0),RGB(0,0,0),RGB(0,220,220),RGB(0,0,0))<br /><br /><br /><br /><br /><br /><br />end<br /><br /><br />end<br /><br /><br />файл &nbsp; Options.lua<br /><br /><br />InstrumentKod = &quot;SiZ7&quot; -- код инструмента(бумаги) sec_code<br />TorShet = &quot;SPBFUT00877&quot; &nbsp;---Торговый счет<br />KodClient = &quot;10632&quot; &nbsp;--- Код клиента<br />KodClass = &quot;SPBFUT&quot; &nbsp; --код класса<br />firmid = &quot;SPBFUT000000&quot; &nbsp; -- id фирмы (можно посмотреть в ограничение по клиенским счетам 'фирма')<br />LotUp = 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -- количество контрактов для покупки<br />LotDown = 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-- количество контрактов на продажу<br />trailingSize = 100 &nbsp; &nbsp; &nbsp; &nbsp; -- размер трейлинг стопа <br />
			<i>20.11.2017 10:12:35, Алексей.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27799/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27799/topic3197/</guid>
			<pubDate>Mon, 20 Nov 2017 10:12:35 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27706/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<a class="blog-p-user-name" id="bp_o1mNbp5W" href="/user/8989/" bx-tooltip-user-id="8989">Алексей</a>, <br /><br />функция getFuturesHolding вызывается внутри функции obnov(), которая нигде в коде не используется. Либо в этом и есть причина, либо Вы опять привели не полный код скрипта.<br />И Вы так и не представили скриншот таблицы позиций по клиентским счетам, на котором видно что данные которые Вы запрашиваете, действительно существуют. <br />
			<i>15.11.2017 12:48:55, Sergey Gorokhov.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27706/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27706/topic3197/</guid>
			<pubDate>Wed, 15 Nov 2017 12:48:55 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27697/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_alwvGgmI" href="/user/19/" bx-tooltip-user-id="19">Egor Zaytsev</a> написал:<br />Добрый день.<br /><br />В скрипте не видно входных параметров. Проверяйте фирму, торговый счет, код инструмента. <br />Наличие текущей чистой позиции в таблице позиций по клиентским счетам.<br />=============<br />InstrumentKod = &quot;SiZ7&quot; -- код инструмента(бумаги) sec_code<br />TorShet = &quot;00000A&quot; &nbsp;---Торговый счет<br />KodClient = &quot;400000&quot; &nbsp;--- Код клиента<br />KodClass = &quot;SPBFUT&quot; &nbsp; --код класса<br />firmid = &quot;MC01300000&quot; &nbsp; -- id фирмы (можно посмотреть в ограничение по клиенским счетам 'фирма')<br />LotUp = 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -- количество контрактов для покупки<br />LotDown = 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-- количество контрактов на продажу<br />trailingSize = 100 &nbsp; &nbsp; &nbsp; &nbsp; -- размер трейлинг стопа <br />
			<i>15.11.2017 03:34:47, Алексей.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27697/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27697/topic3197/</guid>
			<pubDate>Wed, 15 Nov 2017 03:34:47 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27596/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Добрый день.<br /><br />В скрипте не видно входных параметров. Проверяйте фирму, торговый счет, код инструмента. <br />Наличие текущей чистой позиции в таблице позиций по клиентским счетам. &nbsp; <br />
			<i>08.11.2017 04:59:22, Egor Zaytsev.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27596/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27596/topic3197/</guid>
			<pubDate>Wed, 08 Nov 2017 04:59:22 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27585/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_lj1abIY2" href="/user/8989/" bx-tooltip-user-id="8989">Алексей</a> написал:<br /><br />====quote====<br /> Egor Zaytsev &nbsp; написал:<br /><br />====quote====<br /> Алексей &nbsp; написал:<br />Помогите пожалуйста не могу разобраться, в гугле тоже нечего путного найти не могу<br /><br />как мне получить текущюю чистую позицию , сделал все по официальной документации, но он не получает значения, что я делаю не так?<br />
====code====
<pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Lot&nbsp;&nbsp; =&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; getFuturesHolding&nbsp;&nbsp; (firmid,TorShet,InstrumentKod,&nbsp;&nbsp; 0&nbsp;&nbsp; ).totalnet
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</pre>
=============
<br />=============<br />Добрый день.<br /><br />В QUIK в таблице позиций значение отображается? <br />Что Вам скрипт возвращает? Ноль? Ошибку? Можно поподробнее, а также выложите полный скрипт.<br />=============<br />нечего не происходит, &nbsp;при этом скрипт работает ниже код<br />
====code====
<pre>&nbsp;&nbsp;dofile( getScriptPath () .. "&#92;&#92;Options.lua")

id_trans&nbsp;&nbsp;=&nbsp;&nbsp; 777 
trans_id&nbsp;&nbsp;=&nbsp;&nbsp;id_trans&nbsp;&nbsp;+&nbsp;&nbsp; 1 


 function&nbsp;&nbsp; obnov ()
priceMax&nbsp;&nbsp;=&nbsp;&nbsp; getParamEx (KodClass,InstrumentKod,"PRICEMAX").param_value
tekPrice&nbsp;&nbsp;=&nbsp;&nbsp; getParamEx (KodClass,InstrumentKod,"LAST").param_value
priceMin =&nbsp;&nbsp; getParamEx (KodClass,InstrumentKod,"PRICEMIN").param_value
 --Lot=&nbsp;&nbsp;getFuturesHolding(firmid,TorShet,InstrumentKod,0).totalnet 
&nbsp;&nbsp;-- tekMarzha=&nbsp;&nbsp;
 end 

 function&nbsp;&nbsp; test ()



 local&nbsp;&nbsp;Transaction = {

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&#91; 'TRANS_ID' &#93;&nbsp;&nbsp; =&nbsp;&nbsp;tostring(trans_id),&nbsp;&nbsp;&nbsp;&nbsp;-- Номер транзакции 
&nbsp;&nbsp;&nbsp;&nbsp;&#91; 'ACCOUNT' &#93;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;&nbsp;TorShet,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Код счета 
&nbsp;&nbsp;&nbsp;&nbsp;&#91; 'CLASSCODE' &#93;&nbsp;&nbsp;=&nbsp;&nbsp;KodClass,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- Код класса 
&nbsp;&nbsp;&nbsp;&nbsp;&#91; 'SECCODE' &#93;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;&nbsp;InstrumentKod,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- Код инструмента 
&nbsp;&nbsp;&nbsp;&nbsp;&#91; 'ACTION' &#93;&nbsp;&nbsp;&nbsp;&nbsp; =&nbsp;&nbsp; 'NEW_ORDER' ,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Тип транзакции ('NEW_ORDER' - новая заявка) 
&nbsp;&nbsp;&nbsp;&nbsp;&#91; 'OPERATION' &#93;&nbsp;&nbsp;=&nbsp;&nbsp; 'B' ,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Операция ('B' - buy, или 'S' - sell) 
&nbsp;&nbsp;&nbsp;&nbsp;&#91; 'TYPE' &#93;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&nbsp;&nbsp; 'L' ,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Тип ('L' - лимитированная, 'M' - рыночная) 
&nbsp;&nbsp;&nbsp;&nbsp;&#91; 'QUANTITY' &#93;&nbsp;&nbsp; =&nbsp;&nbsp; '1' ,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Количество 
&nbsp;&nbsp;&nbsp;&nbsp;&#91; 'PRICE' &#93;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;&nbsp;tostring(tekPrice)&nbsp;&nbsp;&nbsp;&nbsp;-- Цена 
}


 local&nbsp;&nbsp;Res&nbsp;&nbsp;=&nbsp;&nbsp; sendTransaction (Transaction)

 end 


 -- function trade() 


 -- if(tonumber(tekPrice)==nil or tonumber(priceMin) == nil or tonumber(priceMax)==nil)then 

 -- SetCell(TableID,2,4,"Не удалось получить цены с графика, нет соеденения с сервером!") 
 -- WriteToEndOfFile(LogFile,"Не удалось получить цены с графика, нет соеденения с сервером!") 


 -- end 


 -- if(tonumber(tekPrice) &#60; tonumber(priceMin) )then&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;25 строка 


 -- transaction = { 
 -- ACCOUNT=TorShet, 
 -- CLIENT_CODE=KodClient, 
 -- TYPE="M", 
 -- TRANS_ID="7", 
 -- CLASSCODE=KodClass, 
 -- SECCODE=InstrumentKod, 
 -- ACTION="NEW_ORDER", 
 -- OPERATION="B", 
 -- PRICE=tostring(tekPrice), 
 -- QUANTITY=tostring(LotUp) 
 -- } 

 -- transaction.TRANS_ID = "12345" 
 -- sendTransaction(transaction) 

 -- elseif(tonumber(tekPrice) &#62; tonumber(priceMax))then 
 -- transaction = { 
 -- ACCOUNT=TorShet, 
 -- CLIENT_CODE=KodClient, 
 -- TYPE="M", 
 -- TRANS_ID="8", 
 -- CLASSCODE=KodClass, 
 -- SECCODE=InstrumentKod, 
 -- ACTION="NEW_ORDER", 
 -- OPERATION="S", 
 -- PRICE=tostring(tekPrice), 
 -- QUANTITY=tostring(LotUp) 
 -- } 

 -- transaction.TRANS_ID = "12345" 
 -- sendTransaction(transaction) 


 -- end 

 -- end 




 function&nbsp;&nbsp; PutDataToTableInit ()
 Clear (TableID)
 SetWindowCaption (TableID,"Робот ИНТЕЛЕКТ !&nbsp;&nbsp;Автор: Алексей Егоров.")
 SetWindowPos (TableID, 100 , 200 , 888 , 100 )&nbsp;&nbsp; -- Крдинаты 100,200,ширина и высота&nbsp;&nbsp;888,100 
 InsertRow (TableID, 1 )&nbsp;&nbsp; -- вставка строки в таблицу 
 InsertRow (TableID, 2 )
 InsertRow (TableID, 3 )
 SetColor (TableID, 2 ,QTABLE_NO_INDEX, RGB ( 255 , 255 , 0 ), RGB ( 0 , 0 , 0 ), RGB ( 0 , 220 , 220 ), RGB ( 0 , 0 , 0 ))
 SetColor (TableID, 3 ,QTABLE_NO_INDEX, RGB ( 255 , 255 , 0 ), RGB ( 0 , 0 , 0 ), RGB ( 0 , 220 , 220 ), RGB ( 0 , 0 , 0 ))
 end 

 function&nbsp;&nbsp; WriteToEndOfFile (sFile,sDataString)&nbsp;&nbsp;&nbsp;&nbsp;-- запись лог файла 

 local&nbsp;&nbsp;serverTime =&nbsp;&nbsp;GetInfoParam( "SERVERTIME" )
 local&nbsp;&nbsp;serverDate =&nbsp;&nbsp;GetInfoParam( "TRADEDATE" )
sDataString&nbsp;&nbsp;=&nbsp;&nbsp;serverDate .. ":" .. serverTime .. ":" .. sDataString .. "&#92;n"
 local&nbsp;&nbsp;f&nbsp;&nbsp;=&nbsp;&nbsp; io.open (sFile,"r + ")
 if (f =&nbsp;&nbsp;=&nbsp;&nbsp;nil ) then 
f&nbsp;&nbsp;=&nbsp;&nbsp; io.open (sFile,"w")
 end 

 if (f~ =&nbsp;&nbsp;nil ) then 
f:seek( "end" , 0 )
f:write(sDataString)
f:flush()
f:close()
 end 

 end 

 function&nbsp;&nbsp; CreateTable ()&nbsp;&nbsp;&nbsp;&nbsp;--создание таблицы 
TableID&nbsp;&nbsp;=&nbsp;&nbsp; AllocTable ()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --иницилизация таблицы(создание) 
 AddColumn (TableID, 1 ,"ВРЕМЯ СЕРВЕРА", true , QTABLE_STRING_TYPE, 20 )
 AddColumn (TableID, 2 ,"КОД ИНСТРУМЕНТА", true , QTABLE_STRING_TYPE, 20 )&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- Добавление колонок в таблицу 
 AddColumn (TableID, 3 ,"ЛОТ - КОНТРАКТЫ", true , QTABLE_STRING_TYPE, 20 )
 AddColumn (TableID, 4 ,"КОМЕНТАРИИ", true , QTABLE_STRING_TYPE, 60 )
 AddColumn (TableID, 5 ,"КОД КЛАССА", true , QTABLE_STRING_TYPE, 20 )
 CreateWindow (TableID)
PutDataToTableInit(TableID)
 SetColor (TableID, 1 ,QTABLE_NO_INDEX, RGB ( 255 , 255 , 255 ), RGB ( 0 , 0 , 0 ), RGB ( 0 , 220 , 220 ), RGB ( 255 , 0 , 255 ))

 end 

 function&nbsp;&nbsp; Time ()

ServerTime =&nbsp;&nbsp;GetInfoParam( "SERVERTIME" )
 if (ServerTime =&nbsp;&nbsp;=&nbsp;&nbsp;nil&nbsp;&nbsp; or&nbsp;&nbsp;ServerTime =&nbsp;&nbsp;=&nbsp;&nbsp;"" ) then 
Errortime =&nbsp;&nbsp;"Время не полученно, подключитесь к серверу!" 

WriteToEndOfFile(LogFile,"Время не полученно, подключитесь к серверу ! ")
 else 

Errortime =&nbsp;&nbsp;"" 

 end 

 SetCell (TableID, 1 , 1 ,ServerTime)&nbsp;&nbsp;&nbsp;&nbsp;
 SetCell (TableID, 1 , 4 ,Errortime)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- запись данных в строку 1 и колонку 4 

 sleep ( 1000 )
 end 

 function&nbsp;&nbsp; DataTable ()&nbsp;&nbsp;&nbsp;&nbsp;--Данные в таблице 





 SetCell (TableID, 1 , 2 ,InstrumentKod)
 SetCell (TableID, 1 , 5 ,KodClass)
 SetCell (TableID, 1 , 3 ,Lot)
 SetCell (TableID, 3 , 1 ,"Где сработает заявка")
 SetCell (TableID, 3 , 2 ,priceMin)
 SetCell (TableID, 3 , 3 ,priceMax)
 SetCell (TableID, 3 , 4 ,"текущая цена&nbsp;&nbsp;=&nbsp;&nbsp;=&nbsp;&nbsp;&#62; ")
 SetCell (TableID, 3 , 5 ,tekPrice)
 sleep ( 100 )
 
 

 if ( IsWindowClosed (TableID)) then 
 CreateWindow (TableID)
PutDataToTableInit()
 SetColor (TableID, 1 ,QTABLE_NO_INDEX, RGB ( 0 , 230 , 0 ), RGB ( 0 , 0 , 0 ), RGB ( 0 , 220 , 220 ), RGB ( 0 , 0 , 0 ))






 end 


 end 
&nbsp;&nbsp;</pre>
=============
<br />=============<br />Я ее закоментировал <br />
			<i>07.11.2017 14:32:14, Алексей.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27585/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27585/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 14:32:14 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27584/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_f4Tpf6HM" href="/user/19/" bx-tooltip-user-id="19">Egor Zaytsev</a> написал:<br /><br />====quote====<br /> Алексей &nbsp; написал:<br />Помогите пожалуйста не могу разобраться, в гугле тоже нечего путного найти не могу<br /><br />как мне получить текущюю чистую позицию , сделал все по официальной документации, но он не получает значения, что я делаю не так?<br />
====code====
<pre>&nbsp;&nbsp;&nbsp;&nbsp;Lot&nbsp;&nbsp;=&nbsp;&nbsp;&nbsp;&nbsp; getFuturesHolding&nbsp;&nbsp;(firmid,TorShet,InstrumentKod,&nbsp;&nbsp;0&nbsp;&nbsp;).totalnet
&nbsp;&nbsp;&nbsp;&nbsp;</pre>
=============
<br />=============<br />Добрый день.<br /><br />В QUIK в таблице позиций значение отображается? <br />Что Вам скрипт возвращает? Ноль? Ошибку? Можно поподробнее, а также выложите полный скрипт.<br />=============<br />нечего не происходит, &nbsp;при этом скрипт работает ниже код<br />
====code====
<pre>dofile(getScriptPath().."&#92;&#92;Options.lua")

id_trans = 777
trans_id = id_trans + 1


function obnov()
priceMax = getParamEx(KodClass,InstrumentKod,"PRICEMAX").param_value
tekPrice = getParamEx(KodClass,InstrumentKod,"LAST").param_value
priceMin= getParamEx(KodClass,InstrumentKod,"PRICEMIN").param_value
--Lot=&nbsp;&nbsp;getFuturesHolding(firmid,TorShet,InstrumentKod,0).totalnet
 -- tekMarzha= 
end

function test()



local Transaction={

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&#91;'TRANS_ID'&#93;&nbsp;&nbsp;= tostring(trans_id),&nbsp;&nbsp; -- Номер транзакции
&nbsp;&nbsp;&nbsp;&nbsp;&#91;'ACCOUNT'&#93;&nbsp;&nbsp; = TorShet,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- Код счета
&nbsp;&nbsp;&nbsp;&nbsp;&#91;'CLASSCODE'&#93; = KodClass,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Код класса
&nbsp;&nbsp;&nbsp;&nbsp;&#91;'SECCODE'&#93;&nbsp;&nbsp; = InstrumentKod,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Код инструмента
&nbsp;&nbsp;&nbsp;&nbsp;&#91;'ACTION'&#93;&nbsp;&nbsp;&nbsp;&nbsp;= 'NEW_ORDER',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- Тип транзакции ('NEW_ORDER' - новая заявка)
&nbsp;&nbsp;&nbsp;&nbsp;&#91;'OPERATION'&#93; = 'B',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- Операция ('B' - buy, или 'S' - sell)
&nbsp;&nbsp;&nbsp;&nbsp;&#91;'TYPE'&#93;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= 'L',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- Тип ('L' - лимитированная, 'M' - рыночная)
&nbsp;&nbsp;&nbsp;&nbsp;&#91;'QUANTITY'&#93;&nbsp;&nbsp;= '1',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- Количество
&nbsp;&nbsp;&nbsp;&nbsp;&#91;'PRICE'&#93;&nbsp;&nbsp;&nbsp;&nbsp; = tostring(tekPrice)&nbsp;&nbsp; -- Цена
}


local Res = sendTransaction(Transaction)

end


-- function trade()


-- if(tonumber(tekPrice)==nil or tonumber(priceMin) == nil or tonumber(priceMax)==nil)then

-- SetCell(TableID,2,4,"Не удалось получить цены с графика, нет соеденения с сервером!")
-- WriteToEndOfFile(LogFile,"Не удалось получить цены с графика, нет соеденения с сервером!")


-- end


-- if(tonumber(tekPrice) &#60; tonumber(priceMin) )then&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;25 строка


-- transaction = {
-- ACCOUNT=TorShet,
-- CLIENT_CODE=KodClient,
-- TYPE="M",
-- TRANS_ID="7",
-- CLASSCODE=KodClass,
-- SECCODE=InstrumentKod,
-- ACTION="NEW_ORDER",
-- OPERATION="B",
-- PRICE=tostring(tekPrice),
-- QUANTITY=tostring(LotUp)
-- }

-- transaction.TRANS_ID = "12345"
-- sendTransaction(transaction)

-- elseif(tonumber(tekPrice) &#62; tonumber(priceMax))then
-- transaction = {
-- ACCOUNT=TorShet,
-- CLIENT_CODE=KodClient,
-- TYPE="M",
-- TRANS_ID="8",
-- CLASSCODE=KodClass,
-- SECCODE=InstrumentKod,
-- ACTION="NEW_ORDER",
-- OPERATION="S",
-- PRICE=tostring(tekPrice),
-- QUANTITY=tostring(LotUp)
-- }

-- transaction.TRANS_ID = "12345"
-- sendTransaction(transaction)


-- end

-- end




function PutDataToTableInit()
Clear(TableID)
SetWindowCaption(TableID,"Робот ИНТЕЛЕКТ! Автор: Алексей Егоров.")
SetWindowPos(TableID,100,200,888,100)&nbsp;&nbsp;-- Крдинаты 100,200,ширина и высота&nbsp;&nbsp;888,100
InsertRow(TableID,1)&nbsp;&nbsp;-- вставка строки в таблицу
InsertRow(TableID,2)
InsertRow(TableID,3)
SetColor(TableID,2,QTABLE_NO_INDEX,RGB(255,255,0),RGB(0,0,0),RGB(0,220,220),RGB(0,0,0))
SetColor(TableID,3,QTABLE_NO_INDEX,RGB(255,255,0),RGB(0,0,0),RGB(0,220,220),RGB(0,0,0))
end

function WriteToEndOfFile(sFile,sDataString)&nbsp;&nbsp; -- запись лог файла

local serverTime= GetInfoParam("SERVERTIME")
local serverDate= GetInfoParam("TRADEDATE")
sDataString = serverDate..":"..serverTime..":"..sDataString.."&#92;n"
local f = io.open(sFile,"r+")
if(f==nil)then
f = io.open(sFile,"w")
end

if(f~=nil)then
f:seek("end",0)
f:write(sDataString)
f:flush()
f:close()
end

end

function CreateTable()&nbsp;&nbsp; --создание таблицы
TableID = AllocTable()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--иницилизация таблицы(создание)
AddColumn(TableID,1,"ВРЕМЯ СЕРВЕРА",true, QTABLE_STRING_TYPE,20)
AddColumn(TableID,2,"КОД ИНСТРУМЕНТА",true, QTABLE_STRING_TYPE,20)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Добавление колонок в таблицу
AddColumn(TableID,3,"ЛОТ-КОНТРАКТЫ",true, QTABLE_STRING_TYPE,20)
AddColumn(TableID,4,"КОМЕНТАРИИ",true, QTABLE_STRING_TYPE,60)
AddColumn(TableID,5,"КОД КЛАССА",true, QTABLE_STRING_TYPE,20)
CreateWindow(TableID)
PutDataToTableInit(TableID)
SetColor(TableID,1,QTABLE_NO_INDEX,RGB(255,255,255),RGB(0,0,0),RGB(0,220,220),RGB(255,0,255))

end

function Time()

ServerTime= GetInfoParam("SERVERTIME")
if(ServerTime==nil or ServerTime=="")then
Errortime="Время не полученно, подключитесь к серверу!"

WriteToEndOfFile(LogFile,"Время не полученно, подключитесь к серверу!")
else

Errortime=""

end

SetCell(TableID,1,1,ServerTime)&nbsp;&nbsp;&nbsp;&nbsp;
SetCell(TableID,1,4,Errortime)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- запись данных в строку 1 и колонку 4

sleep(1000)
end

function DataTable()&nbsp;&nbsp; --Данные в таблице





SetCell(TableID,1,2,InstrumentKod)
SetCell(TableID,1,5,KodClass)
SetCell(TableID,1,3,Lot)
SetCell(TableID,3,1,"Где сработает заявка")
SetCell(TableID,3,2,priceMin)
SetCell(TableID,3,3,priceMax)
SetCell(TableID,3,4,"текущая цена ==&#62;")
SetCell(TableID,3,5,tekPrice)
sleep(100)
 
 

if(IsWindowClosed(TableID))then
CreateWindow(TableID)
PutDataToTableInit()
SetColor(TableID,1,QTABLE_NO_INDEX,RGB(0,230,0),RGB(0,0,0),RGB(0,220,220),RGB(0,0,0))






end


end
</pre>
============= <br />
			<i>07.11.2017 14:31:03, Алексей.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27584/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27584/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 14:31:03 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27582/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_oUvRNjnd" href="/user/8989/" bx-tooltip-user-id="8989">Алексей</a> написал:<br />Помогите пожалуйста не могу разобраться, в гугле тоже нечего путного найти не могу<br /><br />как мне получить текущюю чистую позицию , сделал все по официальной документации, но он не получает значения, что я делаю не так?<br />
====code====
<pre>&nbsp;&nbsp;Lot =&nbsp;&nbsp; getFuturesHolding (firmid,TorShet,InstrumentKod, 0 ).totalnet
&nbsp;&nbsp;</pre>
=============
<br />=============<br />Добрый день.<br /><br />В QUIK в таблице позиций значение отображается? <br />Что Вам скрипт возвращает? Ноль? Ошибку? Можно поподробнее, а также выложите полный скрипт. &nbsp; <br />
			<i>07.11.2017 13:52:46, Egor Zaytsev.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27582/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27582/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 13:52:46 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27579/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Помогите пожалуйста не могу разобраться, в гугле тоже нечего путного найти не могу<br /><br />как мне получить текущюю чистую позицию , сделал все по официальной документации, но он не получает значения, что я делаю не так?<br />
====code====
<pre>Lot= getFuturesHolding(firmid,TorShet,InstrumentKod,0).totalnet
</pre>
============= <br />
			<i>07.11.2017 12:54:55, Алексей.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27579/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27579/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 12:54:55 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27577/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_AZsgtlyR" href="/user/8989/" bx-tooltip-user-id="8989">Алексей</a> написал:<br />да, как закрыть все позиции<br />=============<br />Насколько мне известно, отдельной транзакции по закрытию позиции срочный рынок FORTS не предоставляет (если конечно имеется ввиду рынок FORTS). Но зная свою длинную/короткую позицию легко сформировать транзакцию на продажу/покупку по рыночной цене, что приведет к закрытию позиции. <br />
			<i>07.11.2017 11:31:33, Nikolay Pavlov.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27577/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27577/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 11:31:33 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27575/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_s6Thb7dl" href="/user/459/" bx-tooltip-user-id="459">Nikolay Pavlov</a> написал:<br /><br />====quote====<br /> Алексей &nbsp; написал:<br />Нашел ошибку, исправил, спасибо за помощь, есть еще вопрос каким параметром можно получить &quot;текущая чистая позиция&quot; и вариационная маржа, и есть ли команда для закрытия всех сделок?<br />=============<br />Для получения &nbsp;Текущей чистой позиции &nbsp;и &nbsp;Вариационной маржи &nbsp;на срочном рынке используйте функцию getFuturesHolding() (формат использования смотрите в официальной справке). Что имеется ввиду под закрытием всех сделок, закрытие позиции?<br />=============<br />да, как закрыть все позиции <br />
			<i>07.11.2017 11:23:27, Алексей.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27575/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27575/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 11:23:27 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27574/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_yClQMYSX" href="/user/8989/" bx-tooltip-user-id="8989">Алексей</a> написал:<br />Нашел ошибку, исправил, спасибо за помощь, есть еще вопрос каким параметром можно получить &quot;текущая чистая позиция&quot; и вариационная маржа, и есть ли команда для закрытия всех сделок?<br />=============<br />текущая чистая позиция из позиции по клиенским счетам на срочном рынке <br />
			<i>07.11.2017 11:21:33, Алексей.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27574/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27574/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 11:21:33 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27573/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_ePHXhnQI" href="/user/8989/" bx-tooltip-user-id="8989">Алексей</a> написал:<br />Нашел ошибку, исправил, спасибо за помощь, есть еще вопрос каким параметром можно получить &quot;текущая чистая позиция&quot; и вариационная маржа, и есть ли команда для закрытия всех сделок?<br />=============<br />Для получения <B>Текущей чистой позиции</B> и <B>Вариационной маржи</B> на срочном рынке используйте функцию getFuturesHolding() (формат использования смотрите в официальной справке). Что имеется ввиду под закрытием всех сделок, закрытие позиции? <br />
			<i>07.11.2017 11:13:09, Nikolay Pavlov.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27573/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27573/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 11:13:09 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27572/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Нашел ошибку, исправил, спасибо за помощь, есть еще вопрос каким параметром можно получить &quot;текущая чистая позиция&quot; и вариационная маржа, и есть ли команда для закрытия всех сделок? <br />
			<i>07.11.2017 11:01:10, Алексей.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27572/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27572/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 11:01:10 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27570/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_0YYxMVEB" href="/user/459/" bx-tooltip-user-id="459">Nikolay Pavlov</a> написал:<br />Выведите перед проблемным местом значения tonumber(tekPrice) &nbsp;и &nbsp;tonumber(priceMin), диагностика явно говорит, что одно из значений равно nil, т.е. Вы пытаетесь сравнить nil с числом и получаете ошибку. Напишите например так, чтобы точно определить с какими значениями работает оператор if:
====code====
<pre>&nbsp;&nbsp; message (tostring(tonumber(tekPrice)))
 message (tostring(tonumber(priceMin)))

 if&nbsp;&nbsp;(tonumber(tekPrice)&nbsp;&nbsp; &#60;&nbsp;&nbsp; tonumber(priceMin) )&nbsp;&nbsp;then&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;25 строка&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; ..&nbsp;&nbsp;.. 
&nbsp;&nbsp;</pre>
=============
<br />=============<br />Вы правы, Не получает цену последней сделки, возвращает nil, только не понятно почему<br /><br />tekPrice=getParamEx(KodClass,InstrumentKod,&quot;LAST&quot;).param_value <br />
			<i>07.11.2017 10:44:40, Алексей.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27570/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27570/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 10:44:40 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27568/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Выведите перед проблемным местом значения tonumber(tekPrice) &nbsp;и &nbsp;tonumber(priceMin), диагностика явно говорит, что одно из значений равно nil, т.е. Вы пытаетесь сравнить nil с числом и получаете ошибку. Напишите например так, чтобы точно определить с какими значениями работает оператор if:
====code====
<pre>message(tostring(tonumber(tekPrice)))
message(tostring(tonumber(priceMin)))

if (tonumber(tekPrice)&nbsp;&nbsp;&#60;&nbsp;&nbsp;tonumber(priceMin) ) then&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;25 строка 
&nbsp;&nbsp;&nbsp;&nbsp;....
</pre>
============= <br />
			<i>07.11.2017 10:33:07, Nikolay Pavlov.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27568/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27568/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 10:33:07 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27567/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<a class="blog-p-user-name" id="bp_22t2royH" href="/user/8989/" bx-tooltip-user-id="8989">Алексей</a>, <br />Для того чтобы понять причину нужен весь код целиком, а не только часть <br />
			<i>07.11.2017 10:26:28, Sergey Gorokhov.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27567/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27567/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 10:26:28 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27565/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_RXFDPlKL" href="/user/8989/" bx-tooltip-user-id="8989">Алексей</a> написал:<br />C:\Users\KILLER\Desktop\robot_intelect\param.lua:25: attempt to compare nil with number<br /><br />ошибку теперь такую выдает <br />
====code====
<pre>&nbsp;&nbsp;tekPrice =&nbsp;&nbsp;getParamEx (KodClass,InstrumentKod,"LAST").param_value
priceMax&nbsp;&nbsp;=&nbsp;&nbsp; getParamEx (KodClass,InstrumentKod,"PRICEMAX").param_value
priceMin =&nbsp;&nbsp; getParamEx (KodClass,InstrumentKod,"PRICEMIN").param_value
&nbsp;&nbsp;-- tekMarzha=&nbsp;&nbsp;





 function&nbsp;&nbsp; trade ()


 if (tonumber(tekPrice) =&nbsp;&nbsp;=&nbsp;&nbsp;nil&nbsp;&nbsp; or&nbsp;&nbsp;tonumber(priceMin)&nbsp;&nbsp;=&nbsp;&nbsp;=&nbsp;&nbsp; nil&nbsp;&nbsp; or&nbsp;&nbsp;tonumber(priceMax) =&nbsp;&nbsp;=&nbsp;&nbsp;nil ) then 

 SetCell (TableID, 2 , 4 ,"Не удалось получить цены с графика, нет соеденения с сервером ! ")
WriteToEndOfFile(LogFile,"Не удалось получить цены с графика, нет соеденения с сервером ! ")


 end 


 if (tonumber(tekPrice)&nbsp;&nbsp;&#60;&nbsp;&nbsp;tonumber(priceMin) ) then&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;25 строка 


transaction&nbsp;&nbsp;=&nbsp;&nbsp;{
ACCOUNT = TorShet,
CLIENT_CODE = KodClient,
TYPE =&nbsp;&nbsp;"M" ,
TRANS_ID =&nbsp;&nbsp;"7" ,
CLASSCODE = KodClass,
SECCODE = InstrumentKod,
ACTION =&nbsp;&nbsp;"NEW_ORDER" ,
OPERATION =&nbsp;&nbsp;"B" ,
PRICE = tostring(tekPrice),
QUANTITY = tostring(LotUp)
}

transaction.TRANS_ID&nbsp;&nbsp;=&nbsp;&nbsp; "12345" 
 sendTransaction (transaction)

 elseif (tonumber(tekPrice)&nbsp;&nbsp;&#62;&nbsp;&nbsp;tonumber(priceMax)) then 
transaction&nbsp;&nbsp;=&nbsp;&nbsp;{
ACCOUNT = TorShet,
CLIENT_CODE = KodClient,
TYPE =&nbsp;&nbsp;"M" ,
TRANS_ID =&nbsp;&nbsp;"8" ,
CLASSCODE = KodClass,
SECCODE = InstrumentKod,
ACTION =&nbsp;&nbsp;"NEW_ORDER" ,
OPERATION =&nbsp;&nbsp;"S" ,
PRICE = tostring(tekPrice),
QUANTITY = tostring(LotUp)
}

transaction.TRANS_ID&nbsp;&nbsp;=&nbsp;&nbsp; "12345" 
 sendTransaction (transaction)


 end 

 end 
&nbsp;&nbsp;</pre>
=============
<br />=============<br />Рынок сейчас работает,номер счета правильный и код класса тоже <br />
			<i>07.11.2017 10:19:10, Алексей.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27565/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27565/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 10:19:10 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27564/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			C:\Users\KILLER\Desktop\robot_intelect\param.lua:25: attempt to compare nil with number<br /><br />ошибку теперь такую выдает <br />
====code====
<pre>tekPrice=getParamEx(KodClass,InstrumentKod,"LAST").param_value
priceMax = getParamEx(KodClass,InstrumentKod,"PRICEMAX").param_value
priceMin= getParamEx(KodClass,InstrumentKod,"PRICEMIN").param_value
 -- tekMarzha= 





function trade()


if(tonumber(tekPrice)==nil or tonumber(priceMin) == nil or tonumber(priceMax)==nil)then

SetCell(TableID,2,4,"Не удалось получить цены с графика, нет соеденения с сервером!")
WriteToEndOfFile(LogFile,"Не удалось получить цены с графика, нет соеденения с сервером!")


end


if(tonumber(tekPrice) &#60; tonumber(priceMin) )then&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;25 строка


transaction = {
ACCOUNT=TorShet,
CLIENT_CODE=KodClient,
TYPE="M",
TRANS_ID="7",
CLASSCODE=KodClass,
SECCODE=InstrumentKod,
ACTION="NEW_ORDER",
OPERATION="B",
PRICE=tostring(tekPrice),
QUANTITY=tostring(LotUp)
}

transaction.TRANS_ID = "12345"
sendTransaction(transaction)

elseif(tonumber(tekPrice) &#62; tonumber(priceMax))then
transaction = {
ACCOUNT=TorShet,
CLIENT_CODE=KodClient,
TYPE="M",
TRANS_ID="8",
CLASSCODE=KodClass,
SECCODE=InstrumentKod,
ACTION="NEW_ORDER",
OPERATION="S",
PRICE=tostring(tekPrice),
QUANTITY=tostring(LotUp)
}

transaction.TRANS_ID = "12345"
sendTransaction(transaction)


end

end
</pre>
============= <br />
			<i>07.11.2017 10:17:38, Алексей.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27564/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27564/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 10:17:38 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27559/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_Rcw1XW2m" href="/user/8989/" bx-tooltip-user-id="8989">Алексей</a> написал:<br />Есть еще вопрос, существует ли параметр что бы считать минимум и максимум пред идущей свечи на графике<br />=============<br /><br />для доступа к свечкам можно использовать функцию getCandlesByIndex <br />Что касается минимумов и максимумов, то чтобы их найти нужно с чем-то сравнивать, не совсем понятно, с чем нужно сравнивать значения <br />
			<i>07.11.2017 09:21:58, Sergey Gorokhov.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27559/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27559/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 09:21:58 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27558/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Есть еще вопрос, существует ли параметр что бы считать минимум и максимум пред идущей свечи на графике <br />
			<i>07.11.2017 09:16:33, Алексей.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27558/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27558/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 09:16:33 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27557/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_5K533cwr" href="/user/459/" bx-tooltip-user-id="459">Nikolay Pavlov</a> написал:<br />возможно функция не возвращает значения, т.к. были указаны некорректный код класса или инструмента, также можно смотреть на поле getParamEx(...).result<br />					<br />						<br />=============<br /><br />или торги еще не начались <br />
			<i>07.11.2017 09:06:27, Sergey Gorokhov.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27557/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27557/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 09:06:27 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27556/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Из кода сейчас не совсем понятно, какая строка 25. Вот здесь похоже не дописали, отсутствует сравнение с nil в последнем выражении:
====code====
<pre>if(tonumber(tekPrice)==nil or tonumber(priceMin) == nil or tonumber(priceMax))then</pre>
=============
Так же для информативности выведите изначальные значения, полученные в:<br />
====code====
<pre>tekPrice=getParamEx(KodClass,InstrumentKod,"LAST").param_value
priceMax = getParamEx(KodClass,InstrumentKod,"PRICEMAX").param_value
priceMin= getParamEx(KodClass,InstrumentKod,"PRICEMIN").param_value</pre>
=============
 возможно функция не возвращает значения, т.к. были указаны некорректный код класса или инструмента, также можно смотреть на поле getParamEx(...).result <br />
			<i>07.11.2017 08:49:50, Nikolay Pavlov.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27556/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27556/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 08:49:50 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27555/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Может быть я не правильно сделал, мне нужно получить целое число в виде цены, а не таблицу, что бы его можно было использовать в конструкции if()then <br />
			<i>07.11.2017 08:39:42, Алексей.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27555/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27555/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 08:39:42 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27554/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_2l6WiCf1" href="/user/459/" bx-tooltip-user-id="459">Nikolay Pavlov</a> написал:<br />Добрый день.<br />Функция getParamEx() возвращает таблицу Lua. В диагностике об ошибке явно сказано, 'попробуйте сравнить два значения таблицы'. Т.е. Вам нужно сделать, например, так:
====code====
<pre>&nbsp;&nbsp;priceMax&nbsp;&nbsp;=&nbsp;&nbsp; getParamEx (KodClass,InstrumentKod,"PRICEMAX").param_value
priceMin =&nbsp;&nbsp; getParamEx (KodClass,InstrumentKod,"PRICEMIN").param_value

 function&nbsp;&nbsp; trade ()
&nbsp;&nbsp; if (tekPrice&nbsp;&nbsp;&#60;&nbsp;&nbsp;=&nbsp;&nbsp;priceMin)&nbsp;&nbsp;then&nbsp;&nbsp;&nbsp;&nbsp; --20 строка error 
&nbsp;&nbsp; .. .
&nbsp;&nbsp;</pre>
=============
Почитайте внимательно описание используемых Вами функций QLua в справке.<br />=============<br /><br /><br /><br />сделал так теперь выдает другую ошибку C:\Users\KILLER\Desktop\robot_intelect\param.lua:25: attempt to compare nil with number<br />
====code====
<pre>tekPrice=getParamEx(KodClass,InstrumentKod,"LAST").param_value
priceMax = getParamEx(KodClass,InstrumentKod,"PRICEMAX").param_value
priceMin= getParamEx(KodClass,InstrumentKod,"PRICEMIN").param_value
 -- tekMarzha= 





function trade()


if(tonumber(tekPrice)==nil or tonumber(priceMin) == nil or tonumber(priceMax))then

SetCell(TableID,2,4,"Не удалось получить цены с графика, нет соеденения с сервером!")
WriteToEndOfFile(LogFile,"Не удалось получить цены с графика, нет соеденения с сервером!")


end


if(tonumber(tekPrice) &#60;= tonumber(priceMin) )then&nbsp;&nbsp; --20 строка error


transaction = {
ACCOUNT=TorShet,
CLIENT_CODE=KodClient,
TYPE="M",
TRANS_ID="7",
CLASSCODE=KodClass,
SECCODE=InstrumentKod,
ACTION="NEW_ORDER",
OPERATION="B",
PRICE=tostring(tekPrice),
QUANTITY=tostring(LotUp)
}

transaction.TRANS_ID = "12345"
sendTransaction(transaction)

elseif(tonumber(tekPrice) &#62;= tonumber(priceMax))then
transaction = {
ACCOUNT=TorShet,
CLIENT_CODE=KodClient,
TYPE="M",
TRANS_ID="8",
CLASSCODE=KodClass,
SECCODE=InstrumentKod,
ACTION="NEW_ORDER",
OPERATION="S",
PRICE=tostring(tekPrice),
QUANTITY=tostring(LotUp)
}

transaction.TRANS_ID = "12345"
sendTransaction(transaction)


end

end

</pre>
============= <br />
			<i>07.11.2017 08:31:14, Алексей.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27554/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27554/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 08:31:14 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27553/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Добрый день.<br />Функция getParamEx() возвращает таблицу Lua. В диагностике об ошибке явно сказано, 'попробуйте сравнить два значения таблицы'. Т.е. Вам нужно сделать, например, так:
====code====
<pre>priceMax = getParamEx(KodClass,InstrumentKod,"PRICEMAX").param_value
priceMin= getParamEx(KodClass,InstrumentKod,"PRICEMIN").param_value

function trade()
&nbsp;&nbsp;if(tekPrice &#60;= priceMin) then&nbsp;&nbsp; --20 строка error
&nbsp;&nbsp;...
</pre>
=============
Почитайте внимательно описание используемых Вами функций QLua в справке. <br />
			<i>07.11.2017 07:05:11, Nikolay Pavlov.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27553/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27553/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 07:05:11 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Ошибка, attempt to compare two table values</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message27550/topic3197/">Ошибка, attempt to compare two table values</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Здравствуйте помогите исправить ошибку, я учу язык qlua и встал в тупик с этой ошибкой<br />
====code====
<pre>C:&#92;Users&#92;KILLER&#92;Desktop&#92;robot_intelect&#92;param.lua:20: attempt to compare two table values&nbsp;&nbsp;--Это ошибка в quik


Сам код 


tekPrice=getParamEx(KodClass,InstrumentKod,"LAST")
priceMax = getParamEx(KodClass,InstrumentKod,"PRICEMAX")
priceMin= getParamEx(KodClass,InstrumentKod,"PRICEMIN")
 -- tekMarzha= 





function trade()




if(tekPrice &#60;= priceMin )then&nbsp;&nbsp; --20 строка error


transaction = {
ACCOUNT=TorShet,
CLIENT_CODE=KodClient,
TYPE="M",
TRANS_ID="7",
CLASSCODE=KodClass,
SECCODE=InstrumentKod,
ACTION="NEW_ORDER",
OPERATION="B",
PRICE=tostring(tekPrice),
QUANTITY=tostring(LotUp)
}

transaction.TRANS_ID = "12345"
sendTransaction(transaction)

elseif(tekPrice &#62;= priceMax)then
transaction = {
ACCOUNT=TorShet,
CLIENT_CODE=KodClient,
TYPE="M",
TRANS_ID="8",
CLASSCODE=KodClass,
SECCODE=InstrumentKod,
ACTION="NEW_ORDER",
OPERATION="S",
PRICE=tostring(tekPrice),
QUANTITY=tostring(LotUp)
}

transaction.TRANS_ID = "12345"
sendTransaction(transaction)


end

end
</pre>
============= <br />
			<i>07.11.2017 06:56:48, Алексей.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message27550/topic3197/</link>
			<guid>http://forum.quik.ru/messages/forum10/message27550/topic3197/</guid>
			<pubDate>Tue, 07 Nov 2017 06:56:48 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
	</channel>
</rss>
