Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NLog

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

    NLog

    Hello,

    NLog is a logging platform for .NET with rich log routing and management capabilities.
    NLog supports traditional logging, structured logging and the combination of both.

    How can I combine the NLog with NinjaScript

    Sincerely, Kobi

    #2
    Hello levikNT,

    While the NLog code wouldn't really be anything I could assist with, referencing other assemblies in NinjaTrader is standard practice.

    The general rules surrounding using other assemblies would be that the reference needs to be .net 4.5 or less and all resources of that assembly including the dll itself be placed in the documents/NinjaTrader 8/bin/Custom folder.

    Once you place the reference in the folder, you can use the NinjaScript editor to add a reference to the dll by Right clicking and selecting References. Then Add, and select the dll. Click OK and recompile.

    Finally, check if you can use the namespaces contained in the dll to confirm it was loaded.

    There is an extra step to exporting if you use extra assemblies, you can read about that here: https://ninjatrader.com/support/help...esOrNativeDlls

    If you are having difficulties in using the reference, please ensure to check the log tab/output window and search for any C# errors related to the custom dll name (if any).

    For combing the nlog code into NinjaScript, I would suggest using nlogs examples and locate the most simple use. Then test that inside of an Indicator to check that it works or if it produces an error. This test would need to be done after the referencing is successful and NinjaScript is recompiled. You may need to test in the various states if you need to instantiate the nlog objects as well


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

    Comment


      #3
      Hello Jesse,
      Thank you for your assist.

      I followed your instructions, I placed the DLL and the config files (I don't have the source code).
      I updated reference to the DLL.
      I used namespaces contained in the dll , and I used the NLog, I compiled ninja Script an there were no error.
      I ran my strategy , but no log file was created.

      I Build a C# unit test to work with Nlog and it is working.

      Do you have any suggestion ?

      Sincerely,Kobi

      Comment


        #4
        Originally posted by levikNT View Post
        Do you have any suggestion ?
        Post your code.

        Comment


          #5
          Hello levikNT,

          I wouldn't really be sure unless you were seeing some kind of error or other output. Because this is logging related, this could be related to debug mode. You may try enabling debug mode to see if that helps. Right-click in the NinjaScript editor and click Debug Mode, then recompile.

          Be sure to double check the paths you are using as well.

          Outside of these items, you would likely need to look at the criteria for nlog to generate a file and see if you can note any differences between your test and how it is running in NinjaTrader.

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

          Comment


            #6
            Hi. Was there any resolution to this? I'm having the same problem. I placed the NLog DLL along with the NLog config file into the custom folder and added the reference but i'm not seeing any log file being created when running the strategy. I also tried running the strategy in debug mode and it didn't help.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by DayTradingDEMON, Today, 09:28 AM
            2 responses
            15 views
            0 likes
            Last Post DayTradingDEMON  
            Started by Stanfillirenfro, Today, 07:23 AM
            6 responses
            22 views
            0 likes
            Last Post Stanfillirenfro  
            Started by navyguy06, Today, 09:28 AM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by cmtjoancolmenero, Yesterday, 03:58 PM
            8 responses
            32 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by helpwanted, Today, 03:06 AM
            2 responses
            22 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Working...
            X