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

Name:	Screenshot_3.jpg
Views:	45
Size:	304.4 KB
ID:	1148586

    #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:	45
Size:	94.0 KB
ID:	1148610

      I have also made a short video
      http://www.youtube.com/watch?v=UdLVa3MfK-4

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

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

        [ATTACH]n1148620[/ATTACH]

        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Jeremytang, 07-14-2018, 06:45 PM
        21 responses
        439 views
        0 likes
        Last Post mav8rick  
        Started by LeonK, Yesterday, 09:26 PM
        1 response
        8 views
        0 likes
        Last Post bltdavid  
        Started by NicholasJoannette, Yesterday, 03:01 PM
        2 responses
        11 views
        0 likes
        Last Post NicholasJoannette  
        Started by rach1994, Yesterday, 12:20 PM
        1 response
        35 views
        0 likes
        Last Post bltdavid  
        Started by litamm89, Yesterday, 11:00 AM
        5 responses
        22 views
        1 like
        Last Post rafael_delima86  
        Working...
        X