Results 1 to 2 of 2
  1. #1

    Exclamation Need Help in VTL Coding

    Hi,


    @ in iTime function current date and time is only taking M1 and M5 time frames and the H1 and H4 time frames not taking the current data and time.its taking the 2018 date and time
    iTime("AUD/USD",PERIOD_H4,30)


    Appreciate a help



    '''############################################### ######################################
    '''#### Script Name: Script Name ######
    '''#### Author : Author Name ######
    '''#### Website : www.Hybrid-solutions.com ######
    '''#### Date : 04/05/2019 12:13:27 ######
    '''#### Description: Description ######
    '''############################################### ######################################


    ''' <summary>
    ''' The main function is the entry point for any Script program
    ''' </summary>


    Public Sub main()
    ''''TODO: Script program start method
    Dim LookbackPeriod,AppliedTimeframe,Objname, ObjIdentifier,RegressionStyle,RegressionColor,T0,T 1,P0,P1,dum
    RegressionStyle=STYLE_SOLID
    RegressionColor =RGBColor (12,43,127)
    AppliedTimeframe=PERIOD_h4
    P0=0
    P1=0
    T0 = iTime("EUR/USD",PERIOD_M1,30)
    'MsgBox(T0)
    T1 = iTime("EUR/USD",PERIOD_M1,1)
    'MsgBox(T1)
    LookbackPeriod=30


    For BarMeasure = 0 To 5

    If [ObjectFind(0,"Regression") != 0] Then

    AddObject 0,"Regression",OBJ_REGRESSION, 0,iTime("AUD/USD",PERIOD_M1,30), 0,iTime("AUD/USD",PERIOD_M1,1),0
    Else
    ObjectDelete 0,"Regression"
    AddObject 0,"Regression",OBJ_REGRESSION, 0,iTime("AUD/USD",PERIOD_M1,30),0,iTime("AUD/USD",PERIOD_M1,1),0

    End If
    Objectset 0,"Regression",OBJPROP_STYLE,RegressionStyle
    Objectset 0,"Regression",OBJPROP_COLOR,RegressionColor
    Objectset 0,"Regression",OBJPROP_WEIGHT,2


    ChartRedraw 0

    Next
    End Sub




    ''' <summary>
    ''' The function is generated when a new tick is received for any symbol
    ''' </summary>


    Public Sub OnTick(symbolName)


    End Sub




    ''' <summary>
    ''' The function is generated when initialization script
    ''' </summary>


    Public Sub OnInit()
    ''''TODO: initialization method


    End Sub




    ''' <summary>
    ''' The function is generated when deinitialization script
    ''' </summary>


    Public Sub OnDeInit()
    ''''TODO: deinitialization method


    End Sub




    ''' <summary>
    ''' The OnTimer function called when the timer event occurs
    ''' </summary>


    Public Sub OnTimer()
    ''''TODO: Timer Function
    End Sub


    ''' <summary>
    ''' The OnCalculate function called when a new candle received
    ''' </summary>


    Public Sub OnCalculate(symbol, symbolPeriod, openVal, highVal, lowVal, closeVal)


    End Sub
    ''' <summary>
    ''' Raise when all data are loaded after Login
    ''' </summary>


    Public Sub AllDataLoaded()


    End Sub
    ''' <summary>
    ''' Raise when Account Selected
    ''' </summary>


    Public Sub AccountSelected(accountNumber)


    End Sub
    ''' <summary>
    ''' Raise when the server returns order result
    ''' </summary>


    Public Sub OnOrderTrade(actionType ,orderID , returnValue)


    End Sub
    ''' <summary>
    ''' Raise when the server returns position result
    ''' </summary>


    Public Sub OnPositionTrade (actionType ,ticketID)


    End Sub
    ''' <summary>
    ''' Raise when the server returns Manage SL/TP Orders after calling RequestManageOrders method
    ''' </summary>


    public sub OnManageOrdersReceived(manageOrders)


    End Sub
    ''' <summary>
    ''' Generatd after requested prices from the server for new symbol
    ''' </summary>


    Public Sub PriceLoaded(TimeArr,OpenArr,HighArr,LowArr,CloseAr r)
    '''TODO: Implement the handler


    End Sub
    ''' <summary>
    ''' Generatd after change the chart period
    ''' </summary>


    Public Sub PeriodChanged (PeriodName, SymbolName)
    '''TODO: Implement the handler


    End Sub
    Public Function add()


    End Function

  2. #2
    Administrator Rawan-HS's Avatar
    Join Date
    Apr 2015
    Posts
    354

    Default

    verde.solution

    You have to know the following

    1 - before using the iTime function you have to load all the Chart Data for the requested period by pressing on the (F5) or right click on the chart then select load all chart data .
    2 - The iTime method is used to return the time for the bar that you passed on the shift value so it can be an old time if you pass it a large number.


    As a Suggestion, you can use the DateTimes function which is used to return array that contains times value from the specific start Position without needing to load the chart data and if the chart was not loading before and after calling the DateTimes method you have to wait the priceLoaded event to fire to get the times data.
    Last edited by Rawan-HS; 05-08-2019 at 01:18 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VTL 11 - SymbolsTotal
    By Edakad in forum VertexFX API/VTL Forum
    Replies: 1
    Last Post: 11-22-2018, 08:49 AM
  2. VTL Form
    By Edakad in forum VertexFX API/VTL Forum
    Replies: 3
    Last Post: 11-16-2016, 11:33 AM
  3. VTL Help
    By younes4sami in forum VertexFX API/VTL Forum
    Replies: 2
    Last Post: 11-09-2015, 08:35 AM
  4. VTL Functions
    By AmitSharma in forum VertexFX API/VTL Forum
    Replies: 6
    Last Post: 03-11-2014, 03:48 PM
  5. Having problem in the vtl ea
    By ankitkalindi in forum VertexFX API/VTL Forum
    Replies: 13
    Last Post: 01-09-2014, 09:41 AM

Tags for this Thread

Posting Permissions

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