 |
shine
初級會員
註冊日期: Mar 2006
來 自:
文章數量: 17 |
請問輸出字串到外部文字檔
請教各位大大,希望在指標發出買賣信號時,輸出字串到外部文字檔,但卻不斷出現VBS的執行錯誤,此時除了奇狐,並無開啟其他應用程式,請教這是什麼原因造成?又應如何修改?
謝謝!
範例:
curve : ma(C,3);
buy := cross( C, ma(C,3) );
sell := cross( ma(C,3), C );
DRAWICON( buy, ma(C,3), 4 );
DRAWICON( sell,ma(C,3), 5 );
Position := 0;
Position := if( buy, 1, Position );
Position := if( sell,-1, Position );
cur_cmd := numtostr( year,0 ) + '/' + numtostr( month,0 ) + '/' + numtostr( day,0 ) + '' + numtostr( hour,0 ) + ':' + numtostr(minute,0) + ':0' + numtostr( Position,0 ) + ' ';
<%
Dim fso, MyFile
vbs_cmd = FFL.VarData( "cur_cmd" )
Set fso = CreateObject( "Scripting.FileSystemObject" )
Set MyFile = fso.CreatTextFile( "C:\WAV\order.txt", False )
MyFile.WriteLine( vbs_cmd )
MyFile.Close
%>
|
|
向版主報告此篇 |  |
|
2010-03-10 09:32 |
|
|
|  |
 |
shine
初級會員
註冊日期: Mar 2006
來 自:
文章數量: 17 |
感謝大大的熱心說明,不過小弟碰到的狀況是,不知為何,一定會跳出VBS執行錯誤訊息,而不是偶爾或隨機出現,也就是說,每多跑一根新K棒出來,VBS執行錯誤訊息就一定會冒出來。
若是添加下列敘述,雖然就不會出錯,但是也不會開啟外部文字檔,也不會有任何買賣訊號寫到外部文字檔。
不知是否有哪位大大有此方面的解決經驗?感恩∼
<%
on error resume next
err.clear
%>
|
|
向版主報告此篇 |  |
|
2010-03-10 18:49 |
|
|
|  |
 |
ifuian
資深會員

註冊日期: May 2004
來 自: 台灣
文章數量: 558 |
這樣看行不行 ~
<%
on error resume next
Dim fso, MyFile
vbs_cmd = FFL.VarData( "cur_cmd" )
Set fso = CreateObject( "Scripting.FileSystemObject" )
Set MyFile = fso.CreatTextFile( "C:\WAV\order.txt",True )
MyFile.WriteLine( vbs_cmd )
MyFile.Close
err.clear
%>
__________________
人外有人 天外有天 不懼不貪 亦富亦安
|
|
向版主報告此篇 |  |
|
2010-03-10 19:21 |
|
|
|  |
 |
阿酷
資深會員

註冊日期: Dec 2003
來 自: 彰化
文章數量: 130 |
<%
on error resume next
Dim fso, MyFile
vbs_cmd = FFL.VarData( "cur_cmd" )
Set fso = CreateObject( "Scripting.FileSystemObject" )
Set MyFile = fso.CreatTextFile( "C:\WAV\order.txt",True )
MyFile.WriteLine( vbs_cmd )
MyFile.Close
err.clear
%>
請手動在C槽內「建立」WAV這個資料夾,試試。
祝均安。
__________________
永遠學習、學習永遠
善為傳家寶
忍為積德門
|
|
向版主報告此篇 |  |
|
2010-03-10 20:41 |
|
|
|  |
 |
hwyhon
資深會員

註冊日期: Sep 2004
來 自: 台中
文章數量: 332 |
// C:\WAV\order.txt
// 好熟悉的路徑
curve : ma(C,3);
buy := cross( C, ma(C,3) );
sell := cross( ma(C,3), C );
DRAWICON( buy, ma(C,3), 4 );
DRAWICON( sell,ma(C,3), 5 );
Position := 0;
Position := if( buy, 1, Position );
Position := if( sell,-1, Position );
Order:= numtostr( year,0 ) + '/' + numtostr( month,0 ) + '/' + numtostr( day,0 ) + '' + numtostr( hour,0 ) + ':' + numtostr(minute,0) + ':0' + numtostr( Position,0 ) + ' ';
<%
On Error Resume Next
Dim fso, MyFile
Order = FFL.VarData("Order")
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile("C:\WAV\order.txt", True)
MyFile.WriteLine (Order)
MyFile.Close
Err.Clear
%>
__________________
就是發蓊梨(ㄛㄥˇ ㄌㄞˊ) 程式交易網站
[教學]指標公式及程式交易系統撰寫 [代工]
學會指標策略程式化的撰寫,將可讓你不再盲目投下辛苦賺來的血汗錢
要知道交易的策略或交易的模式長期執行下確實可獲利
交易才有意義的.否則寧可不交易
|
|
向版主報告此篇 |  |
|
2010-03-10 21:28 |
|
|
|  |
 |
shine
初級會員
註冊日期: Mar 2006
來 自:
文章數量: 17 |
感謝大大們的熱心說明,應該OK
|
最後由 shine 在 2010-03-10 21:44 編輯 |
向版主報告此篇 |  |
|
2010-03-10 21:28 |
|
|
|  |
本站所有內容未經作者授權禁止轉貼節錄, 發表言論僅供參考勿作為投資決策依據。瀏覽本站請使用 IE 5.5 以上版本, 最佳瀏覽解析度 1024 x 768 全彩。
|
Powered by: vBulletin Version 2.3.0 - Copyright©2000-, Jelsoft Enterprises Limited.
簡愛洋行 製作 Copyright 2003-. All Rights Reserved. 聯絡我們
|