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

code script question

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

    code script question

    Would anyone know how these 2 short phrases would be coded in C# script language:

    If strategy is not long already.

    If strategy is not short already.



    Thanx MUCH..........Steve

    #2
    if (Position.MarketPosition != MarketPosition.Long)
    // Do something

    if (Position.MarketPosition != MarketPosition.Short)
    // Do something

    See here for further reference - http://www.ninjatrader-support.com/H...tPosition.html
    RayNinjaTrader Customer Service

    Comment


      #3
      NT RAY,

      So this code is saying that if the high of present bar is greater than the high of 1 bar ago and if I am "not" in a long position already, than enter long.


      // STOP AND REVERSE STRATEGY
      protected override void OnBarUpdate()
      {
      if (High[0] > High[1] && Position.MarketPosition != MarketPosition.Long)


      EnterLong();

      else if (Low[0] < Low[1] && Position.MarketPosition != MarketPosition.Short)


      EnterShort();
      Last edited by abikambic; 06-02-2007, 08:50 AM.

      Comment


        #4
        Yes this is correct.
        RayNinjaTrader Customer Service

        Comment


          #5
          NT RAY,
          Thank you SO MUCH!!
          Steve

          Comment


            #6
            Getting a indicator written in c into indicator file

            How does one go about get a indicator file written in c to become a indicator in Ninja?

            Comment


              #7
              You would need to recode yourself of contact one of the NinjaScript consultants: http://www.ninjatrader.com/webnew/pa...injaScript.htm

              Comment


                #8
                Indicator

                The indicator has already been code for Ninja, just need to know how to get it into the program.

                Comment


                  #9
                  If you have a .cs file...

                  Save the file in My Documents\NinjaTrader 6\bin\Custom\Indicator
                  In the Control Center select Tools > Edit NinjaScript > Indicator and select this indicator
                  The NinjaScript Editor will open, press "F5" to compile it.
                  You now can use the indicator on a chart.
                  RayNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by rtwave, 04-12-2024, 09:30 AM
                  2 responses
                  20 views
                  0 likes
                  Last Post rtwave
                  by rtwave
                   
                  Started by tsantospinto, 04-12-2024, 07:04 PM
                  5 responses
                  68 views
                  0 likes
                  Last Post tsantospinto  
                  Started by cre8able, Today, 03:20 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post cre8able  
                  Started by Fran888, 02-16-2024, 10:48 AM
                  3 responses
                  49 views
                  0 likes
                  Last Post Sam2515
                  by Sam2515
                   
                  Started by martin70, 03-24-2023, 04:58 AM
                  15 responses
                  115 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Working...
                  X