Ninjatrader 7 strategy compiling error Help

164 views
Skip to first unread message

zumran hamid

unread,
Apr 27, 2020, 3:29:14 PM4/27/20
to Adaptrade Builder
I am on ninjatrader 64 bit version 7.0.1000.40. I am using Adaptrade 2.50 on a desktop computer not in a virtual environment same as for ninjatrader 7. Following is the problem.

I can not compile strategy in ninja. This is how I am saving strategy, right click in strategy code window in adaptrade than click on save ninjascript strategy to a file, it saves that strategy in C:\Users\x\Documents\NinjaTrader 7\bin\Custom\Strategy folder
I have imported adaptrade ninjascript file prior to doing this
I have individually compiled all imported files from adaptrade after encountering this error, ninja would not let you compile if there is already a file with compiling error therefore you need to remove offending strategy first.
After Strategy removal everything compiles fine.
I have tried to copy and paste raw code from adaptrade and generate a new strategy but it ends up in error.
I have tried it on two different computers with new ninja install
I have attached strategy file along with error message screenshot.

Have exchanged messages with Bryant but could not solve it.
is there anybody who is using ninja 7 help?

Adaptrade_Builder_2_5_1_3_1.cs
error.PNG

Mike Bryant

unread,
Apr 27, 2020, 3:56:16 PM4/27/20
to adaptrad...@googlegroups.com

I know you said you installed the Ninja files that come with Adaptrade Builder, but the error message suggests that’s the problem. “LastBarOfSession” is defined in one of those files. I was able to compile your strategy code without errors. You should keep in mind that when you right-click the code pane and select “Save NinjaScript Strategy to File”, the program presents a default directory/folder location for saving. In most cases, that’s the correct folder, but it ultimately depends on how you installed NT7, and it’s up to you to make sure that’s the correct folder. If it’s not, you will most likely get compilation errors when it can’t find the other files it needs in the proper locations. Likewise, if the Builder-provided files are not in the proper locations, you will get an error.

 

One way to verify that the Builder files are in the proper place is to look for them via the editor. If you select “Edit NinjaScript” -> “Strategy” from the Tools menu, you should see “AS_OrderProcessing” and “AS_NNCompute”. And the strategy you’re trying to compile should be in that same location. If the strategy you’re trying to compile is not in the same location as those other files, you need to move it to the same folder. Likewise, if you view the available indicators from the Tools menu, you should see all the indicators from Adaptrade (AS_AdaptICyc, AS_AdaptIRSI, etc.). If they’re in a different folder, you should move them to the same folder as the other Ninja indicators.

 

Mike Bryant

Adaptrade Software

zumran hamid

unread,
Apr 27, 2020, 8:36:05 PM4/27/20
to Adaptrade Builder
Ninjascript and strategy are in correct folder, I installed ninja in default folder. I did not change default location. see attachment
install folder.PNG

Mike Bryant

unread,
Apr 27, 2020, 9:40:47 PM4/27/20
to adaptrad...@googlegroups.com

Unfortunately for debugging purposes, the error messages generated by the NinjaScript editor do not always point us in the right direction, as I’ve seen before. Assuming you’ve made no changes to either the strategy code in question or the AS_OrderProcessing file, the problem could be elsewhere. A problem in any file could trigger an error that the editor attributes elsewhere. Nonetheless, if you haven’t already done so, I’d copy the entire AS_OrderProcessing.cs file directly from the Builder folder in Program Files (e.g., via something like NotePad) and paste it over the version in the Ninja editor just to make sure there is no problem with the code in Ninja.

 

Other than that, since you only have a few files in the Strategy folder, unless you’ve edited any of them, I don’t know what to suggest. Your setup is the same as mine, which is the default, and there are no issues with it that I can find.

 

Mike Bryant

Adaptrade Software

 

zumran hamid

unread,
Apr 29, 2020, 2:32:37 PM4/29/20
to Adaptrade Builder
Done that but it did not solve the problem. I can not find any reference of lastbarofsession in AS_orderprocessing file. In ninjascript if you hover your mouse over lastbarofsession it shows nothing but if you you hover over sessionendtime  or Time[0] it would show adaptrade related language. 


On Monday, April 27, 2020 at 3:29:14 PM UTC-4, zumran hamid wrote:

