欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → [求助]请问STKNAME和STKLABEL这个的函数在公式里应怎样编写

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有10224人关注过本帖树形打印复制链接

主题:[求助]请问STKNAME和STKLABEL这个的函数在公式里应怎样编写

帅哥哟,离线,有人找我吗?
ricky
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:16 积分:100 威望:0 精华:0 注册:2011/3/14 12:07:43
[求助]请问STKNAME和STKLABEL这个的函数在公式里应怎样编写  发帖心情 Post By:2011/3/14 12:11:07    Post IP:113.67.92.169[只看该作者]

同题,请问STKNAME和STKLABEL这个的函数在公式里应怎样编写,表达,谢谢!!!

如飞狐的公式:在飞狐里可以出代码或名称,但在金字塔里不行,谢谢高手了!!!

_Barpos := BARPOS;
       _Year := YEAR;
      _Month := MONTH;
        _Day := DAY;
   _Datatype := DATATYPE;
_Marketlabel := MARKETLABEL;
    _StkName := STKLABEL;
       _Open := OPEN;
       _High := HIGH;
        _Low := LOW;
      _Close := CLOSE;
        _Vol := VOL;
     _Amount := AMOUNT; 

<%

Sub create(fso,path)
If fso.FolderExists(path) Then
Exit Sub
End If
If Not fso.FolderExists(fso.GetParentFolderName(path)) Then
create fso,fso.GetParentFolderName(path)
End If
fso.CreateFolder(path)
End Sub

Set fso = CreateObject("scripting.filesystemobject")
outputf = "d:\Get\TEXT\" 

create fso,outputf
set fso = Nothing

Dim Marketlabels,Stknames,Datatypes,Opens,Highs,Lows,Closes,Vols,Amounts,Years,Months,Days
     Barposes = ffl.vardata("_Barpos")
        Years = ffl.vardata("_Year")
       Months = ffl.vardata("_Month")
         Days = ffl.vardata("_Day")
    Datatypes = ffl.vardata("_Datatype")
Marketlabels = ffl.vardata("_Marketlabel")
     Stknames = ffl.vardata("_Stkname")
        Opens = ffl.vardata("_Open")
        Highs = ffl.vardata("_High")
         Lows = ffl.vardata("_Low")
       Closes = ffl.vardata("_Close")
         Vols = ffl.vardata("_Vol")
      Amounts = ffl.vardata("_Amount")

SelectCreatAsciiDataType(Datatypes)

Function SelectCreatAsciiDataType(Types)
        Select Case Types
                Case 0

                
                Case 2
                        Call CreateAsciiDataMin("-5min-")                       
                Case 3
                        Call CreateAsciiDataMin("-15min-")                        
                Case 6
                        Call CreateAsciiDataMin("-Day-")
                Case Else

                End Select
End Function

Function CreateAsciiDataMin(FolderName)

 

        Const ForReading = 1, ForWriting = 2, ForAppending = 8
        Const TristateTrue = -1,TristateFalse = 0,TristateUseDefault = -2
        Dim Fso,FileName,TextStream,LineData,ArrayLast,LastDate,AforeDate,AforeYear,AforeMonth,AforeDay
        Set Fso = CreateObject("Scripting.FileSystemObject")
        FileName = outputf & StkNames & FolderName & ".txt"
        Set TextStream = Fso.OpenTextFile(FileName, ForWriting, True)
        ArrayLast = Ubound(Barposes)
        LastDate = Years(ArrayLast) & "-" & Months(ArrayLast) & "-" & Days(ArrayLast)
        For i = 0 To ArrayLast
                AforeDate = DateAdd("d",(i-ArrayLast),LastDate)
                AforeYear = Year(AforeDate)
                AforeMonth = Month(AforeDate)
                If Len(AforeMonth) = 1 Then AforeM & AforeMonth
                AforeDay = Day(AforeDate)
                If Len(AforeDay) = 1 Then AforeDay = "0" & AforeDay
                Opens(i) = FormatNumber(Opens(i),3,,,TristateFalse)
                Highs(i) = FormatNumber(Highs(i),3,,,TristateFalse)
                Lows(i) = FormatNumber(Lows(i),3,,,TristateFalse)
                Closes(i) = FormatNumber(Closes(i),3,,,TristateFalse)
            Vols(i) = FormatNumber(Vols(i),3,,,TristateFalse)
                Amounts(i) = FormatNumber(Amounts(i),3,,,TristateFalse)
                LineData = AforeYear & "0" & AforeMonth & "0" & AforeDay & " " & Opens(i) & " " & Highs(i) & " " & Lows(i) & " " & Closes(i) & " " & Vols(i) & " " & Amounts(i)
                TextStream.WriteLine LineData
        Next
        TextStream.Close
End Function

