COCO研究院

 找回密碼
 註冊
搜索
查看: 7957|回復: 7

新手請教大大除錯問題

[複製鏈接]
發表於 11-7-8 12:52 | 顯示全部樓層 |閱讀模式
我直接把指標的程式碼加到策略後除錯,出現錯誤訊息:
如果單獨用策略也無法進出,是那裡有誤煩請大大解惑。
------ 編譯時產生錯誤: ------
Keyword "Plot**" can't been used in this type of study
errLine 0, errColumn 0, errLineEnd 0, errColumnEnd 0
編譯錯誤:  (函數)

程式碼:
inputs:  AfStep( 0.02), AfLimit( 0.2 ) ,tm(1300) ;
variables: var0( 0 ), var1( 0 ), var2( 0 ), var3( 0 ), var4( "" ) ;
Value1 = ParabolicSAR ( AfStep, AfLimit, var0, var1, var2, var3 ) ;
Plot1( var0, "ParCl" ) ;
if var3 = 1 then
  Alert( "Bullish reversal" )
else if var3 = -1 then
  Alert( "Bearish reversal" ) ;
If time >= 0845 and time <= Tm
and marketposition = 0 then begin
If close cross over value1 then buy next bar at open;
If close cross under value1 then sellshort next bar at open;
End;
If marketposition > 0  then begin
If  close cross under value1 then sellshort next bar at open;
End;
If marketposition < 0   then begin
If close cross over value1 then buy next bar at open;
End;
If Time > Tm then begin
sell next bar at open;
buytocover next bar at open;
end;
發表於 11-7-8 13:10 | 顯示全部樓層
本帖最後由 minitrader 於 11-7-8 01:11 PM 編輯

Keyword "Plot**" can't been used in this type of study

明確告知  Plot 指令不能用在 signal 策略裡.

策略是策略, 指標是指標, 程式碼不能混在一起
發表於 11-7-8 14:07 | 顯示全部樓層
m大說的沒錯..
Plot指令只能用在指標中.. 不能用在策略中..
就像一些下單的動作 buy sell sellshort buytocover 等.. 也只能用在策略中.. 不能用在指標中..
 樓主| 發表於 11-7-8 14:55 | 顯示全部樓層
plot指令拿掉,可以成功編譯但策略無法進出,是我的程式寫法有誤嗎?
發表於 11-7-8 15:21 | 顯示全部樓層
可以成功編譯但策略無法進出


請問何謂 無法進出呢? 是條件滿足但訊號不會出現? 還是你想匯出但不能匯出呢?
 樓主| 發表於 11-7-8 15:38 | 顯示全部樓層
按f3後到mc圖表上新增訊號不是就會有訊號了嗎?指標掛上去也沒有出現訊號
發表於 11-7-8 16:45 | 顯示全部樓層
按f3後到mc圖表上新增訊號不是就會有訊號了嗎?指標掛上去也沒有出現訊號
casper0425 發表於 11-7-8 03:38 PM


是的.. 按F3 成功編譯後.. 就可到圖表上 新增訊號 ..
但要出現訊號.. 必須你的程式中買賣條件要成立才會出現..
你必須確定你的程式是如你的想法會產生動作的..

指標必須要掛指標上去的.. 指標掛上去並不會有訊號出現的.. 只會有指標出現..
發表於 11-7-8 18:40 | 顯示全部樓層
指標!是用來畫圖或文字甚至於警示用的!
訊號!是用來做自動交易或回測用的..
二者的定位是不同的...指標上可以加plot用來畫圖!
但該指令不能用在訊號上~
而相反的buy sell等買賣指令不能用在指標上!
^^
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

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

GMT+8, 24-5-6 09:24

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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