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

Plot using RoundedToTickSize in non primary BarsArray - question

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

    Plot using RoundedToTickSize in non primary BarsArray - question

    I am using the following code snippet in a multi time frame indicator:

    Neutral.Set(EMA(BarsArray[9],20)[0]);

    It works with no problem and properly shows me a price marker on the right side.

    Now I am trying to "convert" this to use RoundedToSickSize. In other indicators I used to use this, and it worked:

    Neutral.Set(Instrument.MasterInstrument.Round2Tick Size(EMA(20)[0]));

    However, when I am now trying the following to access the BarsArray[9]:

    Neutral.Set(Instrument.MasterInstrument.Round2Tick Size(EMA(BarsArray[9],20))[0]);

    I get an error message as it does not want to accept the code, "... has some invalid arguments".

    Any idea what I need to do differently here?

    sandman








    #2
    Hello sandman,

    Thanks for your post.

    If the Neutral.Set() code is copied verbatim, you have an extra end parenthesis after the EMA and before its BarsAgo reference. I have a video demonstration testing Round2TickSize with an EMA on a secondary series and I am not seeing any issue. Demo and test script attached.

    Demo - https://drive.google.com/file/d/1tIt...w?usp=drivesdk

    Please let me know if there is anything else we can do to help.
    Attached Files
    JimNinjaTrader Customer Service

    Comment


      #3
      Jim. Thank you very much for your very comprehensive response incl the video. You are right: it was that extra parenthesis.

      sandman

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Irukandji, Today, 04:58 AM
      0 responses
      1 view
      0 likes
      Last Post Irukandji  
      Started by fitspressoburnfat, Today, 04:25 AM
      0 responses
      2 views
      0 likes
      Last Post fitspressoburnfat  
      Started by Skifree, Today, 03:41 AM
      1 response
      4 views
      0 likes
      Last Post Skifree
      by Skifree
       
      Started by usazencort, Today, 01:16 AM
      0 responses
      1 view
      0 likes
      Last Post usazencort  
      Started by kaywai, 09-01-2023, 08:44 PM
      5 responses
      604 views
      0 likes
      Last Post NinjaTrader_Jason  
      Working...
      X