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

Name:	Screenshot_3.jpg
Views:	252
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:	243
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:	262
Size:	139.3 KB
ID:	1148619

        [ATTACH]n1148620[/ATTACH]

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        50 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        126 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        69 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X