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

In the strategy of two tools to each connect indicator

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

    In the strategy of two tools to each connect indicator


    Hello! Perhaps someone faced with similar and will help me in solving this issue: In the strategy, where there are two tools, you need to connect your indicator to each tool. The data of these indicators should be displayed on the panel number 3 of the chart. I would be very grateful if someone responds to this letter. Attached to the letter screen.
    Attached Files

    #2
    Hello ArchakovDenis,

    Thanks for your post.

    Additional panels will be added to a chart if the Strategy adds a plot or an Indicator is added with AddChartIndicator() and the strategy/indicator have IsOverlay set to false. If IsOverlay is set to true, the indicator/strategy will not create a new panel for plots.

    Since AddChartIndicator is called in State.DataLoaded, any strategy added plots will be take the first added panel, and each indicator added with AddChartIndicator will take additional panels after that. If you would like to reorganize these, you can change the Panel property for the indicators and the strategy so they are organized to your liking. You will have to keep in mind how many panels are added and which panels the plots should be drawn to avoid issues. I suggest setting this after you have called AddChartIndicator in State.DataLoaded.

    Code:
    private ADL ADL1;
    private ADL ADL2;
    
    protected override void OnStateChange()
    {
        if (State == State.SetDefaults)
        {
            Description                                    = @"Enter the description for your new custom Strategy here.";
            Name                                        = "Test";
            AddPlot(Brushes.White, "StrategyPlot");
        }
        else if (State == State.DataLoaded)
        {                
            ADL1                = ADL(Close);
            ADL2                = ADL(High);
            ADL1.Plots[0].Brush = Brushes.MediumSpringGreen;
            ADL2.Plots[0].Brush = Brushes.DarkCyan;
            AddChartIndicator(ADL1);
            AddChartIndicator(ADL2);
    
            ADL1.Panel = 2;
            ADL2.Panel = 3;
            Panel = 4;
        }
    }
    
    protected override void OnBarUpdate()
    {
        Values[0][0] = Close[0];
    }
    Please let us know if we can be of further assistance.
    Last edited by NinjaTrader_Jim; 12-03-2018, 12:10 PM.
    JimNinjaTrader Customer Service

    Comment


      #3

      Thank you for responding to my letter. It is very important for me!!! Still, some points are not yet clear. If you are not very difficult, you could explain them. I attach scans to the letter.
      Attached Files

      Comment


        #4
        Hello ArchakovDenis,

        You are setting the strategy plots and the plots for both SUM's to Panel 3. Panel 3 will be scaled to display these values. If you would like to have the plots displayed with a more meaningful visual representation, I would suggest having the plots use their own panels so the panel scale does not squeeze all plots to make them viewable.

        Please let us know if you have any questions.
        JimNinjaTrader Customer Service

        Comment


          #5

          Hello! I think that you did not really understand my motivation. 1. I would like for each of the two tools (for example, ES and VX) to have its own indicator. 2. These two indicators were on the same panel, for example, on panel No. 3. 3. The intersection of these two indicators of each other would be a condition for entry / exit into the position. Here is a simple strategy to succeed.

          Comment


            #6
            Hello ArchakovDenis,

            Where the indicators are drawn will simply be visual. You could take the approaches mentioned earlier in the thread to customize where these plots will be presented.

            Conditions that the strategy uses will be based on the prices associated with the indicator plots and will not check for visual crosses. Let's say for example we have SMA values for ES at 2785.38 and 2786.32 and SMA values for VX at 18.00 and 19.03. If you wanted to create a crossover here, you would have to scale the indicator values so the price values will create the crossovers and appropriate logic in your strategy.

            Please refer to the documentation page below which describes valid inputs for system indicators for reference on having indicators based off of separate Series objects like from an additional data series. I'll also include documentation for Multi Time Frame and instruments as it provides a complete walkthrough for working with multi series NinjaScripts.

            Valid input for system indicators - https://ninjatrader.com/support/help..._indicator.htm

            Multi Time Frame and instruments - https://ninjatrader.com/support/help...nstruments.htm

            Please let us know if you have any additional questions.
            JimNinjaTrader Customer Service

            Comment


              #7

              "If you want to create a crossover here, you will have to scale the indicators so that the price values ​​create crossovers and the corresponding logic in your strategy."
              Please tell me to create a crossover here, how is it possible to scale the indicators so that the price values ​​create crossovers and the corresponding logic in the strategy?

              Comment


                #8
                Hello ArchakovDenis,

                You would have to multiply or divide the indicator values so they are relative to each other. For example, let's say our SMA on VX is instantiated as SMA_VX. We would have to multiply SMA_VX[0] to scale it to be relative to the SMA for ES. The coefficient for scaling would be subjective to each instrument pair and how you would like the scaling to be done.

                If there is anything else we can do to help, please let us know.
                JimNinjaTrader Customer Service

                Comment


                  #9

                  Thank you for the clarification, for your help!

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by trilliantrader, 04-18-2024, 08:16 AM
                  4 responses
                  18 views
                  0 likes
                  Last Post trilliantrader  
                  Started by mgco4you, Today, 09:46 PM
                  1 response
                  7 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by wzgy0920, Today, 09:53 PM
                  0 responses
                  9 views
                  0 likes
                  Last Post wzgy0920  
                  Started by Rapine Heihei, Today, 08:19 PM
                  1 response
                  10 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by Rapine Heihei, Today, 08:25 PM
                  0 responses
                  10 views
                  0 likes
                  Last Post Rapine Heihei  
                  Working...
                  X