Евгений (Все сообщения пользователя)

Выбрать дату в календареВыбрать дату в календаре

Страницы: 1
Помогите с приоритетом операций, Какие действия выполняются в какую очередь?
 
Понятно что во всех языках так. Но Купл язык удивительный и непредсказуемый - а вдруг в нем не так. В инструкции к нему не слова об этом - что логические операции <>= в приоритете перед математическими*/+-. Просто экспериментальным путем не хочется выяснять.
Помогите с приоритетом операций, Какие действия выполняются в какую очередь?
 
В языке Lua выполнение операций осуществляется в соответствии со следующим приоритетом (в порядке убывания):
  • ^
  • not # - (унарный)
  • * / %
  • + -
  • ..
  • < > <= >= ~= ==
  • and
  • or
В QPILE ВСЕ ТАК ЖЕ ???
Помогите с приоритетом операций, Какие действия выполняются в какую очередь?
 
Цитата
s_mike@rambler.ru написал:
Порядок операций языка луа
s_mike@rambler.ru, я конечно гуглил прежде чем задать вопрос.

Меня интересует именно Купл. Как это там, потому что всякое может быть. Может как и везде сначала математика, а может и нет. Язык то специфический =
Много чего что в других есть в нем нет, и скобки вот не понимает в большом количестве. Может и с приоритетами какая путанца.

меня именно такая конструкция интересует

if a > b and b > c and gamma >= ( delta / 2 ) or ...

- нужны ли здесь скобки для delta / 2 (delta + 2, delta - 2, delta * 2 - любого из них ), или и без скобок правильно поймет?
Помогите с приоритетом операций, Какие действия выполняются в какую очередь?
 
Цитата
s_mike@rambler.ru написал:
Порядок операций языка луа
Спасибо за отклик!
Но нужен не луа, нужен Qpile
Помогите с приоритетом операций, Какие действия выполняются в какую очередь?
 
Другими словами обязательно ли нужны скобки в выражении:

x > ( y + 1 )


???????????????????
Помогите с приоритетом операций, Какие действия выполняются в какую очередь?
 
Мне нужна такая строчка
a<=1 or (b<(c/2) and a>1 and a<=1))

Каков приоритет логических по сравнению с математическими действиями?
Сначала выполняются математические?

Могу ли я убрать скобки из (с/2)   ?????????????

Идентичны ли эти два выражения:

b<(с/2)  and a>1 and a<=1   и выражение      b<с/2  and a>1 and a<=1


Спасибо!
Есть функция OHLC для прошлых свечей - помогите разобраться, как вытащить из нее OHLC дневных свечей по номеру свечи
 
Вот это спасибо!!!
Есть функция OHLC для прошлых свечей - помогите разобраться, как вытащить из нее OHLC дневных свечей по номеру свечи
 
Само собой самописная. Работает великолепно, на всех таймфреймах кроме ДНЕВКИ.

То что вы выложили, работатет только до 60 минут. А нужен день. У вас есть функция для
вывода open, high, low, close  для заданного количества свечей в прошлое по номерам 1,2,3, 4....???
Ваш пример мне бесполезен.

Или помогите вытащить дневки из моего кода. Они там есть, но у меня знаний программирования
не хватает чтобы понять как их достать. Остальное достал - там пару ошибок было поправил, и теперь
тащит всё - от минуты до 4 часов включитльно.
А ДЕНЬ НЕ ХОЧЕТ. НУЖЕН ДЕНЬ !!!!!!!!!!!!!!
Есть функция OHLC для прошлых свечей - помогите разобраться, как вытащить из нее OHLC дневных свечей по номеру свечи
 
Все остальное  - все таймфреймы работают, значения свечей вытаскиваются так:
close1=get_collection_item(close_col,1)+0
high1=get_collection_item(high_col,1)+0
low1=get_collection_item(low_col,1)+0
open1=get_collection_item(open_col,1)+0

1 - предыдущая от текущей, 2 - пред-предыдущая и т.д.

А ДНЕВНЫЕ НЕ ТАЩИТ - как вытащить их? HELP!!!!!


Вот сама функция:


