COCO研究院

 找回密碼
 註冊
搜索
查看: 5314|回復: 6

[其他程式語言] [請益]關於程式交易

[複製鏈接]
發表於 18-3-31 13:10 | 顯示全部樓層 |閱讀模式
本帖最後由 lc754032 於 18-3-31 13:31 編輯

最近使用永豐eleader他們的程式交易我想設定8:45的開盤點 但是卻變這副德性 = =


後來只好用成手動輸入價位 ><"
但還是想知道開盤點到底要設哪個參數... 想去回測過去的績效


還有第二個問題是
如果出單有2個機制
"如果A條件不符合的話,就收盤出單"該怎麼寫這個的語法呢.....
我試過好幾次 有試過OR根AND 都不是我要呈現出來的訊號><"
也爬了好幾篇文章 但還是沒能成功 ><"

我這樣子寫收盤時間擺在上面 結果收盤的訊號硬生生不見=口=

哀 還請各位大大們幫幫我指點迷津><"""


未命名.jpg
未命名.jpg
發表於 18-4-1 20:52 | 顯示全部樓層
eleader 是用 PYTHON 寫的
所以建議直接使用 PYTHON 來寫程式交易會更好
 樓主| 發表於 18-4-1 21:20 | 顯示全部樓層
Simon 發表於 18-4-1 20:52
eleader 是用 PYTHON 寫的
所以建議直接使用 PYTHON 來寫程式交易會更好

Simon 大大 我們開盤的第1跟k棒 如果要用pyhton的語法寫的話是該設哪個函數啊
發表於 18-4-2 19:05 | 顯示全部樓層
本帖最後由 Simon 於 18-4-2 19:08 編輯

因為 Python 我也不會, 只能找到一篇 E LEADER 的PYTHON 語法給你參考囉。
1. e-leader language is base on Python
   so you can use python grammer and function

2. there are some functions belows

array   : make new array - x = accum(array(len(c), 1))
iff   :  accumulate values - accum(iff(c>c[1], 1, 0), 15) * 100 /15
max   : max value betwwen 2 data - max(c[1], h)
max3   : max value betwwen 3 data -max3(h[1] - l[1], c - h[1], c - l[1])
min   : min value
min3  : min value
lowest  : lowest value in specific period - lowest(l, 10)
llv     : llv(v, 10)
highest : highest value in specific period  - highest(h, 20)  
hhv    : hhv(c,10)
sqrt    : sqrt(100) or sqrt(c)
pow     : pow(c,2)
log     : log(c/c[1]),period)
log10   
sin   
cos   
tan   
atan   
floor   : floor(c,2)
ma      
ema   
wma   
accum  :   accum((((c-l)-(h-c))/(h-l))*v) or accum(array(len(c), 1))
cum   
std    : std(c, 10)
corr   : corr(c,h,10)
ref    :
barsince : barsince(c>h)
highestbars
lowestbars  
hhvbars  : hhvbars(h, 15)
llvbars  : llvbars(l, 15)
mid      : mid(c,10)
cross   
crossover  
crossunder  
trend   
reverse  

some samples

1. binary wave

#buy condition :
maperiod = 20
rocperiod = 14
stoperiod1 = 5
stoperiod2 = 4
cond1 = iff (ma(c,12)-ma(c,26) > ma(ma(c,12)-ma(c,26),9), 1,-1)
cond2 =  iff (c > ma(c, maperiod), 1, -1)
cond3 = iff ((c - c[rocperiod]) / c[rocperiod] * 100 > 0, 1, -1)
cond4 =  iff (ema((c-lowest(l, stoperiod1)) / (highest(h, stoperiod1) - lowest(l, stoperiod1)) * 100, stoperiod2)>50, 1, -1)

(cond1 + cond2 + cond3 + cond4 > 0)

#sell condition
maperiod = 20
rocperiod = 14
stoperiod1 = 5
stoperiod2 = 4
cond1 = iff (ma(c,12)-ma(c,26) > ma(ma(c,12)-ma(c,26),9), 1,-1)
cond2 =  iff (c > ma(c, maperiod), 1, -1)
cond3 = iff ((c - c[rocperiod]) / c[rocperiod] * 100 > 0, 1, -1)
cond4 =  iff (ema((c-lowest(l, stoperiod1)) / (highest(h, stoperiod1) - lowest(l, stoperiod1)) * 100, stoperiod2)>50, 1, -1)

(cond1 + cond2 + cond3 + cond4 < 0)


sample 2 - standard error band (top band calculation)
period = 10
x = accum(array(len(c), 1))

sx = accum(x, period)
sy = accum(c, period)
sxy = accum(x * c, period)
sx2 = accum(pow(x,2), period)
sy2 = accum(pow(c,2), period)
bdata = ((period * sxy - sx * sy) / (period * sx2 - pow(sx,2)))
adata = ((sy - bdata * sx) / period)
stde = sqrt(abs((1.0 / (period * (period - 2))) * ((period * sy2 - pow(sy,2)) -  (pow((period * sxy - sx * sy), 2)) /   (period * sx2 - pow(sx,2)))))

stderrvalue = adata + (bdata * x) + (2 * stde)

評分

參與人數 1金錢 +2 收起 理由
cukie + 2 感謝大大分享

查看全部評分

 樓主| 發表於 18-4-13 09:50 | 顯示全部樓層
感謝SIMON大大的分享~~ 我研究看看ㄎㄎㄎ  
發表於 18-4-14 11:57 | 顯示全部樓層

感謝SIMON大大的分享
發表於 18-4-14 14:14 | 顯示全部樓層
感謝各位大大的知識分享.
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

手機版|Archiver|站長信箱|廣告洽詢|COCO研究院

GMT+8, 24-4-27 11:23

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回復 返回頂部 返回列表
理財討論網站 | AI繪圖AI超擬真美女AI beauty AI Stable DiffusionAI正妹AI Lookbook