COCO研究院

 找回密碼
 註冊
搜索
查看: 2623|回復: 3

[其他程式語言] 語法問題請教各位大大

[複製鏈接]
發表於 16-5-14 14:32 | 顯示全部樓層 |閱讀模式
var:KB(0),KS(0),mkp(0);

value1=Close of data2;
if date <> date[1] then begin
KB=0;
KS=0;
mkp=0;
end;

if marketposition=0 and value1 > 500 then begin buy("buy")
next bar at market;
if marketposition=0 and value1<-500 then begin sellshort("sell")
next bar at market;
if marketposition>0 then KB=1;
if marketposition<0 then KS=1;

end;
mkp=marketposition;

if mkp[1] <> 1 and mkp=1 then kb=kb+1;

if mkp[1] <> -1 and mkp=-1 then ks=ks+1;

if marketposition>0 then sell next bar at entryprice-20 stop;
if marketposition>0 then sell next bar at entryprice+20 stop;
if marketposition>0 then buytocover next bar at entryprice-20 stop;
if marketposition>0 then buytocover next bar at entryprice+20 stop;


if time>=1326 then sell("exitbuy1")    this bar;
if time>=1326 then buytocover("exitshort1")    this bar;

setexitonclose;
不好意思我裡面寫的內容是副圖2指數高過500點做多停損停利都20點 跟低過500點 一天多空進出場一次請問哪邊寫錯了??

發表於 16-5-14 16:51 | 顯示全部樓層
if marketposition=0 and value1 > 500 then begin buy("buy")
next bar at market;
if marketposition=0 and value1<-500 then begin sellshort("sell")
next bar at market;
if marketposition>0 then KB=1;
if marketposition<0 then KS=1;


end;

以上這段少了 end 結束 { 有兩個 begin }
發表於 16-5-14 16:54 | 顯示全部樓層
上面紅字那段 ,可以不要 ,只留這段就可以 , 只是KB & KS 在策略內看不出來有什麼作用 ,可能要計算多空各幾次吧

if mkp[1] <> 1 and mkp=1 then kb=kb+1;

if mkp[1] <> -1 and mkp=-1 then ks=ks+1;

評分

參與人數 1金錢 +2 收起 理由
xxyyzzxyz627 + 2 太強了

查看全部評分

 樓主| 發表於 16-5-14 17:41 | 顯示全部樓層
本帖最後由 xxyyzzxyz627 於 16-5-14 17:49 編輯
easytrader788 發表於 16-5-14 16:54
上面紅字那段 ,可以不要 ,只留這段就可以 , 只是KB & KS 在策略內看不出來有什麼作用 ,可能要計算多空各幾 ...

非場謝謝你 我主是要限制一天多空各做一次  可是怎麼用都用不出來!!  希望E大可以幫個忙  請問是要修改哪一邊

修改好變這樣  快吐血哈哈 我主要 圖下面指標 大於500做多小於500做空可是現在指標 進出場點非常起怪
是因為裡面有隱藏圖的關西嗎??

圖片

圖片
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

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

GMT+8, 24-4-27 09:06

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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