FUNC get_prices(id,market)
new_global("cur_time_bar_pred",0)
new_global("close_pred",0)
new_global("open_pred",0)
new_global("high_pred",0)
new_global("low_pred",0)
time=get_datetime()
servertime=GET_INFO_PARAM("SERVERTIME")
'hour=get_value(time,"HOUR")
'min=get_value(time,"MIN")
hour=SUBSTR(servertime,0,2)
min=SUBSTR(servertime,3,2)
day=get_value(time,"DAY")
month=get_value(time,"MONTH")
year=get_value(time,"YEAR")
cur_date=year*10000+month*100+day
cur_time=hour*10000+min*100
true_date=0
sdelka=get_info_param("USERID")-48
for i from 0 to 100000
 candle=get_candle(id,cur_date,183000,0)
 if (get_value(candle,"open")+0)=0  
  if (day+0)<2
   month=month-1
   day=32
   if month=0
    month=12
    year=year-1
   end if
  end if
  day=day-1
  cur_date=year*10000+month*100+day
 else
  true_date=cur_date
  break
 end if  
end for
timeframe_collection=create_collection()
hour=18
min=30
time=hour*10000+min*100
pred_time="0"
j=0
timeframe=""
for i from 0 to 1000
 candle=get_candle(id,true_date,time,0)
 if (get_value(candle,"time")+0)=0
  timeframe="day"
  break
 end if
 if get_value(candle,"time")&""=pred_time&""
 else
  timeframe_collection=insert_collection_item(timeframe_collection,j,get_value(candle,"time"))
  pred_time=get_value(candle,"time")
  j=j+1
 end if
 if min=0
  hour=hour-1
  min=59
 else
  min=min-1
 end if
 time=hour*10000+min*100
 if (get_collection_count(timeframe_collection)+0)>1
  break
 end if
end for
dateframe_collection=create_collection()
counter=0
time=get_datetime()
day=get_value(time,"DAY")
month=get_value(time,"MONTH")
year=get_value(time,"YEAR")
cur_date=year*10000+month*100+day
pred_open=0
pred_high=0
pred_close=0
pred_low=0
if (timeframe&"")=="day"
 for i from 0 to  1000
  candle=get_candle(id,cur_date,150000,0)
  if (get_value(candle,"open")+0)!=(pred_open+0) or (get_value(candle,"high")+0)!=(pred_high+0) or (get_value(candle,"close")+0)!=(pred_close+0)
   if (get_value(candle,"close")+0)!=0
    dateframe_collection=INSERT_COLLECTION_ITEM(dateframe_collection,counter,cur_date)    
    pred_open=get_value(candle,"open")
    pred_high=get_value(candle,"high")
    pred_close=get_value(candle,"close")
    pred_low=get_value(candle,"low")
    counter=counter+1
   end if
  end if
  if (day+0)=1
   month=month-1
   day=32
   if (month+0)=0
    month=12
    year=year-1
   end if
  end if
  day=day-1  
  if get_collection_count(dateframe_collection)>20
   break    
  end if
  cur_date=year*10000+month*100+day
 end for
end if
hour1=SUBSTR (get_collection_item(timeframe_collection,0), 0, 2) +0
min1=SUBSTR (get_collection_item(timeframe_collection,0), 2, 2) +0
hour2=SUBSTR (get_collection_item(timeframe_collection,1), 0, 2)+0
min2=SUBSTR (get_collection_item(timeframe_collection,1), 2, 2) +0
chislo=0
tt53 = timeframe&""
if tt53<>"" or tt53<>"day"
 if hour1==hour2
  if (min1-min2)=1
   timeframe=1
   chislo=1
  end if
  if (min1-min2)=2
   timeframe=2
   chislo=1
  end if
  if (min1-min2)=3
   timeframe=3
   chislo=1
  end if
  if (min1-min2)=4
   timeframe=4
   chislo=1
  end if
  if (min1-min2)=5
   timeframe=5
   chislo=1
  end if
  if (min1-min2)=6
   timeframe=6
   chislo=1
  end if
  if (min1-min2)=10
   timeframe=10
   chislo=1
  end if
  if (min1-min2)=15
   timeframe=15
   chislo=1
  end if
  if (min1-min2)=20
   timeframe=20
   chislo=1
  end if
  if (min1-min2)=30
   timeframe=30
   chislo=1
  end if
 end if
 if hour1<>hour2
  if (hour1-hour2)=1
   timeframe=60
   chislo=1
  end if
  if (hour1-hour2)=2
   timeframe=120
   chislo=1
  end if
  if (hour1-hour2)=4
   timeframe=240
   chislo=1
  end if
 end if
