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

Any Assistance Would Be Appreciated

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

    Any Assistance Would Be Appreciated

    I am new to NinjaTrader and its program language. I have spent this weekend trying to code this simple indicator with no luck.

    Can anyone help me figure out what the code should look like.

    DAvg= (H+L+C)/3
    Point=(DAvg[0]+DAvg[1]+DAvg[2})/3

    IF Point<=H AND Point>=L AND
    C<=Low+((Point)-L)*2 THEN

    6SP= Low +((Point)-Low)*2;


    Any assistance would be appreciated.

    #2
    Hello OSysTrader,

    Thank you for your post.

    The code would be the following:
    Code:
            #region Variables
    		private DataSeries dAvg;
    		private double point = 0;
    		private double sixSP = 0;
            #endregion
    
            protected override void Initialize()
            {
    			dAvg = new DataSeries(this);
            }
            
            protected override void OnBarUpdate()
            {
    			if(CurrentBar <= 3)
    				return;
    			
    			dAvg.Set((High[0]+Low[0]+Close[0])/3);
    			point = (dAvg[0]+dAvg[1]+dAvg[3])/3;
    			
    			if(point <= High[0]
    				&& point >= Low[0]
    				&& Close[0] <= Low[0]+((point-Low[0])*2))
    			{
    				sixSP = Low[0]+((point-Low[0])*2);
    			}
    
    		}
    If you would like to take on learning NinjaScript, we have a fully documented help guide which will help you get started with Ninja Script. You will find language references to all of the methods and functions you will be using. You will also see a tutorial section which will help you create your first indicator and get you started with some of these concepts.
    A link to our Help Guide can be found below: http://www.ninjatrader.com/support/h...stribution.htm

    I am also linking you to the Educational Resources section of the Help Guide to help you get started with NinjaScript: http://www.ninjatrader.com/support/h..._resources.htm

    You will find Reference Samples online as well as some Tips and Tricks for both indicators and strategies:
    Click here to see our NinjaScript Reference Samples: http://www.ninjatrader.com/support/f...splay.php?f=30
    Click here to see our NinjaScript Tips: http://www.ninjatrader.com/support/f...ead.php?t=3229

    These samples can be downloaded, installed and modified from NinjaTrader and hopefully serve as a good base for your custom works.

    There is a also a growing library of user submitted custom indicators (100+) that can be downloaded from our support form. Please look in the NinjaScript File Sharing section of our support forum as you may find what you are looking for there: http://www.ninjatrader.com/support/f...splay.php?f=37

    If you have limited time or programming capabilities, you can discuss your requirements with any of our certified NinjaScript consultants.
    Click here for a list of certified NinjaScript Consultants: http://www.ninjatrader.com/Ecosystem/NonBroker.php#81

    Please let me know if you have any questions.

    Comment


      #3
      Thanks for the help. Do you know if an indicator can be created that would display 1 bar forward? The indicator is created EOD and I am trying to have the indicator display 1 bar to the right (tomorrow) of todays bar.

      Comment


        #4
        Hello OSysTrader,

        Thank you for your post.

        So something like a displacement of the values just one bar ahead?

        You should be able to do this through the chart by right clicking in the chart > selecting Indicators > select your indicator > on the right hand side change Displacement to 1 > OK.

        For information on the indicators menu please visit the following link: http://www.ninjatrader.com/support/h...indicators.htm

        Please let me know if I may be of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by LawrenHom, Today, 10:45 PM
        0 responses
        3 views
        0 likes
        Last Post LawrenHom  
        Started by love2code2trade, Yesterday, 01:45 PM
        4 responses
        28 views
        0 likes
        Last Post love2code2trade  
        Started by funk10101, Today, 09:43 PM
        0 responses
        7 views
        0 likes
        Last Post funk10101  
        Started by pkefal, 04-11-2024, 07:39 AM
        11 responses
        37 views
        0 likes
        Last Post jeronymite  
        Started by bill2023, Yesterday, 08:51 AM
        8 responses
        44 views
        0 likes
        Last Post bill2023  
        Working...
        X