Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi Time frame Ema Price Crossover???

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

    Multi Time frame Ema Price Crossover???

    Can I know please how is possible write a code for 2 time frame and 2 ema???
    A red all samples and forum but there isn´t some how this.
    I like this:

    if ema-1 on 100min time frame is > then current price +0,25 && ema-2 on day time frame is < then current price - 0,25

    do this....

    I tried with this sample but isn t working!
    if EMA(14)[0] > Close[0] && EMA(BarsArray[1], 14)[0] < Close[0]

    Can you help me please.
    Thanks.

    #2
    Code:
    if (BarsInProgress == 0)
    {
         if (EMA(BarsArray[0], 14)[0] > Close[COLOR=Red][0][/COLOR] + 0.25 && EMA(BarsArray[1], 14)[0] < Close[0] - 0.25)
              // Do something
    }
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Now have I compiled it but I haven't any trade on my backtest?What's wrong..?When I


      protected
      overridevoid OnBarUpdate()
      {
      if (CurrentBar < 150)
      return;
      /* Checks to see if the day of the week is Monday or Friday. Only allows trading
      if the day of the week is not Monday or Friday. */
      if (Time[0].DayOfWeek != DayOfWeek.Saturday && Time[0].DayOfWeek != DayOfWeek.Sunday)

      /* Checks to see if the time is during the busier hours (format is HHMMSS or HMMSS).
      Only allow trading if current time is during a busy period.The timezone used here
      is (GMT-05:00) EST. */
      if ((ToTime(Time[0]) >= 70000 && ToTime(Time[0]) < 190000))

      // Short Signal
      if (BarsInProgress == 0)
      {
      if (EMA(BarsArray[0], 60)[0] > Close[0] + 0.25 && EMA(BarsArray[1], 60)[0] < Close[0] - 0.25)
      EnterShort(
      "EMA Entry1");
      }

      if (BarsInProgress == 0)
      {
      if (EMA(BarsArray[0], 60)[0] < Close[0] - 0.25 && EMA(BarsArray[1], 60)[0] > Close[0] + 0.25)
      EnterLong(
      "EMA Entry1");
      }
      }

      Thanks.

      Comment


        #4
        Here is a link with helpful information that can guide you through debugging.

        RayNinjaTrader Customer Service

        Comment


          #5
          One of the problems I see is your lack of parenthesis.
          Code:
          protected override void OnBarUpdate()
          {
              if (CurrentBar < 150)
                  return;
              /* Checks to see if the day of the week is Monday or Friday. Only allows trading
              if the day of the week is not Monday or Friday. */
              if (Time[0].DayOfWeek != DayOfWeek.Saturday && Time[0].DayOfWeek != DayOfWeek.Sunday)
              [COLOR=Red]{[/COLOR]
          
                  /* Checks to see if the time is during the busier hours (format is HHMMSS or HMMSS).
                  Only allow trading if current time is during a busy period.The timezone used here
                  is (GMT-05:00) EST. */
                  if ((ToTime(Time[0]) >= 70000 && ToTime(Time[0]) < 190000))
                  [COLOR=Red]{[/COLOR]
                      // Short Signal
                      if (BarsInProgress == 0)
                      {
                          if (EMA(BarsArray[0], 60)[0] > Close[0] + 0.25 && EMA(BarsArray[1], 60)[0] < Close[0] - 0.25)
                              EnterShort("EMA Entry1");
          
                          if (EMA(BarsArray[0], 60)[0] < Close[0] - 0.25 && EMA(BarsArray[1], 60)[0] > Close[0] + 0.25)
                              EnterLong("EMA Entry1");
                      }
                  [COLOR=Red]}[/COLOR]
              [COLOR=Red]}[/COLOR]
          }[FONT=Courier New][SIZE=2][/SIZE][/FONT]
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Price Crossover!!

            Hello support,

            can you tell me how is possible have the Price Crossover?
            Something like this:

            When current bid,ask (or Close Price etc..) Cross above Ema + 20 ticks.
            //do something

            My code for now isn´t working...
            Problem is that I need when current price cross above Ema´s and not Ema about Ema!

            Can you help me please?
            Thanks!

            VB

            Comment


              #7
              if (CrossAbove(Close, EMA(20)[0] + 20 * TickSize, 1))
              // Do something
              RayNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              601 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              347 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              103 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              559 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              558 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X