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

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(1base.BarsPeriod.Value);
            Add("$GBPUSD"BarsPeriod.IdbarValue); 
            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 AveryFlynn, Today, 04:57 AM
            0 responses
            4 views
            0 likes
            Last Post AveryFlynn  
            Started by RubenCazorla, 08-30-2022, 06:36 AM
            3 responses
            77 views
            0 likes
            Last Post PaulMohn  
            Started by f.saeidi, Yesterday, 12:14 PM
            9 responses
            23 views
            0 likes
            Last Post f.saeidi  
            Started by Tim-c, Today, 03:54 AM
            0 responses
            3 views
            0 likes
            Last Post Tim-c
            by Tim-c
             
            Started by FrancisMorro, Today, 03:24 AM
            0 responses
            5 views
            0 likes
            Last Post FrancisMorro  
            Working...
            X