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

Indicator

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

    #16
    Hi ryebank,

    The details for comparing values in a multi-time script can be found here: http://www.ninjatrader-support.com/H...ameInstruments
    TimNinjaTrader Customer Service

    Comment


      #17
      syntax

      thanks for that

      I'm trying to compare the following

      (SMA(Close,8)[0] >= SMA(Close,14)[0]

      However if the values of the SMA'a [0] are the same they are missed, i want it to be greater than or equal to

      cheers
      Rye

      Comment


        #18
        Hi ryebank,

        To clarify, this is now on a single series (same time frame)?
        Is this an "if" statement? Something like...
        Code:
        if (SMA(Close,8)[0] >= SMA(Close,14)[0])
        do something;
        What leads you to believe it's missed when they are the same? Keep in mind that may be a somewhat rare occurrence for them to exactly equal one another.
        TimNinjaTrader Customer Service

        Comment


          #19
          hi

          Yes single time frame.

          An alert is generated if certain conditions are meet on bar[0] and one of these constraints is that SMA(Close,8)[0] is greater than or egual to SMA(Close,14)[0] - on all occasions where SMA(Close,8)[0] = 1.5362 and SMA(Close,14)[0] = 1.5362 it fails the test even though it passes all other constraints

          Comment


            #20
            Hi ryebank,

            Try testing just the SMA condition by itself, to be sure what is truly happening, I tried the following, and the condition was satisfied several times.

            I tried this and was able to get several instances (on a 5min ES chart dating back several months)

            Code:
            if (SMA(Close,8)[0] == SMA(Close,14)[0])
            {
            Print("Yes");
            DrawVerticalLine("tag" + CurrentBar, 0, Color.Magenta, DashStyle.Solid, 4);
            }
            TimNinjaTrader Customer Service

            Comment


              #21
              ok

              i've run some tests and can see that if i use '<' then it passes so that implies that the value of SMA 8 is lower that SMA 14 but in the data box it says they are the same

              How do i find out what the exact values of the SMA's are if they are not the same s in the data box

              Comment


                #22
                daily charts

                another thing i've noticed is that the daily chars are not updating correctly. I see EURCAD last date 19/08/2010 and i see 09/009/2010 and for some reason can't reload historical data.

                I'm connected to gain capital....any ideas

                Comment


                  #23
                  Hi ryebank,

                  You can Print the values, for example:
                  Code:
                  if (CurrentBar<15)
                  return;
                  if (SMA(Close,8)[0] == SMA(Close,14)[0])		
                  {
                  Print("Yes");
                  Print(SMA(Close,8)[0]);
                  Print(SMA(Close,14)[0]);
                  DrawVerticalLine("tag" + CurrentBar, 0, Color.Magenta, DashStyle.Solid, 4);
                  }
                  More in on Print()'s at: http://www.ninjatrader.com/support/f...ead.php?t=3418

                  Gain does not provide Historical daily data: http://www.ninjatrader-support.com/H...HistoricalData

                  As a worksaround, you can try 1440 Minutes bars.
                  TimNinjaTrader Customer Service

                  Comment


                    #24
                    Mta

                    Thanks for all the info, but i'm struggling with referencing data form a daily chart to compare that with data from a 5/15/60 minute chart

                    What i'm trying to achieve is this

                    protected override void OnBarUpdate()
                    {
                    if (CurrentBar < 1) return;
                    if (EMA(Close,8)[0] > EMA(Close,14)[0] && (make the same comparison on the daily chart) || (EMA(Close,8)[0] < EMA(Close,14)[0] && (make the same comparison on the daily chart)
                    do something
                    }
                    }

                    Comment


                      #25
                      Hello ryebank,

                      Please not that multi time frame indicators are only available in version 7.

                      You'll have to look at sampleMultiTimeFrame. Click Tools > Edit NinjaScript > strategy and open this file.

                      Documentation is available here.

                      Once you've added the daily series in the Initialize, its close value is then accessed with Closes[1]

                      Example:
                      if (EMA(Closes[1], 8)[0] > EMA(Closes[1],14)[0] )
                      Ryan M.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by wzgy0920, 04-20-2024, 06:09 PM
                      2 responses
                      26 views
                      0 likes
                      Last Post wzgy0920  
                      Started by wzgy0920, 02-22-2024, 01:11 AM
                      5 responses
                      32 views
                      0 likes
                      Last Post wzgy0920  
                      Started by wzgy0920, Yesterday, 09:53 PM
                      2 responses
                      49 views
                      0 likes
                      Last Post wzgy0920  
                      Started by Kensonprib, 04-28-2021, 10:11 AM
                      5 responses
                      192 views
                      0 likes
                      Last Post Hasadafa  
                      Started by GussJ, 03-04-2020, 03:11 PM
                      11 responses
                      3,234 views
                      0 likes
                      Last Post xiinteractive  
                      Working...
                      X