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!
See more
See less

Partner 728x90

Collapse

Using Custom indicator in another Custom indicator

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

    Using Custom indicator in another Custom indicator

    I converted a Custom indicator from NT7 to NT8 and the only outstanding compilation issue for me to resolve are the below statements that gave Error Message: "NinjaTrader.NinjaScript.Indicators.LLMA" is a "type" but is used as a "variable". There are no compilation errors using the NT8 built-in SMA, RVI, and EMA indicators. What is wrong in using the custom LLMA indicator.

    if (IndicatorInputSelector == 3){ cyclePrice1 = LLMA(Close, pPriceActionFilter,0)[SwitchA];}


    if (IndicatorInputSelector == 3){ CyclePrice[0] = LLMA(Close, pPriceActionFilter,0)[0];ZL1[0] = ZeroLag(CyclePrice[0], pFilterStrengthLLMA, 0);}



    Omololu

    #2
    Hello omololu,

    Does the indicator you created have the NinjaScript generated code at the bottom of the file? You would get this message if the generated code failed to generate and you just had the indicator class.

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

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello omololu,

      Does the indicator you created have the NinjaScript generated code at the bottom of the file? You would get this message if the generated code failed to generate and you just had the indicator class.

      I look forward to being of further assistance.
      Thanks for your reply. I actually did a conversion from NT7 to NT8,

      The NT7 version has the NinjaScript generated code at the bottom, but the converted (NT8) version does not have it. I was expecting that the NinjaScript codes at the bottom would be generated when the converted (NT8) version successfully compiles. What do you suggest the I should now do ? Do I copy the NinjaScript generated code at the bottom of the NT7 version to the bottom of the converted version and re-compile ?

      Meanwhile, the converted (NT8) version compiles successfully and generated the codes at the the bottom when I change the LLMA to EMA.

      Lolu
      Last edited by omololu; 06-29-2020, 10:37 AM.

      Comment


        #4
        Hello omololu,

        If you are not seeing the generated code when pressing F5 from that indicator that would mean you have a problem in your code or with the structure of the file. I could suggest to generate an entirely new indicator with a new name using the NinjaScript editor and then keep that structure of the new file and migrate your converted code to the new file.

        If you used an outside program to do the conversion in any way that could have added extra characters or placed code in incorrect locations which will prevent the NinjaScript generator from working. If you manually converted the file and coded it yourself, this is likely a problem with how the file is structured.You can try commenting out all of your code and leaving just the class to see if that allows the code to generate, if not a new file may be needed here.

        If you can attach a sample of the code which won't generate the NinjaScript generated section I can take a look at that to try and find out why.


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

        Comment


          #5
          Originally posted by NinjaTrader_Jesse View Post
          Hello omololu,

          If you are not seeing the generated code when pressing F5 from that indicator that would mean you have a problem in your code or with the structure of the file. I could suggest to generate an entirely new indicator with a new name using the NinjaScript editor and then keep that structure of the new file and migrate your converted code to the new file.

          If you used an outside program to do the conversion in any way that could have added extra characters or placed code in incorrect locations which will prevent the NinjaScript generator from working. If you manually converted the file and coded it yourself, this is likely a problem with how the file is structured.You can try commenting out all of your code and leaving just the class to see if that allows the code to generate, if not a new file may be needed here.

          If you can attach a sample of the code which won't generate the NinjaScript generated section I can take a look at that to try and find out why.


          I look forward to being of further assistance.
          I PMed you on Jun 29 but I did not receive any response from you. You may want to check your Message box. In any case, let me reframe my challenge issue and as follow;

          NT7 codes

          if (IndicatorInputSelector == 3){ CyclePrice.Set(LLMA(Close, pPriceActionFilter,0)[0]);ZL1.Set(ZeroLag(CyclePrice[0], pFilterStrengthLLMA, 0));}

          if (IndicatorInputSelector == 3){ cyclePrice1 = LLMA(Close, pPriceActionFilter,0)[SwitchA];}

          if (IndicatorInputSelector == 3){ cyclePrice2 = LLMA(Close, pPriceActionFilter,0)[SwitchA];}

          if (IndicatorInputSelector == 3){ cyclePrice3 = LLMA(Close, pPriceActionFilter,0)[SwitchB];}

          if (IndicatorInputSelector == 3){ cyclePrice4 = LLMA(Close, pPriceActionFilter,0)[SwitchB];}

          NT8 codes after conversion

          if (IndicatorInputSelector == 3){ CyclePrice[0] = LLMA(Close, pPriceActionFilter,0)[0];ZL1[0] = ZeroLag(CyclePrice[0], pFilterStrengthLLMA, 0);}

          if (IndicatorInputSelector == 3){ cyclePrice1 = LLMA(Close, pPriceActionFilter,0)[SwitchA];}

          if (IndicatorInputSelector == 3){ cyclePrice2 = LLMA(Close, pPriceActionFilter,0)[SwitchA];}

          if (IndicatorInputSelector == 3){ cyclePrice3 = LLMA(Close, pPriceActionFilter,0)[SwitchB];}

          if (IndicatorInputSelector == 3){ cyclePrice4 = LLMA(Close, pPriceActionFilter,0)[SwitchB];}

          The issue is that the above converted lines (NT8) gave compilation Error Message: "NinjaTrader.NinjaScript.Indicators.LLMA" is a "type" but is used as a "variable", whereas the same lines but with SMA, RVI and EMA indicators, did not give this compilation error. Please, note that LLMA is not an in-built NT8 indicator, but I have it installed from a 3rd-party free source. So, is the issue with the fact that LLMA is not an NT8 in-built indicator ? Please, how do I resolve this issue ?

          Omololu

          Comment


            #6
            Hello omololu,

            We don't use the private message system, you would need to post in this existing thread that you created or email our platform support [at] ninjatrader.com.

            The issue is that the above converted lines (NT8) gave compilation Error Message: "NinjaTrader.NinjaScript.Indicators.LLMA" is a "type" but is used as a "variable", whereas the same lines but with SMA, RVI and EMA indicators, did not give this compilation error. Please, note that LLMA is not an in-built NT8 indicator, but I have it installed from a 3rd-party free source. So, is the issue with the fact that LLMA is not an NT8 in-built indicator ? Please, how do I resolve this issue ?
            I understand the issue, this is what you had previously described. We would still need to review the LLMA code to see why this happens. If you can post a sample of the code which is not generating the NinjaScript generated code we can look into that. You can also try generating a new file named LLMA2 and then copy the core parts of it such as the OnBarUpdate and variables. This is excluding the previous class and file structure in case there is something wrong with that.

            If you don't have the code for the LLMA that would be different, in that case you would have to contact the third party to see if it was made for NinjaScript use.


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

            Comment


              #7
              Originally posted by NinjaTrader_Jesse View Post
              Hello omololu,

              We don't use the private message system, you would need to post in this existing thread that you created or email our platform support [at] ninjatrader.com.



              I understand the issue, this is what you had previously described. We would still need to review the LLMA code to see why this happens. If you can post a sample of the code which is not generating the NinjaScript generated code we can look into that. You can also try generating a new file named LLMA2 and then copy the core parts of it such as the OnBarUpdate and variables. This is excluding the previous class and file structure in case there is something wrong with that.

              If you don't have the code for the LLMA that would be different, in that case you would have to contact the third party to see if it was made for NinjaScript use.


              I look forward to being of further assistance.
              Ok.

              I have sent an email to platform support [at] ninjatrader.com.

              Omololu

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by FrazMann, Today, 11:21 AM
              2 responses
              6 views
              0 likes
              Last Post NinjaTrader_ChristopherJ  
              Started by rjbtrade1, 11-30-2023, 04:38 PM
              2 responses
              80 views
              0 likes
              Last Post DavidHP
              by DavidHP
               
              Started by Spiderbird, Today, 12:15 PM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_ChristopherJ  
              Started by lorem, Yesterday, 09:18 AM
              5 responses
              18 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by cmtjoancolmenero, Yesterday, 03:58 PM
              12 responses
              42 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X