Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Naming a copied indicator

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

    Naming a copied indicator

    Hello,
    In the ninjascript editor, I used "save as" to make a copy of the "PriceLine" indicator. I got a message about changing the name in OnStateChange() to prevent duplicate indicators showing in the indicator drop list.

    Here's how the copied indicator file "PriceLineTemp" appears. Can you show me an example of what to change in order to have Price Line Temp show in my indicator list? I currently have 2 Price Line indicators listed in the drop list. I tried to edit the areas in bold red text below. I got a message about NinjaTrader.Custom.Resource does not have a definition for that new name..
    //This namespace holds Indicators in this folder and is required. Do not change it.
    namespace NinjaTrader.NinjaScript.Indicators
    {
    /// <summary>
    /// Displays ask, bid, and/or last lines on the chart.
    /// </summary>
    public class PriceLineTemp : Indicator
    {
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = Custom.Resource.NinjaScriptIndicatorDescription
    PriceLineTemp;
    Name = Custom.Resource.NinjaScriptIndicatorName
    PriceLineTemp;
    Calculate = Calculate.OnPriceChange;
    IsOverlay = true;
    ShowTransparentPlotsInDataBox = false;
    DrawOnPricePanel = true;
    IsSuspendedWhileInactive = true;
    ShowAskLine = false;
    ShowBidLine = false;
    ShowLastLine = true;
    AskLineLength = 100;
    BidLineLength = 100;
    LastLineLength = 100;
    AskStroke = new Stroke(Brushes.DarkGreen, DashStyleHelper.Dash, 1);
    BidStroke = new Stroke(Brushes.Blue, DashStyleHelper.Dash, 1);
    LastStroke = new Stroke(Brushes.Yellow, DashStyleHelper.Dash, 1);
    }​​
    Thanks.

    #2
    Hello BerryTrader,

    Thank you for your post.

    Instead of using Custom.Resource.NinjaScriptIndicatorDescription in the description and Custom.Resource.NinjaScriptIndicatorName in the name, use your own custom description and name. For example,

    Description = "my PriceLineTemp description";
    Name = "PriceLineTemp";

    After making these changes, compile the script and test to see if you are still seeing the error or unable to see the indicator in the Indicators list.

    Please let me know if I can assist further.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    23 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    33 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    51 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X