• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Here's a script to convert indicators and strategies

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

  • GeorgeW
    replied
    I've checked the path in NuGet package manager and it is the correct one. I'll try to download the NT7 to NT8 file again later and try it with a new file, as I have a feeling the old file may have picked up and retained the old settings, so it is always searching to download the codeAnalysis and Csharp files.

    Thanks for your help, sobertradingpartner,

    Leave a comment:


  • sobertradingpartner
    replied
    Originally posted by GeorgeW View Post
    I'm also running Win7.

    Additional References: I add the same files you do to this section, but they do not remain there. When I open the NT7 to NT8 file, they disappear and a link to download Micorsoft.CodeAnalysis.CSharp appears.

    Addition Namespace Imports: I have
    Microsoft.CodeAnalysis
    Microsoft.CodeAnalysis.CSharp
    Microsoft.CodeAnalysis.CSharp.Syntax

    The error I am getting is:
    This query requires the following NuGet packages:
    Microsoft.CodeAnalysis.CSharp
    Download?
    When it asks you to download (and subsequently fails), it might mention that its unable to satisfy a dependency, can you tell me what dependency that is? It's odd that's happening, it not saving. Did you follow the steps exactly? Go into the NuGet package manager in LinQPad, click on settings and make sure the path listed in the Advanced tab is the same as listed in Step 2. Make sure you are running nuget from that directory. When i added the different libraries, I already had the NT7toNT8 file open. Once the additional references are added, you can save the file which should save all the additional references (I think). I wish I could be more help, but I don't know why it would still be asking you to download if you already have it.

    Leave a comment:


  • GeorgeW
    replied
    I'm also running Win7.

    Additional References: I add the same files you do to this section, but they do not remain there. When I open the NT7 to NT8 file, they disappear and a link to download Micorsoft.CodeAnalysis.CSharp appears.

    Addition Namespace Imports: I have
    Microsoft.CodeAnalysis
    Microsoft.CodeAnalysis.CSharp
    Microsoft.CodeAnalysis.CSharp.Syntax

    The error I am getting is:
    This query requires the following NuGet packages:
    Microsoft.CodeAnalysis.CSharp
    Download?

    Leave a comment:


  • sobertradingpartner
    replied
    Originally posted by GeorgeW View Post
    Thanks for that detailed explanation Sobertrading partner.
    At step 7, after pointing to the folder containing the download, I just typed into the command window "nuget install Microsoft.CodeAnalysis -Version 1.3.2", and that installed the CodeAnalysis and CodeAnalysis.CSharp folders as well as several others. In Windows 7, they are installed in folders directly under the user name.

    For step 8, I used the dll files found within the net45 folders found in the parent folders Microsoft.CodeAnalysis.Common.1.3.2 and Microsoft.CodeAnalysis.CSharp.1.3.2

    To Add them to linqpad, I went to: Query > References & Properties > Add > Browse (I then browsed to the folders indicated above and opened the following files: Microsoft.CodeAnalysis.dll Microsoft.CodeAnalysis.CSharp.dll). Once they were added to the Linqpad window, I pressed "Set as default for new queries" so they are now listed on the "Additional Namespace Imports" when I open linqpad. But still, when I open the NT7 to NT8 file, I still get the message that Microsoft.CodeAnalysis.CSharp needs to be downloaded. Any ideas how to resolve this?
    Did you get the exact same CSharp error? I had two different ones, one related to CSharp itself and one related to Syntax. My Additional Namespace Imports section has:
    Microsoft.CodeAnalysis
    Microsoft.CodeAnalysis.CSharp
    Microsoft.CodeAnalysis.Syntax

    My Additional References have
    Microsoft.CodeAnalysis.CSharp.dll
    Microsoft.CodeAnalysis
    Systems.Collections.Immutable.dll
    System.Linq.dll

    I can't be absolutely sure why it's still not working for you without seeing the actual error. I should mention I'm running on Win 7, which is why I didn't use the dll under the "portable-net45+win8" folders. I also downloaded and installed the Microsoft.CodeAnalysis.CSharp separately, though I know the main Microsoft.CodeAnalysis contains it. In the install process if it finds the same file it ignores it, so there's no harm.

    Leave a comment:


  • GeorgeW
    replied
    Thanks for that detailed explanation Sobertrading partner.
    At step 7, after pointing to the folder containing the download, I just typed into the command window "nuget install Microsoft.CodeAnalysis -Version 1.3.2", and that installed the CodeAnalysis and CodeAnalysis.CSharp folders as well as several others. In Windows 7, they are installed in folders directly under the user name.

    For step 8, I used the dll files found within the net45 folders found in the parent folders Microsoft.CodeAnalysis.Common.1.3.2 and Microsoft.CodeAnalysis.CSharp.1.3.2

    To Add them to linqpad, I went to: Query > References & Properties > Add > Browse (I then browsed to the folders indicated above and opened the following files: Microsoft.CodeAnalysis.dll Microsoft.CodeAnalysis.CSharp.dll). Once they were added to the Linqpad window, I pressed "Set as default for new queries" so they are now listed on the "Additional Namespace Imports" when I open linqpad. But still, when I open the NT7 to NT8 file, I still get the message that Microsoft.CodeAnalysis.CSharp needs to be downloaded. Any ideas how to resolve this?

    Leave a comment:


  • sobertradingpartner
    replied
    Originally posted by GeorgeW View Post
    I'm in the same situation as you bobc635 - I have Net framework 4.6, but Linqpad is showing the Microsoft CodeAnalysis problem. There is a thread on the linqpad forum that refers to it as a known problem. I have tried their workaround at the bottom of the thread, but it doesn't work for me, maybe it will work for you.
    GeorgeW,

    Hope this helps you and bobc635,

    I've spent a couple hours and finally figured out how to fix the same issues you were having, but I had to go a rounadabout way to get there. Here are the steps that worked for me:

    1. Download the nuget 3.4.4 CLI here - https://dist.nuget.org/win-x86-comma...test/nuget.exe
    2. Assuming you've already installed linqpad - move the nuget.exe file to linqpad's default folder for storing packages - C:\users\<user name>\AppDAta\Local\LINQPAD\NuGET.FW46
    3. go to the windows command prompt
    4. navigate to where the nuget.exe file is and update it (nuget.exe update -self). Leave the command window open, you will be using it again soon.
    5. Open Linqpad and load the NT7toNT8.linq and try to run it.

    I eventually had to fix four errors, but the ones you end up having to fix may be different from mine. The one we have in common is CodeAnalysis, what we will do is download that from the nuget site and point the reference in the program to it.

    6. Assuming you get the CodeAnalysis (or CSharp) error, hit F4. Remove the reference that has the location asking you to download it.
    7. In your command window, type nuget install Microsoft.CodeAnalysis -Version 1.3.2 followed by nuget install Microsoft.CodeAnalysis.CSharp -Version 1.3.2.

    8. When they are done running, go back to linqpad. In the reference window, choose Add, followed by Browse. Navigate to the nuget.exe directory and you should see a lot of new folders. Choose the dll reference from CSharp.1.3.2\lib\net45 and also add the CodeAnalysis reference from Common.1.3.2\lib\net45

    Even after those I had two further errors and I had to add the Systems.Collections.Immutable.dll from Immutable.1.2.0\lib\portable-net45 and System.Linq.dll from the 4.1.0\lib\net463



    Each time you get an error you will have to figure out what dll it is referencing. Put the exception name in google and within a few links you should find it. Navigate through your directory try and find a folder that has that reference (or is its parent), and you should be able to figure it out. I you don't have it go to the nuget download site and find the name of the package to download and the latest stable version here:
    https://www.nuget.org/packages


    I know full well I hacked my way through and this is probably not the best way to get it done, but like i said, it worked for me. YMMV.
    Last edited by sobertradingpartner; 11-03-2016, 04:47 PM. Reason: misspelling and missing info

    Leave a comment:


  • Dolfan
    replied
    Agreed, a converter would be a natural progression from one platform to the next.

    Leave a comment:


  • bobc635
    replied
    Thanks Sewards.... I did the browse and included the said files. I still cannot get the proper NuGet and still have the same errors, I guess that I am dumber than a rock..... I will keep trying for a while while I am working on the manual edits..... Argh.... I wish NT would make a converter and really support it... I appreciate all of the helpers in the forum....

    Bob

    Leave a comment:


  • sewards
    replied
    I too was having problems with the NuGet dependencies. When opening the script LINQPad was attempting to download the libraries and failing

    It seems LINQPad actually bundles the dependancies when it is installed.

    When the script is open, click F4 > Additional References > Browse

    Browse to 'C:\Program Files (x86)\LINQPad5\ngen001' and select the NuGet dll files

    I believe it also prompted me to add several .NET references

    Leave a comment:


  • bobc635
    replied
    Thanks a lot GeorgeW..... I was hoping to get most of the work done with the script, but I think you are right... I have quite a few custom indies that I built and it will be a lot of hours I am sure.... After the first few, it should go a lot quicker....

    Thanks a lot!!!! Maybe someone will find the solution.
    Bob

    Leave a comment:


  • GeorgeW
    replied
    Hi bobc635,
    I have tried it with Visual Studio 5 with Nuget 3.5 attached, but it has not worked for me. I think this is partly because I am not sure exactly how to use the file provided with VS5. Maybe someone here can give some advice.

    I have managed to update one of my simpler NT7 indicators to NT8 manually though. I just copied the .cs file to the NT8 indicator folders, compiled it, then I went through all the errors and corrected as necessary. I am working on a more complex indicator manually too, but that has taken several hours so far, and I'm still not finished. The beauty of NT8 is that you can right click on an indicator and select for it not to be included when you compile, so unlike NT7, NT8 can still work when you have indicators in the folder that have not yet compiled. Below are the steps I took:

    My conversion method: Used to convert VolSMA 30/10/2016
    i. Copy .cs file to NT8 indicator file
    ii. Open NT8 Ninjascript Editor and open the file
    iii. I had to add "System.Drawing.dll" from Microsoft.Net folder (C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319) to the Reference section of NT8 indicators: This is done once for each dll you add, and enables you to use Microsoft.Net codes. To add it you: open the editor and any indicator > right click > References > Add (then navigate to the folder and select the file).
    iv. Using Declarations - some of them are different, and there are additional ones. Replace with the ones from the NT8 system VolMA Indicator as the main defaults, but can also check other system indicators that are similar to the one I am converting.
    v. Change namespace to: namespace NinjaTrader.NinjaScript.Indicators
    vi. Variables: Cannot see this section in locked NT8 indicators.
    1) private DataSeries myDataSeries; Change to private Series<double> myDataSeries; (In MyBuySell05)
    vii. Initialize(), OnStartUp(), OnTermination() - change to OnStateChange() - for more functionality
    1) CalculateOnBarClose changed to: Calculate = Calculate.OnBarClose, Calculate = Calculate.OnEachTick and introduced a new Calculate = Calculate.OnPriceChange
    2) Overlay changed to IsOverlay.
    viii. OnBarUpdate()
    1) .Set method no longer used - see manual.
    2) VolSMA indicator changed as follows: // Set the calculated value to the plot: Plot0.Set(average); changed to: Value[0] = average;
    ix. Region Properties: Some adjustments needed there.
    1) DataSeries is now: Series<> e,g, public Series<double> Plot0 (See VolSMA)
    2) [Description("Number of periods")] [GridCategory("Parameters")] & the {get set} code - these are replaced by: [Display(ResourceType = typeof(Custom.Resource), Name = "Number of periods", GroupName = "NinjaScriptParameters", Order = 0)] {get; set;}

    Leave a comment:


  • bobc635
    replied
    Hi George W... Well, I have tried downloading the free Visual Studio and worked on getting the NuGet.... this is way above my experiences.... I am stuck and dont know where to go.... Mexico F1 just came on, so my afternoon is done..... Thanks

    Leave a comment:


  • bobc635
    replied
    Thanks GeorgeW... I will check it out.... Maybe a Microsoft forum has a suggestion....

    Bob

    Leave a comment:


  • GeorgeW
    replied
    I'm in the same situation as you bobc635 - I have Net framework 4.6, but Linqpad is showing the Microsoft CodeAnalysis problem. There is a thread on the linqpad forum that refers to it as a known problem. I have tried their workaround at the bottom of the thread, but it doesn't work for me, maybe it will work for you.

    Leave a comment:


  • bobc635
    replied
    Hello Miro, and thanks for the reply. I tried to update the .NET and I got a message back that said that I already have 4.6.1 or later framework.... I am still stuck in the mud....

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by Mindset, Today, 04:07 AM
0 responses
2 views
0 likes
Last Post Mindset
by Mindset
 
Started by lakman184, Today, 03:04 AM
0 responses
2 views
0 likes
Last Post lakman184  
Started by myrtienguyen, Today, 02:18 AM
0 responses
3 views
0 likes
Last Post myrtienguyen  
Started by WHICKED, Yesterday, 09:03 PM
1 response
16 views
0 likes
Last Post Emma1
by Emma1
 
Started by oleotrim, Yesterday, 11:29 PM
1 response
11 views
0 likes
Last Post Emma1
by Emma1
 
Working...
X