Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

need help

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

    need help

    hell, i'am new here, i need some help to make a strategy that:
    range bar=5
    if hight - open = 5 sell for 1 tick take profit and 3 tick stop loss
    and
    if open - low = 5 buy for 1 tick take profit and 3 tick stop loss
    thanks to help me

    #2
    Hello gabsi,

    Thank you for writing in and welcome to the NinjaTrader Support Forum!

    To clarify:
    • You wish to run your strategy on a 5 Range chart
    • If the high of the bar minus the open of the bar equals 5, enter a short position with a 1 tick profit target and 3 tick stop loss
    • If the open of the bar minus the low of the bar equals 5, enter a long position with a 1 tick profit target and 3 tick stop loss


    Is this what you are looking for?

    You would not be able to obtain the difference between the high and low/open and low in the Strategy Wizard; this would need to be manually coded.

    I would highly suggest taking a look at the help guide's Educational Resources section for valuable resources for learning skills in building custom indicators and strategies within NinjaTrader: https://ninjatrader.com/support/help..._resources.htm

    Here is a simple example of how your conditions can be written in code:
    Code:
    protected override void Initialize()
    {
         SetStopLoss(CalculationMode.Ticks, 3);
         SetProfitTarget(CalculationMode.Ticks, 1);
    }
    
    protected override void OnBarUpdate()
    {
         if (High[0] - Open[0] == 5)
              EnterShort();
         else if (Open[0] - Low[0] == 5)
              EnterLong();
    }
    More information about the syntax used can be found below:
    SetStopLoss()
    SetProfitTarget()
    High
    Open
    Low
    EnterShort()
    EnterLong()

    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ZacharyG View Post
      Here is a simple example of how your conditions can be written in code:
      Code:
      protected override void Initialize()
      {
           SetStopLoss(CalculationMode.Ticks, 3);
           SetProfitTarget(CalculationMode.Ticks, 1);
      }
      
      protected override void OnBarUpdate()
      {
           if ([COLOR=Black]High[0] - Open[0] [/COLOR]== 5)
                EnterShort();
           else if ([COLOR=Black]Open[0] - Low[0] =[/COLOR]= 5)
                EnterLong();
      }
      I think it is prudent to assume the OP meant to say 5 ticks.

      Code:
      protected override void OnBarUpdate()
      {
           if ([COLOR=Red]((High[0] - Open[0])/TickSize) [/COLOR]== 5)
                EnterShort();
           else if ([COLOR=Red]((Open[0] - Low[0])/TickSize)[/COLOR] == 5)
                EnterLong();
      }

      Comment


        #4
        Originally posted by bltdavid View Post
        I think it is prudent to assume the OP meant to say 5 ticks.

        Code:
        protected override void OnBarUpdate()
        {
             if ([COLOR=Red]((High[0] - Open[0])/TickSize) [/COLOR]== 5)
                  EnterShort();
             else if ([COLOR=Red]((Open[0] - Low[0])/TickSize)[/COLOR] == 5)
                  EnterLong();
        }
        We probably need to cast that double on the left-hand side of the equation, to an int?

        Comment


          #5
          Originally posted by koganam View Post
          We probably need to cast that double on the left-hand side of the equation, to an int?
          thank you for help, just how i can make range chart = 5, it seems like matlab i love it. thanks

          Comment


            #6
            Originally posted by koganam View Post
            We probably need to cast that double on the left-hand side of the equation, to an int?
            I'm cool. Like a yeti... eating frozen spaghetti.

            【ツ】

            Hang on, my music is playing way too loud!

            ♫♪.ılılıll|̲̅̅●̲̅̅|̲̅̅=̲̅̅|̲̅̅●̲̅̅|llılılı.♫♪

            Wait, gotta check my charts ...

            ▇ ▅ █ ▅ ▇ ▂ ▃ ▁ ▁ ▅ ▃ ▅ ▅ ▄ ▅ ▇

            Comment


              #7
              Hello gabsi,

              With a chart open, you can type "5R" (without quotes) to make it into a 5 Range chart.

              Alternatively, right-click the chart, select Data Series, and set Period's Type to Range and Value to 5.
              Zachary G.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by junkone, 04-21-2024, 07:17 AM
              10 responses
              148 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by tsantospinto, 04-12-2024, 07:04 PM
              6 responses
              99 views
              0 likes
              Last Post tsantospinto  
              Started by rocketman7, Today, 02:12 AM
              5 responses
              26 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by ZenCortexReal, Today, 08:54 AM
              0 responses
              1 view
              0 likes
              Last Post ZenCortexReal  
              Started by ZenCortexReal, Today, 08:52 AM
              0 responses
              0 views
              0 likes
              Last Post ZenCortexReal  
              Working...
              X