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

need to change the indicator on low's and high's

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

    need to change the indicator on low's and high's

    Hi All,
    I am not developer programmer so do not know how to get it done. If one of you wonderful guys can help me change this indicator for these following I really appreciate it. I like this indi to draw line for the following and mark it with what it is and price on the line.

    current day's high
    Current day's low
    Previous day high
    Previous day low
    Overnight high
    Overnight low

    Thanks in advance
    Bill
    Attached Files

    #2
    Hello billsingh,

    Thank you for writing in.

    Please note that the NinjaTrader support team does not provide programming services, however, I would be glad to provide resources on how to obtain these values in your script.

    NinjaTrader has two built-in indicators, Current Day OHL, and Prior Day OHLC, that can provide you the current day's high, current day's low, previous day's high, and previous day's low.




    Obtaining the overnight high and low would need custom programming. I've created a sample below that will run from 6:00 PM to 4:00 AM to obtain the high and low for that period:

    Code:
    private double overnightHigh = 0;
    private double overnightLow = 0;
    
    // checks to see if the script is evaluating a bar with a time from 6:00 PM to 4:00 AM
    // if you wish to change the times to denote a different period, change 180000 to the start of the overnight period and 40000 to the end
    if ((ToTime(Time[0]) >= 180000 && ToTime(Time[0]) <= 235959) 
    	|| (ToTime(Time[0]) >= 0 && ToTime(Time[0]) <= 40000))
    {
    	Print(Time[0]);
    	
    	if (overnightHigh == 0)
    		overnightHigh = Close[0];
    	else if (Close[0] > overnightHigh)
    	{
    		Print("High has changed.");
    		Print("Previous high: " + overnightHigh);
    		overnightHigh = Close[0];
    	}
    	
    	if (overnightLow == 0)
    		overnightLow = Close[0];
    	else if (Close[0] < overnightLow)
    	{
    		Print("Low has changed.");
    		Print("Previous low: " + overnightLow);
    		overnightLow = Close[0];
    	}
    	
    	Print("Close: " + Close[0]);
    	Print("High: " + overnightHigh);
    	Print("Low: " + overnightLow);
    }
    The ToTime() method I am using in the sample above converts a DateTime object into an integer for ease of comparison for time: https://ninjatrader.com/support/help...t7/?totime.htm

    The DrawLine() method can be used to draw lines: https://ninjatrader.com/support/help.../?drawline.htm
    The price of the line can be drawn on your chart by using DrawText(): https://ninjatrader.com/support/help.../?drawtext.htm

    Please, let me know if you wish for someone to create this script for you. I would be happy to forward you to our business development team who can connect you with a NinjaScript consultant to develop this for you.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Thank you Zac....I will let you know if need more help

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by DanielSanMartin, Yesterday, 02:37 PM
      2 responses
      13 views
      0 likes
      Last Post DanielSanMartin  
      Started by DJ888, 04-16-2024, 06:09 PM
      4 responses
      12 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by terofs, Today, 04:18 PM
      0 responses
      11 views
      0 likes
      Last Post terofs
      by terofs
       
      Started by nandhumca, Today, 03:41 PM
      0 responses
      8 views
      0 likes
      Last Post nandhumca  
      Started by The_Sec, Today, 03:37 PM
      0 responses
      7 views
      0 likes
      Last Post The_Sec
      by The_Sec
       
      Working...
      X