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

Show how much the price has moved in ticks/pips

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

    Show how much the price has moved in ticks/pips

    I don't have experience in writing NT script but I need a simple indicator which will show in terms of how many the ticks/pips a price has risen or fallen since I start the indicator (or when I'm connected to the data feed).

    For example, if ES was at 1703.00 when I am first connected to the data feed and now the price is at 1704.25, the indicator should show or plot 5. 30 second later, ES is at 1703.50, the indicator should show or plot 2.

    Any guidance with the code here? Or is there an existing indicator out there which is doing this already?

    Thanks

    #2
    Originally posted by jim380 View Post
    I don't have experience in writing NT script but I need a simple indicator which will show in terms of how many the ticks/pips a price has risen or fallen since I start the indicator (or when I'm connected to the data feed).

    For example, if ES was at 1703.00 when I am first connected to the data feed and now the price is at 1704.25, the indicator should show or plot 5. 30 second later, ES is at 1703.50, the indicator should show or plot 2.

    Any guidance with the code here? Or is there an existing indicator out there which is doing this already?

    Thanks
    What happens if you restart the indicator mid-session? Should it retain what you had, or should it start afresh, ignoring everything that came before the restart?

    Comment


      #3
      Originally posted by koganam View Post
      What happens if you restart the indicator mid-session? Should it retain what you had, or should it start afresh, ignoring everything that came before the restart?
      It should re-start all over again. I won't need it to take into account what was before it. Thanks

      Comment


        #4
        Hello jim380,

        I am not aware of an Indicator that would do something like that but you may do something like this:

        Code:
        private double initialPrice = 0;
        
        protected override void OnBarUpdate()
        {
        	if(Historical)
        		return;
        	if(initialPrice == 0)
        	{
        		initialPrice = Close[0];
        	}
        	else
        	{				
                   	PriceAction.Set(initialPrice-Close[0]);
        	}
        }
        This will simple make sure that it will not run on any historical data and then plot the change in price from when you start it.
        JCNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by mjairg, 07-20-2023, 11:57 PM
        3 responses
        213 views
        1 like
        Last Post PaulMohn  
        Started by TheWhiteDragon, 01-21-2019, 12:44 PM
        4 responses
        544 views
        0 likes
        Last Post PaulMohn  
        Started by GLFX005, Today, 03:23 AM
        0 responses
        3 views
        0 likes
        Last Post GLFX005
        by GLFX005
         
        Started by XXtrader, Yesterday, 11:30 PM
        2 responses
        12 views
        0 likes
        Last Post XXtrader  
        Started by Waxavi, Today, 02:10 AM
        0 responses
        7 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Working...
        X