Results 1 to 2 of 2
  1. #1
    Senior Member
    Join Date
    Nov 2015
    Posts
    107

    Default An Unexpected Error

    Hi ,

    I am trying to use RelativeStrengthIndexOnArray function. Its giving the error "an unexpected error has occured" whenever this function is executed. I got this error on
    RelativeStrengthIndexOnArray MacdBuffer, Cint(9), rsiArray
    line from a script. Please why this error occured when i pass my array to this function. Please find the attached script. Guide me.

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Administrator Moath-HS's Avatar
    Join Date
    Sep 2020
    Posts
    4

    Default

    Quote Originally Posted by BGT View Post
    Hi ,

    I am trying to use RelativeStrengthIndexOnArray function. Its giving the error "an unexpected error has occured" whenever this function is executed. I got this error on
    RelativeStrengthIndexOnArray MacdBuffer, Cint(9), rsiArray
    line from a script. Please why this error occured when i pass my array to this function. Please find the attached script. Guide me.

    Thanks in advance.
    Dear BGT,
    According to your problem "an unexpected error has occurred" kindly note that when you use the RelativeStrengthIndexOnArray function there are null values were stored on the output array (rsiArray) and the number of these values equal the second parameter (Cint(9)) Multiplied by 2, these values stored at the start of your array, So you need to create a new array without these values then use it.
    ex:
    Public Sub main()

    Dim arrPrice(),imaClose(),imaOpen(),rsiResult(),cciRes ult(),ssResult(),MacdBuffer()
    Dim smaOnArray(),rsiArray(),cciArray(),ssArray(),i,j,S cript_BarsCount_

    CopyHigh 0,1,Bars(0),arrHigh
    CopyLow 0,1,Bars(0),arrLow
    CopyOpen 0,1,Bars(0),arrOpen
    CopyClose 0,1,Bars(0),arrClose
    Script_BarsCount_ = CLng(Bars(0))
    ReDim MacdBuffer(ubound(arrClose))


    RelativeStrengthIndexOnArray arrClose, cint(20), rsiResult
    'AlertMessage(rsiResult(Bars(0)-1)-50)
    For i = CLng(1) To CLng(Script_BarsCount_)
    MacdBuffer(i) = 0.0
    MacdBuffer(i) = Round(cdbl( rsiResult(i) - 50),5)
    next


    dim MACDArr
    dim x
    x=ubound(MacdBuffer) - 40
    ReDim MACDArr(x)


    For i = 41 To ubound(MacdBuffer)
    MACDArr(i-41) = 0.0
    MACDArr(i-41) = Round(cdbl( MacdBuffer(i) - 50),5)
    next
    RelativeStrengthIndexOnArray MACDArr, Cint(9), rsiArray
    End Sub

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Subscript error
    By BGT in forum VertexFX API/VTL Forum
    Replies: 2
    Last Post: 09-06-2020, 10:14 AM
  2. Why Error is coming
    By BGT in forum VertexFX API/VTL Forum
    Replies: 3
    Last Post: 01-02-2017, 02:22 PM
  3. Error in Bridge
    By Finsys Technical in forum VertexFX API/VTL Forum
    Replies: 6
    Last Post: 01-14-2015, 09:43 AM
  4. SMS dll Error
    By rayyan in forum VertexFX API/VTL Forum
    Replies: 36
    Last Post: 04-02-2014, 11:36 AM
  5. Error in Update SL/TP
    By Birju in forum VertexFX API/VTL Forum
    Replies: 1
    Last Post: 02-11-2014, 03:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •