External DLLs creation for custom indicators

  1. Get Docs.exe.

    Download  Docs.exe and run it. This will expand the files.

  2. Files included.

    External DLLs.DOC has this text in Word format.
    FTCalc_Example.vbp project file for VB6.
    FTCalcCommon.bas contain common routines. It belongs to the FTCalc_Example.vbp project.
    Information.cls contain the class with the basic information for the Fibonacci Trader software. It belongs to the FTCalc_Example.vbp project.
    Moving_Avg_Example.cls contain the parameters and calculation of an example moving average. It belongs to the FTCalc_Example.vbp project
    Make a copy of all files.

  3. Using Visual Basic 6 to open the project FTCalc_Example.vbp

    The file FTCalcCommon.bas  includes some definitions of colors, other variable definitions and 1 routine; you can add routines  as needed for your ActiveX.
    The file Information.cls has some important information that will be used by the Fibonacci Trader program. Do not change the name of this class or the name of any variable already defined in it.
    The total number of Indicators(classes) that you have in this ActiveX - NCalcs
    The array with the names of your indicators - CalcNames()
    Each indicator needs to have an independent class module in the VB6 project.
    Each class module name must mach the names in CalcNames()
    Example: If you have an Indicator with the class module name DoubleAvgCrossOver, the name in  CalcNames() must also be DoubleAvgCrossOver.
    These values must be changed in the Information.cls. Select the object CLASS and procedure INITIALIZE. Change Ncalcs and CalcNames() as needed.
    You can type a serial number in the SerialNumber variable. If it is different "" the ActiveX will run only in the Fibonacci Trader with that serial number.
    The information class also has the following variables:

              Version – the number to identify the version of your DLL, needs to be an integer number
              Company – your company name
              Author – Your name

    The file Moving_Avg_Example.cls has the information about this indicator and the calculation
    In this class, select object General and procedure declarations.  Many variables can be used to define your indicator. Each variable is explained there. Do not change any variable name. Add new variables as needed.
    In this class, select Object Class and procedure Initialize. The default values for all variables are located here. Change the values as needs.
    Note the variable IndicatorName. This is the variable that has the name of the indicator that will appear to the user.
    Select object General, procedure Calc.  This is the routine that the Fibonacci Trader will call to make your calculation or calls for calculations.
    The parameters passed are all explained in the routine itself.

  4. Project Properties.

    Do not change the project properties. Only change the Project Name as needed.
    You can change project names and create DLLs with different names.

  5. Creating the DLL

    Compile the DLL. Always save it  in the FTGT\OBJECTS\INDICATORS folder and register the DLL.
    To register the DLL use regsvr32. Normally egsvr32 is in the windows\system folder.
    For Example, regsvr32 FTCalc_Example.DLL will register the example DLL after it is compiled, and save it in  FTGT\OBJECTS\INDICATORS.
    If you compile the DLL  in FTGT\OBJECTS\INDICATORS, you do not need to register the DLL in your machine. VB6 will do it for you. If you copy the DLL to another machine, you will need to copy it to the C:\FTGT\OBJECTS\INDICATORS folder and register it.

  6. How it works

    When the Fibonacci Trader runs it looks for DLLs in the OBJECTS\INDICATORS folder. When it finds one it tries to create an object DLLName.Information.  If successful it will retrieve the information containing the number of indicators and the names of each one.
    If the program finds that the name of the indicator has not been signed in before, it will retrieve all the defaults that you defined in the initialize routine and will create a new indicator in the users indicators list.

    The calc routine receives the bars information in the Bar() array.
    The Bar() array has 9 elements by number of bars elements.
    The Bar(1 , i) contains the open,  Bar(2 , i) contains the high, Bar(3 , i) contains the low, Bar(4 , i) contains the close, Bar(5 , i) contains the number of ticks of the current bar, Bar(6 , i) contains the volume of the bar, where ‘i’ is a bar number, Bar(7 , i ) contains the date of the bar where 36333 = june 22nd, 1999, Bar (8 , i ) contains the time of the bar's open where 1452 = 14:52, Bar(9 ,i) can have 4 values: 0 ignore, 1 bar is the first bar of an opening next period, 2 bar is the first bar of an opening highest period, 3 bar is the first bar of an opening next and highest time period.
    The information returned to the Fibonacci Trader is V1(), V2(), V3(), V4(), Position(), Price() and Live.
    V1(), V2(), V3(), V4() will have values for the lines to be plotted.  If your indicator has only one line it will use only the V1(). If it has 2 lines it will use V1() and V2() and so on.
    Note that for V1() there is a variable z1.  The values that you calculate are always stored it V1( z1, i), where z1 is always fixed and i is the bar number. Never change the z1 value. It is the same for V2(), V3() and V4 except you use z2, z3 and z4.
    If you want this indicator to have alarms and show trades on your chart you will need to set the variable Trading=True.

    If you want this indicator to  use alarms or systems, use Position() for the position of each bar.  1 is long, 0 is flat, –1 is short.

    Price() contains the trade price. On the bar that causes a change of  position this value must be different than zero.  If the position of a bar is the same as the previous bar then price()  must be zero.

  7. Debugging in VB6.

    To debug using VB6 in run mode do as the following:
    Create your project and compile it which will create a DLL in your FTGT\OBJECTS\INDICATORS folder.  If you create the DLL in another folder save a copy in the FTGT\OBJECTS\INDICATORS folder and register it using the regsvr32.exe program.
    When Fibonacci Trader is run it will find the DLL and try to open the information class and the other classes that you created.
    If you run the Fibonacci Trader and your project is running in VB6 (click run, start with full compile – Ctrl-F5), the Fibonacci Trader will run the code in VB6 but not the DLL in the OBJECTS\INDICATORS folder.
    This way you can debug your project. You can put stops in it and use all the debug features of VB6.

Copyright 1996-2002 PAS Inc. Last updated: April 23, 2014 All names mentioned in this document are trademarks or registered trademarks of their respective owners.