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 PaulMohn, Today, 05:00 AM
        0 responses
        8 views
        0 likes
        Last Post PaulMohn  
        Started by ZenCortexAuCost, Today, 04:24 AM
        0 responses
        6 views
        0 likes
        Last Post ZenCortexAuCost  
        Started by ZenCortexAuCost, Today, 04:22 AM
        0 responses
        3 views
        0 likes
        Last Post ZenCortexAuCost  
        Started by SantoshXX, Today, 03:09 AM
        0 responses
        16 views
        0 likes
        Last Post SantoshXX  
        Started by DanielTynera, Today, 01:14 AM
        0 responses
        5 views
        0 likes
        Last Post DanielTynera  
        Working...
        X