四周規(guī)則能寫(xiě)成VBA模板嗎,方便大家學(xué)習(xí) [金字塔]
- 咨詢(xún)內(nèi)容:
四周規(guī)則能寫(xiě)成VBA模板嗎,方便大家學(xué)習(xí)
HHN:=ref(HHV(HIGH,20),1);
HLN:=ref(LLV(LOW,20),1);IF H>=HHN then
begin
sellshort(holding<0,0,thisclose);
buy(holding=0,1,thisclose);
endIF L<=HLN then
begin
sell(holding>0,0,thisclose);
buyshort(holding=0,1,thisclose);
end - 金字塔客服:
有必要嗎
圖表可以實(shí)現(xiàn) VBA還要寫(xiě)一遍。
- 用戶(hù)回復(fù):
任何策略都可以用VBA來(lái)實(shí)現(xiàn),只是代碼量比后臺(tái)或圖表策略大的多,調(diào)試也需要較長(zhǎng)的時(shí)間。
如果只是單純的實(shí)現(xiàn)開(kāi)平倉(cāng)的目的,沒(méi)有必要使用VBa來(lái)做的。
- 網(wǎng)友回復(fù):
Sub ForWeekRule
dim code
dim market
dim cyctype
dim highest
dim lowest
code="RU00"
market="SQ"
cyctype=5
set historydata =marketdata.GetHistoryData(code,market,cyctype)
for i=historydata.count-22 to historydata-2
if historydata.high(i)>highest then
highest=historydata.high(i)
end if
if historydata.low(i)<lowest then
lowest=historydata.low(i)
end if
next
if historydata(historydata.count-1)>highest then
order.buyshort 1,1,0,0,code,market,0,0
order.buy 1,1,0,0,code,market,0,0
end if
if historydata(historydata.count-2)<lowest then
order.SellShort 1,1,0,0,code,market,0,0
order.sell 1,1,0,0,code,market,0,0
end if
end sub - 網(wǎng)友回復(fù):
強(qiáng)Sub ForWeekRule
dim code
dim market
dim cyctype
dim highest
dim lowest
code="RU00"
market="SQ"
cyctype=5
set historydata =marketdata.GetHistoryData(code,market,cyctype)
for i=historydata.count-22 to historydata-2
if historydata.high(i)>highest then
highest=historydata.high(i)
end if
if historydata.low(i)<lowest then
lowest=historydata.low(i)
end if
next
if historydata(historydata.count-1)>highest then
order.buyshort 1,1,0,0,code,market,0,0
order.buy 1,1,0,0,code,market,0,0
end if
if historydata(historydata.count-2)<lowest then
order.SellShort 1,1,0,0,code,market,0,0
order.sell 1,1,0,0,code,market,0,0
end if
end sub
相關(guān)文章
-
沒(méi)有相關(guān)內(nèi)容