Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to connect to external library "Html Agility Pack"?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to connect to external library "Html Agility Pack"?

    Hello. Please, save me from another restless night!

    I want to use Html Agility Pack to grab CME data from indicator.

    Html Agility Pack consist of 9 folders:
    • [Net20]
    • [Net40]
    • [Net40-client]
    • [Net45]
    • [sl3-wp]
    • [sl4]
    • [sl4-windowsphone71]
    • [sl5]
    • [winrt45]


    Each folder contain 3 files:
    • HtmlAgilityPack.dll
    • HtmlAgilityPack.pdb
    • HtmlAgilityPack.xml


    ([winrt45] folder contain, also, "HtmlAgilityPack.pri" file)

    I put "using HtmlAgilityPack;" string to my indicator.
    Then I made right click -> References in indicator window (i tried HtmlAgilityPack.dll from all folders.

    After that I compilled my simplest code with no errors.
    Code:
    string url = "http://www.cmegroup.com/trading/energy/crude-oil/light-sweet-crude_quotes_globex_options.html?exchange=XNYM&foi=OPT&venue=G&productCd=CLX3&underlyingContract=CL&floorContractCd=CLX3&expMonth=201311&prodid=";
    string htmlCode = "";
    HtmlWeb webGet = new HtmlWeb();
    HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument();			
    document = webGet.Load(url);			
    Print( htmlCode );
    But when I put indicator on chart I get this error: "Error on calling 'OnBarUpdate' method for indicator 'iOptionsVolume01' on bar 0: Could not load file or assembly "HtmlAgilityPack, Version = 1.4.6.0, Culture = neutral, PublicKeyToken = bd319b19eaf3b43a" or one of its dependencies. Can not find the file specified.".

    (I also tried to put HtmlAgilityPack.dllfiles to [c:\Users\Andrei\Documents\NinjaTrader 7\bin\Custom\] folder - no result).
    And I tried to use "gacutil.exe" to register library in system.

    I using Windows 8 x64.

    Please, tell me what else I have to do to use Html Agility Pack objects in NinjaScript?

    Thank You!
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    #2
    fx.practic, NT7 would support anything up to target framework of 3.5 so my suggestion would be using the 2.0 dll version as reference. Copy it into bin > custom as well and then restart NT7 so it can be loaded when you start up, would you see the same issue working with a basic call from it then in your project?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Restart NT! Key feature!
      Thank You very march!!
      fx.practic
      NinjaTrader Ecosystem Vendor - fx.practic

      Comment


        #4
        Hello fx.practic,

        I'm running into this exact same issue with NinjaTrader 8. Whatever you were originally trying to accomplish in NT7, were you able to successfully recreate within NT8?

        I am getting the same error, "Error on calling 'OnBarUpdate' method for indicator 'myindicator' on bar 0: Could not load file or assembly "HtmlAgilityPack,..."

        I added the HtmlAgilityPack via NuGet manager within Visual Studio. I've tried referencing each different framework version (within my VS project and within NinjaTrader References), many restarts of NinjaTrader, etc. The project builds just fine, but fails at run-time with the error above.

        Any help is greatly appreciated.

        Comment


          #5
          Hello neoikon,

          It looks like fx.practic may have previously solved this by placing the dll in the bin/custom directory along with restarting the platform once the reference was corrected to the bin/custom dll. It may also have been the version of the dll being used, NT7 requires 3.5 or less. fx.practic would need to comment on the specific solution here, however, this would be my observation based on the given details.

          For nuget packages, you will need to use the actual DLL's for NinajTrader rather than trying to use nuget. Nuget would only be relevant toward your own custom projects in visual studio, if you are loading the NinjaTrader.Custom project, nuget will not directly work in that context. You would instead need to copy the .dll files into the bin/custom folder and reference that dll inside of NinjaTrader. For NT7 if you also use visual studio, you will additionally need to reference this dll when you load the NinjaTrader.Custom project. I posted more details about using nuget for NT8 in the following link however this is still relevant for 7: https://ninjatrader.com/support/foru...72#post1042872

          I look forward to being of further assistance.
          JesseNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by wjadevries, Today, 03:35 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Started by Mykro, Today, 03:59 PM
          0 responses
          4 views
          0 likes
          Last Post Mykro
          by Mykro
           
          Started by venkateshdvk, Today, 01:34 PM
          1 response
          21 views
          0 likes
          Last Post NinjaTrader_Kate  
          Started by westofpluto, Today, 01:54 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by zacharydw00, Today, 02:11 PM
          4 responses
          15 views
          0 likes
          Last Post zacharydw00  
          Working...
          X