Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Creating a forex correlation chart with no primary instrument?

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

    #16
    Hi Bertrand, by using the exact code in the example you gave, it will work. The only difference was that I had assigned the plot to a member variable and was using that to make it transparent. When I changed it from the variable to the Plots[] arrary, it succeeded.

    Could you also tell me how to ensure in the script that the zero line is always displayed (zero will always be visible, but often there is no line). Where my indicator lines cross over the zero line is important and I'd like to be able to visualize it properly.

    Thanks

    Comment


      #17
      adamus, you can set the plot's min and max scaling with the following code, which should always have the 0 line in view:
      Code:
                  Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
                  Plots[0].Max = 1;
                  Plots[0].Min = -1;
      Of course, you can change these values to suit your needs, but I am not sure whether or not they can be dynamically adjusted.
      AustinNinjaTrader Customer Service

      Comment


        #18
        Hi Austin,

        thanks, but zero will always be on the chart, I just need to make sure it has a grid line, and often it doesn't - that's what I mean about being able to see when the indicator lines cross over the x-axis at zero. If the zero line isn't there, it's difficult to see.

        Comment


          #19
          adamus, my apologies, I misunderstood your question. To add a zero line, please insert the following bit of code into the Initialize() section:
          Code:
          Add(new Line(Color.FromKnownColor(KnownColor.Black), 0, "ZeroLine"));
          AustinNinjaTrader Customer Service

          Comment


            #20
            Originally posted by MXASJ View Post
            adamus, try this:

            In Variables

            PHP Code:
            private int barValue; 
            
            In Initialize()

            PHP Code:
            barValue = Math.Max(1, base.BarsPeriod.Value);
            Add("$GBPUSD", BarsPeriod.Id, barValue); 
            
            I'd love to hear from you or the NT team why that shouldn't work as I have it in a few indis. NT7 b20.
            MXASJ,

            any tips for getting at the BarsArray in Initialize()?

            I want to do the following to get the indicator to display on strategy performance charts:

            Code:
            protected override void Initialize()
            {
                Add(PeriodType.Minute, 60);
                Add(CustomIndieFX2(BarsArray[1],  2, 3));
            }

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            599 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            344 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            103 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            558 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            557 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X