[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EquisMetaStock Group] Date data with MDK / MSX using PowerBasic



PureBytes Links

Trading Reference Links

Hi,

Anyone writing their own Metastock External Functions (MSX) with the MDK who either: 
a) writes in (Power) BASIC rather than C++, and/or
b) has enough experience with MSX DLL's to  be able to help me , 
could you please advise me regarding getting the Date array as a function output from the MSX data structure.

Below is an example of part of the code that I wrote to access "DOHLCV" data.
It works fine for the "OHLCV" part  (the example shows "H"), but it doesn't work for the "D" part. 
I assume that I am simply missing some required step, due to that fact that the "OHLCV" parts are floating point variables, 
but "D" is data type "long". However the MDK manual does not make it clear exactly what the required syntax is.

I think that the MSX part of the MDK is great, but the manual is not quite adequate.
Please help, anyone .....


Regards,
Tony M

Metastock MSX example follows:

===================================================================

FUNCTION MyDate SDECL ALIAS "MyDate"(BYVAL a_psDataRec AS MSXDataRec PTR, _
                                                  BYVAL a_psDataInfoArgs AS MSXDataInfoRecArgsArray PTR, _
                                                  BYVAL a_psNumericArgs AS MSXNumericArgsArray PTR, _
                                                  BYVAL a_psStringArgs AS MSXStringArgsArray PTR, _
                                                  BYVAL a_psCustomArgs AS MSXCustomArgsArray PTR, _
                                                  BYVAL a_psResultRec AS MSXResultRec PTR) _
                                                  EXPORT AS LONG

  LOCAL l_bRtrn AS LONG
  l_bRtrn = %MSX_SUCCESS

  LOCAL l_psData AS MSXDataInfoRec PTR
  LOCAL l_iStartIndex AS LONG
  LOCAL l_iMaxIndex AS LONG
  DIM i AS INTEGER
        l_psData = @a_psDataInfoArgs.psDataInfoRecs(0)    'Input data array
        l_iStartIndex = @l_psData.iFirstValid
        l_iMaxIndex = @l_psData.iLastValid
        @a_psResultRec.@xxxxxxxxxxxxxxxxxxxxxxxxx = @l_psData.iFirstValid
        @a_psResultRec.@xxxxxxxxxxxxxxxxxxxxxxxx = @l_psData.iLastValid

' *** So far, down to here is all standard stuff for MSX functions  *****************

  LOCAL l_psHigh AS MSXDataInfoRec PTR                    '***  For the "H" part of "DOHLC" data array  ***
  l_psHigh = VARPTR(@a_psDataRec.sHigh)



  LOCAL l_psDate AS MSXDataInfoRec PTR                    '***  For the "D" part of "DOHLC" data array ***

  l_psDate = VARPTR(@a_psDataRec.psDate)
      
  FOR i = l_iStartIndex TO l_iMaxIndex
        @a_psResultRec.@xxxxxxxxxxxxxx@pfValue[i] = CSNG(@l_psHigh.@xxxxxxx[i])    '*** "H":  THIS WORKS ***
        @a_psResultRec.@xxxxxxxxxxxxxx@pfValue[i] = CLNG(@l_psDate.@xxxxxxx[i])     '*** "D": THIS DOESN'T ***
  NEXT i

  MyDate = l_bRtrn
END FUNCTION                                                              


 



 
____________________________________________________________________________________
The fish are biting. 
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php

[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/equismetastock/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:equismetastock-digest@xxxxxxxxxxxxxxx 
    mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/