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

Change ex4 to N8

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

    Change ex4 to N8

    Would you please let me know:
    How can I change a script which wrote for MT4 and change it to N8
    DailyRange21 =DoubleToStr( A21DATR() , Digits);
    //------

    double A21DATR()
    {

    double A21Datr21 = iATR(NULL , PERIOD_D1 , 21 , 1) * 3 ;
    double A21Datr7 = iATR(NULL , PERIOD_D1 , 7 , 1) * 7 ;
    double A21Datr3 = iATR(NULL , PERIOD_D1 , 3 , 1) * 21 ;

    double sum = ((A21Datr3 + A21Datr7 + A21Datr21) / 31) * 1 ;

    return(sum);

    //***************************************

    DailyAverage = DoubleToStr(ADATR() , Digits);
    //------


    double ADATR()
    {
    double ADatr264 = iATR(NULL , PERIOD_D1 , 264 , 1) * 8 ;
    double ADatr132 = iATR(NULL , PERIOD_D1 , 132 , 1) * 5 ;
    double ADatr66 = iATR(NULL , PERIOD_D1 , 66 , 1) * 3 ;
    double ADatr21 = iATR(NULL , PERIOD_D1 , 21 , 1) * 2 ;
    double ADatr10 = iATR(NULL , PERIOD_D1 , 10 , 1) * 1 ;
    double ADatr5 = iATR(NULL , PERIOD_D1 , 5 , 1) * 1 ;

    double sum = ((ADatr5 + ADatr10 + ADatr21 + ADatr66 + ADatr132 + ADatr264) / 20) * 1 ;

    return(sum);
    }
    //***********************

    Label("DailyAverage" ,"" + " " + DoubleToStr(((DailyAverage+DailyRange21)/Point)/20 , (0))+ " " + "","Arial Bold", 10,TehranTimes ,2, 200, 28, false);

    #2
    Hello mbafelfel,

    Thank you for your post and welcome to the NinjaTrader Support Forum!

    We do have resources to help you begin creating NinjaScript Strategies/Indicators.

    I would suggest to take a look at the NinjaScript tutorials from NinjaTrader 7 as an introduction step to using NinjaScript
    Additionally, you may use the Strategy Builder as a tool to create simple NinjaScript strategies. You can create logic that can mostly be copied from a Strategy's OnBarUpdate() method to an Indicator's OnBarUpdate() method. You can for example create logic using the ATR indicator that the MT5 code appears to use similarly.
    There are a few Sample Automated Strategies which come pre-configured in NinjaTrader that you can use as a starting point. These are found under New -> NinjaScript Editor -> Strategy. You will see locked strategies where you can see the details of the code, but you will not be able to edit (you can though always create copies you can later edit via right click > Save as)

    We also have some Reference samples online as well as ‘Tips and Tricks’ for both indicators and strategies:
    These samples can be downloaded, installed and modified from NinjaTrader and hopefully serve as a good base for your custom works.

    Further, the following link is to our help guide with an alphabetical reference list to all supported methods, properties, and objects that are used in NinjaScript.
    And our Educational Resources in the NinjaTrader 8 help guide.
    Please let me know if I may be of further assistance.

    Comment


      #3
      Hi Patrick

      many thanks for your reply.

      Is there any video to more information about new indicator?

      regards
      Last edited by mbafelfel; 05-05-2017, 10:26 AM.

      Comment


        #4
        Hi Patrick

        Also, let me know more about the following section

        I need only the last number of ATR which port on my chart not in the graph
        For example please find in the attachment
        Attached Files

        Comment


          #5
          Hello mbafelfel,

          Thanks for writing back.

          There are not any video tutorials on creating indicators.

          I need only the last number of ATR which port on my chart not in the graph
          For example please find in the attachment
          I may be misunderstanding here, but when you reference an indicator within OnBarUpdate() you will get output of the indicators calculation from that bar. You would just have to reference that indicator and print the result or display it with Draw.Text() or Draw.TextFixed().

          I suggest to create a condition within the Strategy Builder that includes the ATR indicator and unlocking the code to observe how the Strategy Builder adds the indicator to the NinjaScript.

          If the indicator is created with a name like "ATR1" you could use the following syntax for Draw.TextFixed() to display the ATR value for the current bar on your chart.

          Code:
          protected override void OnBarUpdate()
          {
          	Draw.TextFixed(this, "tag", ATR1[0].ToString(), TextPosition.BottomRight); 
          }
          Draw.TextFixed() - https://ninjatrader.com/support/help..._textfixed.htm

          In the support department, we will not be able to provide assistance in developing your indicator/strategy or debugging your code. If you are looking for those services, you can write in to platformsupport[at]ninjatrader[dot]com with the thread URL and the text "Attention Jim." I will be able to get you connected with a member of our Business Development team who can then provide a list of NinjaScript Consultants who would be happy to develop and debug your code.

          Please let me know if I may be of further help.
          JimNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by sofortune, Yesterday, 11:48 AM
          2 responses
          23 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by Zach55, 02-19-2024, 07:22 PM
          2 responses
          59 views
          0 likes
          Last Post lbadisa1  
          Started by JGriff5646, Today, 05:47 PM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by AlphaOptions, 06-18-2013, 08:24 AM
          9 responses
          2,200 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by ttrader23, Today, 09:33 AM
          3 responses
          23 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X