end if
hour1=SUBSTR (get_collection_item(timeframe_collection,0), 0, 2)
min1=SUBSTR (get_collection_item(timeframe_collection,0), 2, 2)
hour2=SUBSTR (get_collection_item(timeframe_collection,1), 0, 2)
min2=SUBSTR (get_collection_item(timeframe_collection,1), 2, 2)
day_temp=0
time=get_datetime()
servertime=GET_INFO_PARAM("SERVERTIME")
hour=SUBSTR(servertime,0,2)
min=SUBSTR(servertime,3,2)
day=get_value(time,"DAY")
correct_day=day
month=get_value(time,"MONTH")
year=get_value(time,"YEAR")
cur_date=year*10000+month*100+day
cur_time=hour*10000+min*100
LOW_col=CREATE_COLLECTION()
HIGH_col=CREATE_COLLECTION()
open_col=CREATE_COLLECTION()
CLOSE_col=CREATE_COLLECTION()
time_col=CREATE_COLLECTION()
date_col=CREATE_COLLECTION()
cur_time_bar=get_value(get_candle(id,cur_date,cur_time,0),"time")
if (cur_time_bar&"")!=""
 cur_time_bar_pred=cur_time_bar
else
 cur_time_bar=cur_time_bar_pred
end if
low_col=INSERT_COLLECTION_ITEM(low_col,0,get_value(get_candle(id,cur_date,cur_time_bar,0),"low"))
high_col=INSERT_COLLECTION_ITEM(high_col,0,get_value(get_candle(id,cur_date,cur_time_bar,0),"high"))
open_col=INSERT_COLLECTION_ITEM(open_col,0,get_value(get_candle(id,cur_date,cur_time_bar,0),"open"))
close_col=INSERT_COLLECTION_ITEM(close_col,0,get_value(get_candle(id,cur_date,cur_time_bar,0),"close"))
time_col=INSERT_COLLECTION_ITEM(time_col,0,cur_time_bar)
date_col=INSERT_COLLECTION_ITEM(date_col,0,cur_date)
f=1
find_date=cur_date
point=0
if (chislo+0)==1
 for i from 1 to 2000
  temp3=ceil(cur_time_bar/10000)
  temp4=cur_time_bar/10000
  if temp3=temp4
   if floor(cur_time_bar/10000)=cur_time_bar/10000
    if timeframe=1
     cur_time_bar=ceil(cur_time_bar/10000-1)*10000+5900
    end if
    if timeframe=2
     cur_time_bar=ceil(cur_time_bar/10000-1)*10000+5800
    end if
    if timeframe=3
     cur_time_bar=ceil(cur_time_bar/10000-1)*10000+5700
    end if
    if timeframe=4
     cur_time_bar=ceil(cur_time_bar/10000-1)*10000+5600
    end if
    if timeframe=5
     cur_time_bar=ceil(cur_time_bar/10000-1)*10000+5500
    end if
    if timeframe=6
     cur_time_bar=ceil(cur_time_bar/10000-1)*10000+4800
    end if
    if timeframe=10
     cur_time_bar=ceil(cur_time_bar/10000-1)*10000+5000
    end if
    if timeframe=15
     cur_time_bar=ceil(cur_time_bar/10000-1)*10000+4500
    end if
    if timeframe=20
     cur_time_bar=ceil(cur_time_bar/10000-1)*10000+4000
    end if
    if timeframe=30
     cur_time_bar=ceil(cur_time_bar/10000-1)*10000+3000
    end if
    if timeframe=60
     cur_time_bar=ceil(cur_time_bar/10000-1)*10000
    end if
    if timeframe=120
     cur_time_bar=ceil(cur_time_bar/10000-2)*10000
    end if
    if timeframe=240
     cur_time_bar=ceil(cur_time_bar/10000-4)*10000
    end if
   end if
  else
   cur_time_bar=cur_time_bar-timeframe*100
  end if
  if timeframe<60
   if cur_time_bar<100000
    if (market&"")="micex"
     if timeframe=1
      cur_time_bar=184400
     end if
     if timeframe=2
      cur_time_bar=184400
     end if
     if timeframe=3
      cur_time_bar=184200
     end if
     if timeframe=4
      cur_time_bar=184400
     end if
     if timeframe=5
      cur_time_bar=184000
     end if
     if timeframe=6
      cur_time_bar=184200
     end if
     if timeframe=10
      cur_time_bar=184000
     end if
     if timeframe=15
      cur_time_bar=183000
     end if
     if timeframe=20
      cur_time_bar=184000
     end if
     if timeframe=30
      cur_time_bar=183000
     end if
    end if
    if (market&"")="forts"
     if timeframe=1
      cur_time_bar=234900
     end if
     if timeframe=2
      cur_time_bar=234800
     end if
     if timeframe=3
      cur_time_bar=234800
     end if
     if timeframe=4
      cur_time_bar=234800
     end if
     if timeframe=5
      cur_time_bar=234500
     end if
     if timeframe=6
      cur_time_bar=234800
     end if
     if timeframe=10
      cur_time_bar=234000
     end if
     if timeframe=15
      cur_time_bar=234500
     end if
     if timeframe=20
      cur_time_bar=234000
     end if
     if timeframe=30
      cur_time_bar=233000
     end if
    end if
    if timeframe>50
     if cur_time_bar=100000
      break
     end if
     if cur_time_bar<100000
      if timeframe=60
       cur_time_bar=230000
      end if
      if timeframe=120
       cur_time_bar=220000
      end if
      if timeframe=240
       cur_time_bar=200000
      end if
     end if
    end if
    usl=0
    for j from 1 to 15
     if (day+0)<2
      month=month-1
      day=32
      if month=0
       month=12
       year=year-1
      end if
     end if
     day=day-1
     cur_date=year*10000+month*100+day
     slice_day = Get_Candle_Ex(id, cur_date, 103000)
     LineCount_day=Get_Value(slice_day,"COUNT") +0
     if (usl+0)=0
      if LineCount_day>0
       find_date=cur_date
       usl=1
       break
      end if
     end if
    end for
   end if
  end if
  if timeframe>59
   if cur_time_bar<80000
    if timeframe=60
     cur_time_bar=230000
    end if
    if timeframe=120
     cur_time_bar=220000
    end if
    if timeframe=240
     cur_time_bar=200000
    end if
    usl=0
    for j from 1 to 15
     if (day+0)<2
      month=month-1
      day=32
      if month=0
       month=12
       year=year-1
      end if
     end if
     day=day-1
     curdate=year*10000+month*100+day
     slice_day = Get_Candle_Ex(id, cur_date, 103000)
     LineCount_day=Get_Value(slice_day,"COUNT") +0
     if (usl+0)=0
      if LineCOUNT_day>0
       find_date=curdate
       usl=1
       break
      end if
     end if
    end for
   end if
  end if
  slice = Get_Candle_Ex(id, find_date,cur_time_bar)
  LineCount=Get_Value(slice,"COUNT") +0
  time=Get_Value(slice,"TIME")
  lines=Get_Value(slice,"LINES")
  if f<=20
   if LineCount>0
    LineCount=Get_Value(slice,"COUNT")
    time=Get_Value(slice,"TIME")
    lines=Get_Value(slice,"LINES")
    line=Get_Collection_Item(lines, 0)
    low=Get_Value(line,"LOW")
    high=Get_Value(line,"HIGH")
    open=Get_Value(line,"OPEN")
    close=Get_Value(line,"CLOSE")
    line_name =Get_Value(line,"NAME")
    volume=Get_Value(line,"VOLUME")
    low_col=INSERT_COLLECTION_ITEM(low_col,f,low)
    high_col=INSERT_COLLECTION_ITEM(high_col,f,high)
    open_col=INSERT_COLLECTION_ITEM(open_col,f,open)
    close_col=INSERT_COLLECTION_ITEM(close_col,f,close)
    time_col=INSERT_COLLECTION_ITEM(time_col,f,cur_time_bar)
    date_col=INSERT_COLLECTION_ITEM(date_col,f,find_date)
    f=f+1
   end if
  else
   break
  end if
 end for
end if
prices=create_map()
prices=SET_VALUE(prices,"days",dateframe_collection)
prices=SET_VALUE(prices,"timeframe",timeframe)
prices=SET_VALUE(prices,"high",high_col)
prices=SET_VALUE(prices,"low",low_col)
prices=SET_VALUE(prices,"close",close_col)
prices=SET_VALUE(prices,"open",open_col)
prices=SET_VALUE(prices,"time",time_col)
prices=SET_VALUE(prices,"date",date_col)
result=prices
end func
Страницы: 1
Наверх