Announcement

Collapse
No announcement yet.

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, 07: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
              DierkNinjaTrader Customer Service

              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 soon123, Today, 12:51 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post soon123
                  by soon123
                   
                  Started by Jema1, Today, 12:23 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post Jema1
                  by Jema1
                   
                  Started by soon123, Yesterday, 11:14 PM
                  0 responses
                  1 view
                  0 likes
                  Last Post soon123
                  by soon123
                   
                  Started by smcllr, Yesterday, 04:15 PM
                  1 response
                  10 views
                  0 likes
                  Last Post NinjaTrader_ShawnB  
                  Started by rtwave, Yesterday, 02:33 PM
                  1 response
                  12 views
                  0 likes
                  Last Post NinjaTrader_Kate  
                  Working...
                  X