Mike Bryant

unread,
Apr 29, 2020, 2:37:20 PM4/29/20
to adaptrad...@googlegroups.com

LastBarOfSession is defined right near the top of that file:

 

namespace NinjaTrader.Strategy

{

    /// <summary>

    /// This file holds strategy methods required by Adaptrade Builder strategies.

    /// </summary>

    partial class Strategy

    {

        // Variables for order processing

        private IOrder LongEntryOrder = null;

        private IOrder ShortEntryOrder = null;

        private IOrder LongExitMarkOrder = null;

        private IOrder LongExitStopOrder = null;

        private IOrder LongExitTargOrder = null;

        private IOrder ShortExitMarkOrder = null;

        private IOrder ShortExitStopOrder = null;

        private IOrder ShortExitTargOrder = null;

                               

        protected bool LastBarOfSession = false;

 

Mike Bryant

Adaptrade Software

 

From: adaptrad...@googlegroups.com <adaptrad...@googlegroups.com> On Behalf Of zumran hamid
Sent: Wednesday, April 29, 2020 6:31 AM
Subject: Re: Ninjatrader 7 strategy compiling error Help

 

Done that but it did not solve the problem. I can not find any reference of lastbarofsession in AS_orderprocessing file. In ninjascript if you hover your mouse over lastbarofsession it shows nothing but if you you hover over sessionendtime  or Time[0] it would show adaptrade related language. 

zumran hamid

unread,
Apr 30, 2020, 4:27:32 PM4/30/20
to Adaptrade Builder
Finally problem is solved. This is this line  missing from AS_orderprocessing file which comes with default installation of the adaptrade 2.5, i have examined all of my adaptrade installations. I see that this is 2014 file, may be Bryant has newer file on his computer but install contains older file. Just my guess. See below
 protected bool LastBarOfSession = false;
Now strategy verifies, hooray

 
On Monday, April 27, 2020 at 3:29:14 PM UTC-4, zumran hamid wrote:

Mike Bryant

unread,
Apr 30, 2020, 4:52:40 PM4/30/20
to adaptrad...@googlegroups.com

I’m not sure how that happened, but I appreciate you taking the time to figure it out. I’ll make sure the download file for 2.5 is updated to include the most up-to-date Ninja 7 zip. If anyone else has had this issue, please let me know so I can send the correct file.

 

Mike Bryant

Adaptrade Software

 

From: adaptrad...@googlegroups.com <adaptrad...@googlegroups.com> On Behalf Of zumran hamid
Sent: Thursday, April 30, 2020 3:23 AM
Subject: Re: Ninjatrader 7 strategy compiling error Help

 

Finally problem is solved. This is this line  missing from AS_orderprocessing file which comes with default installation of the adaptrade 2.5, i have examined all of my adaptrade installations. I see that this is 2014 file, may be Bryant has newer file on his computer but install contains older file. Just my guess. See below

Balázs Szilárd

unread,
May 5, 2020, 1:53:37 PM5/5/20
to adaptrad...@googlegroups.com
Hi i have same problem,please update on download center the correct ninjascript file for order processing,and please also send to me this correct file.

Best regards

Szilard Balazs

--
You received this message because you are subscribed to the Google Groups "Adaptrade Builder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adaptrade-buil...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adaptrade-builder/001f01d61f31%2446872990%24d3957cb0%24%40BreakoutFutures.com.

MikeBryant

unread,
May 5, 2020, 2:16:07 PM5/5/20
to Adaptrade Builder

I've attached the correct Ninja 7 zip file for Builder 2.5. I’m finishing up version 3 of Builder now, so the download file on your license page at SoftwareKey.com will be updated with that version soon, which will include the correct zip file for NT7 as well as the new zip file for NT 8. Also, anyone who has any version of Builder between 2.3.0 and 2.4.1 installed has the correct version of the NT7 zip in the installation folder, so you can get it from there as well. That means it’s also available on the web site via the trial downloads for those versions. If anyone has difficulty getting it from any of those sources and wants me to send it directly, just PM me.

 

Mike Bryant

Adaptrade Software

NinjaTrader.Adaptrade.zip
Reply all
Reply to author
Forward
0 new messages