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:	317
Size:	274.1 KB
ID:	1148585Click image for larger version

Name:	Screenshot_3.jpg
Views:	309
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:	287
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:	314
Size:	139.3 KB
ID:	1148619

        [ATTACH]n1148620[/ATTACH]

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by kinfxhk, 07-14-2026, 09:39 AM
        0 responses
        15 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 10:18 AM
        0 responses
        59 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 09:50 AM
        0 responses
        42 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 07:21 AM
        0 responses
        47 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-11-2026, 02:11 AM
        0 responses
        38 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X