Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

3 exact same strategies but different SMA???

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

    3 exact same strategies but different SMA???

    Hi, for testing, I have loaded a strategy with an SMA 20/50 in three separate windows. i have added a second data series because i need it later. how can i calculate and display the SMA only on the first data series?


    Code:
    AddDataSeries(BarsPeriodType.Tick, 1);
    Code:
    smaFast = SMA(20);
    smaSlow = SMA(50);
    smaFast.Plots[0].Brush = Brushes.Goldenrod;
    smaSlow.Plots[0].Brush = Brushes.SeaGreen;
    AddChartIndicator(smaFast);
    AddChartIndicator(smaSlow);
    Click image for larger version

Name:	Screenshot_1.jpg
Views:	277
Size:	274.1 KB
ID:	1148585Click image for larger version

Name:	Screenshot_3.jpg
Views:	275
Size:	304.4 KB
ID:	1148586
    sidlercom80
    NinjaTrader Ecosystem Vendor - Sidi Trading

    #2
    Hello sidlercom80,

    Thanks for your post.

    I see that you have added a 1 tick series for something else later.

    I see that you have added two SMAs and are displaying them in the chart with AddChartIndicator().

    By default, the SMA would be based on the chart bars series (first data series).

    Did you have another dataseries?

    I'm not sure I understand what your question is, can you be specific?.

    Comment


      #3
      Hi _PaulH, thanks for your answer. the two sma lines are both examples. to me it looks as if the sma lines are calculated arbitrarily and without logical on the two data series. if i restart the 3 strategies it may be that other values of the lines are displayed, see image:

      Click image for larger version  Name:	Screenshot_1.jpg Views:	0 Size:	328.1 KB ID:	1148608 Click image for larger version

Name:	Screenshot_2.jpg
Views:	263
Size:	94.0 KB
ID:	1148610

      I have also made a short video


      OnBarUpdate only states:
      Code:
      if (BarsInProgress == 1)
         return;
      Last edited by sidlercom80; 03-25-2021, 01:11 PM.
      sidlercom80
      NinjaTrader Ecosystem Vendor - Sidi Trading

      Comment


        #4
        Hello sidlercom80,

        Thanks for your reply and video.

        I replicated your code (without the BIP=1) and here they all look the same and have the same values. (I did change the time scaling to try and distort). Can you create 3 new charts without any other indicator or any other templates applied and see if you can replicate them? I'll attach what I used as well so you can test with that.

        Screenshot:

        Click image for larger version

Name:	sidlercom80-1.PNG
Views:	280
Size:	139.3 KB
ID:	1148619

        [ATTACH]n1148620[/ATTACH]

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        90 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        137 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        120 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        69 views
        0 likes
        Last Post PaulMohn  
        Working...
        X