Can you give me any ideas on what to do please?
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Error help
Collapse
X
-
Error help
Hi, I have modified an indicator that Paul wrote, called MACrossBuilderV1.06. It is working fine except for one thing. Please see the attached pics. Looking at the NT8Script pic, I have marked in red the problematic code. If I comment it out the indicator compiles and works, providing I don't need to use any of the enums. I have been through the code numerous times and am unable to spot the problem. I was going to export and send you the file, however it wouldn't export because of the problem, please see the log error pic.
Can you give me any ideas on what to do please?Tags: None
-
Hello KennyK,
Thanks for your post.
Enums have to be unique and that is why you would have to comment them out or alternatively change them slightly (and all corresponding code references to CDMAtype andDrawSelection).
You wrote, "If I comment it out the indicator compiles and works...", what specifically happens in the indicator panel when you try to select either moving average or draw selection?Paul H.NinjaTrader Customer Service
-
HI Paul, I just had a look at that, the different CDMA types are present when the UI drop down is clicked. And they apply to the chart with no problem.
I didn't test the DrawSelection, because I have commented all the code out that relates to it because I am not using it yet. But I assume it would be there the same as the CDMAtypes.
I have commented out all the code that isn't relevant to the core of what I need. Until I get it working properly for the core. Then I will bring back one function at a time that I want to use.
So having tested that, why is it so? Why does the original MACrossBuilder not have the same issue? How do I fix it?
BTW, If your the Paul that provided the MACrossBuilder thanks very much!
I have just added a 3rd MA and plotted the 3 in a separate window to show the difference between. And have added a second lot of color regions to suit.
Thanks, Ken.
Comment
-
Hi KennyK,
Thanks for your reply.
The MACrossbuilder contains the enums that have to be unique and as your indicator has commented those out there is no longer an issue with duplicates as your indicator is accessing the enums in the MACrossbuilder. If you note where these enums are you will see they are not actually in the indicator but above the namespace NinjaTrader.NinjaScript.Indicators and any indicator can access and use those enums. The only issue would be if you exported your indicator to use elsewhere and in that case, you can simply uncomment the enums and you would be good to go on the target PC
.
Glad you like the indicator and you are welcome!Paul H.NinjaTrader Customer Service
Comment
-
AH, I see now, thanks for explaining that Paul, I appreciate it.
So if I am understanding correctly, If I comment them out in MACrossBuilder, I would then have to uncomment them in my indicator?
Correct?
I have now actually tested the above and found it to be correct.
Which now poses another question. If the enums were moved inside the indicators namespace, would they then be private? Only accessible by the host indicator? Is this doable?
Comment
-
Hello KennyK,
Thanks for your reply.
Yes correct and glad you tested to confirm for yourself.
Enums cannot be made private, here is an external reference that to help with understanding enum and its usage: https://csharp-station.com/Tutorial/CSharp/Lesson17
Also, here is a link to an example of enums in NinjaTrader: https://ninjatrader.com/support/help...ned_parame.htm
Paul H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by volIQ, 03-27-2024, 04:28 PM
|
3 responses
21 views
0 likes
|
Last Post
by RJay
Today, 05:41 AM
|
||
Started by Nickgiaco, 02-26-2024, 10:23 AM
|
2 responses
72 views
0 likes
|
Last Post Today, 05:12 AM | ||
Started by Johndc, Today, 04:39 AM
|
0 responses
7 views
0 likes
|
Last Post
by Johndc
Today, 04:39 AM
|
||
Started by johntraderuser2, Today, 02:34 AM
|
0 responses
9 views
0 likes
|
Last Post Today, 02:34 AM | ||
Started by IanS00, 03-27-2024, 11:24 AM
|
2 responses
13 views
0 likes
|
Last Post Today, 02:00 AM |
Comment