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

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

Name:	Screenshot_3.jpg
Views:	197
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?.

    Paul H.NinjaTrader Customer Service

    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:	186
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:	210
Size:	139.3 KB
ID:	1148619

        [ATTACH]n1148620[/ATTACH]

        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by alifarahani, Today, 09:40 AM
        6 responses
        31 views
        0 likes
        Last Post alifarahani  
        Started by Waxavi, Today, 02:10 AM
        1 response
        17 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by Kaledus, Today, 01:29 PM
        5 responses
        14 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Waxavi, Today, 02:00 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by gentlebenthebear, Today, 01:30 AM
        3 responses
        17 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X