Function CreateAsciiDataDayes()
        Const ForReading = 1, ForWriting = 2, ForAppending = 8
        Const TristateTrue = -1,TristateFalse = 0,TristateUseDefault = -2
        Dim i,Fso,FileName,TextStream,LineData,AforeLast,ArrayLast
        Set Fso = CreateObject("Scripting.FileSystemObject")
        FileName = outputf & StkNames & "-Day-" & ".txt"
        IF ReportFileStatus(FileName) = 0 Then
                Set TextStream = Fso.OpenTextFile(FileName,ForWriting,True)
                ArrayLast = Ubound(Barposes)
                For i = 0 To ArrayLast
                        If Len(Months(i)) = 1 Then Months(i) = "0" & Months(i)
                        If Len(Days(i)) = 1 Then Days(i) = "0" & Days(i)
                        Opens(i) = FormatNumber(Opens(i),3,,,TristateFalse)
                        Highs(i) = FormatNumber(Highs(i),3,,,TristateFalse)
                        Lows(i) = FormatNumber(Lows(i),3,,,TristateFalse)
                        Closes(i) = FormatNumber(Closes(i),3,,,TristateFalse)
                        Vols(i) = FormatNumber(Vols(i),3,,,TristateFalse)
                        Amounts(i) = FormatNumber(Amounts(i),3,,,TristateFalse)
                        LineData = Years(i) & "0" & Months(i) & "0" & Days(i) & " " & Opens(i) & " " & Highs(i) & " " & Lows(i) & " " & Closes(i) & " " & Vols(i) & " " & Amounts(i)
                        TextStream.WriteLine LineData
                Next
                TextStream.Close
        ElseIf ReportFileStatus(FileName) = 1 Then
                AforeLast = 0
                Set TextStream = Fso.OpenTextFile(FileName, ForReading, False)
                Do Until TextStream.AtEndOfStream = True
                TextStream.ReadLine
                AforeLast = AforeLast+1
                Loop
                TextStream.Close
                Set TextStream = Fso.OpenTextFile(FileName,ForAppending,False)
                ArrayLast = Ubound(Barposes)
                For i = AforeLast To ArrayLast
                        If Len(Months(i)) = 1 Then Months(i) = "0" & Months(i)
                        If Len(Days(i)) = 1 Then Days(i) = "0" & Days(i)
                        Opens(i) = FormatNumber(Opens(i),3,,,TristateFalse)
                        Highs(i) = FormatNumber(Highs(i),3,,,TristateFalse)
                        Lows(i) = FormatNumber(Lows(i),3,,,TristateFalse)
                        Closes(i) = FormatNumber(Closes(i),3,,,TristateFalse)
                        Vols(i) = FormatNumber(Vols(i),3,,,TristateFalse)
                        Amounts(i) = FormatNumber(Amounts(i),3,,,TristateFalse)
                        LineData = Years(i) & "0" & Months(i) & "0" & Days(i) & " " & Opens(i) & " " & Highs(i) & " " & Lows(i) & " " & Closes(i) & " " & Vols(i) & " " & Amounts(i)
                        TextStream.WriteLine LineData
                Next
                TextStream.Close
        End If       
End Function

Function ReportFileStatus(Filespec)
        Dim Fso, Status
        Set Fso = CreateObject("Scripting.FileSystemObject")
        If (Fso.FileExists(Filespec)) Then
                Status = 1
        Else
                Status = 0
        End If
        ReportFileStatus = Status
End Function

 

%>
0;drawtextex(1,0,5,5, Stkname);

[此贴子已经被作者于2011-3-14 12:34:39编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
董小球
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 大哥
等级:超级版主 帖子:2837 积分:13237 威望:0 精华:2 注册:2010/7/14 17:31:54
  发帖心情 Post By:2011/3/14 13:43:42    Post IP:58.246.57.26[只看该作者]

不知道你是什么意图,这两个函数是取品种代码和名字的

 

你可以用下面的简单的例子来输出出来:

aa:=STKNAME;
bb:=STKLABEL;
DRAWTEXT(1,LOW,aa&bb);



金字塔—专业程序化交易量化投资平台

客户服务部

-----------------------------------------------------------

欢迎您参加我公司的技术培训,具体培训需求请发邮件到

service@weistock.com

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com

 回到顶部
帅哥哟,离线,有人找我吗?
阿火
  3楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 原leevolvo
等级:版主 帖子:2160 积分:10563 威望:0 精华:11 注册:2010/11/3 11:21:19
  发帖心情 Post By:2011/3/14 13:44:19    Post IP:222.76.159.75[只看该作者]

金字塔是用 drawtext 这个函数显示字符窜

如 :drawtext(c>o,L,stkname);


 回到顶部
帅哥哟,离线,有人找我吗?
admin
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:7302 积分:32559 威望:1000 精华:45 注册:2003/12/30 16:34:32
  发帖心情 Post By:2011/3/14 14:27:00    Post IP:58.246.57.26[只看该作者]

Marketlabels = ffl.StrVarData("_Marketlabel")
     Stknames = ffl.StrVarData("_Stkname")


 回到顶部
帅哥哟,离线,有人找我吗?
ricky
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:16 积分:100 威望:0 精华:0 注册:2011/3/14 12:07:43
  发帖心情 Post By:2011/3/14 14:50:23    Post IP:113.67.92.169[只看该作者]

意图是输出成带股票名称的TXT文件,如此句:FileName = outputf & StkNames & "-Day-" & ".txt",输出的文件应该是“XXXX(股票名称)-Day-.TXT”,谢谢了!!


 回到顶部
帅哥哟,离线,有人找我吗?
ricky
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:16 积分:100 威望:0 精华:0 注册:2011/3/14 12:07:43
  发帖心情 Post By:2011/3/14 15:09:27    Post IP:113.67.92.169[只看该作者]

哦,可以了,谢谢admin大哥,谢谢各位了,谢谢!!!


 回到顶部