Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy-After Crossing and 1 Clean RangeBar Do Trade

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

    Strategy-After Crossing and 1 Clean RangeBar Do Trade

    Dears,
    I would like to ask you for help, I want to set into my strategy some code,which is described in 4 steps below, for better understand ,please look on the picture in the attached.

    1.
    After that, what the Price cross above the EMA with period 20,
    the strategy should wait for one clean Range Bar
    2.
    And than from open price on the second Range Bar,
    it will start position to short
    3.
    After that, what the Price cross over the EMA with period 20,
    should wait for one clean Range Bar
    4.
    And than from open price on the second Range Bar,
    the strategy close the short position and start the new position to long.


    Note:I using timeframe RB=8


    Please, is somebody who can help you with this?

    (I tried to set the offset for exactly 4ticks after crossing..but NT sometimes made 1tick,sometimes 3 or 5tickcs...and I don't think so why?)



    Thank you a lot for helping.
    Best regards
    j.halena
    Attached Files

    #2
    j.halena,

    I am not sure what you mean by "clean range bar". Where you may want to start off is in the Strategy Wizard. Please see this tutorial for getting started: http://www.ninjatrader-support.com/H...tml?Overview34
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Josh View Post
      j.halena,

      I am not sure what you mean by "clean range bar". Where you may want to start off is in the Strategy Wizard. Please see this tutorial for getting started: http://www.ninjatrader-support.com/H...tml?Overview34
      Thank you for answer.
      Yes, I tried to looking for it in the Help Quide..but I didn't find a solution.
      With "clean range bar", how you can see on the picture, I mean,that the all ticks of range bar is over EMA(Buy) or below EMA(sell)..there are 2cases -first case:Open to Close price or -second case:High to Low price..


      Thanks for helping
      Regards
      j.halena

      Comment


        #4
        j.halena,

        You want to go to the Strategy Wizard and build these conditions then. If you want it cleanly to cross over you want to do something like if the High[0] < EMA as well as Low[0] < EMA.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Josh View Post
          j.halena,

          You want to go to the Strategy Wizard and build these conditions then. If you want it cleanly to cross over you want to do something like if the High[0] < EMA as well as Low[0] < EMA.
          Thank you a lot Josh this helped me..
          As well is it possible to set range for input signal between 2EMAs?
          I mean,that input signal for Long position will be if for example EMA20 will be from 0 to -0,5 of price from EMA50 and for Short position will if EMA20 will be from 0 to 0,5 of price from EMA50?

          Thanks a lot Josh.
          Regards
          J.Halena

          Comment


            #6
            Create it as two separate conditions to create your range. Use > and < as your comparison operators.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Josh View Post
              Create it as two separate conditions to create your range. Use > and < as your comparison operators.
              Hi Josh,thank you,but sorry,I don't understand.
              Could you say me example for just Long position,please?
              I have this code?
              // Condition set 1
              if (EMA(0, EMA50)[0] > EMA(0, EMA20)[0])
              {
              EnterLong(DefaultQuantity, "");
              }
              // Condition set 2
              if (EMA(0, EMA50)[0] < EMA(0, EMA20)[0])
              {
              EnterShort(DefaultQuantity, "");
              }

              But I don't know how I can implement the range,that input will be only if the range between EMA20 and EMA50 is from 0 to 0,5 of their values.

              Thank you for your support.
              Regards
              J.Halena

              Comment


                #8
                j.halena,

                To create a range you just need to press the Add button twice within the same Set. That will create it as an "and" condition.

                Code:
                if (EMA(5)[0] > 0 && EMA(5) < 0.5)
                That would be a range from 0 to 0.5. You just need to adjust it to your likings.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by judysamnt7, 03-13-2023, 09:11 AM
                4 responses
                59 views
                0 likes
                Last Post DynamicTest  
                Started by ScottWalsh, Today, 06:52 PM
                4 responses
                36 views
                0 likes
                Last Post ScottWalsh  
                Started by olisav57, Today, 07:39 PM
                0 responses
                7 views
                0 likes
                Last Post olisav57  
                Started by trilliantrader, Today, 03:01 PM
                2 responses
                22 views
                0 likes
                Last Post helpwanted  
                Started by cre8able, Today, 07:24 PM
                0 responses
                10 views
                0 likes
                Last Post cre8able  
                Working...
                X