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 andrewtrades, Today, 04:57 PM
                  1 response
                  9 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by chbruno, Today, 04:10 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post chbruno
                  by chbruno
                   
                  Started by josh18955, 03-25-2023, 11:16 AM
                  6 responses
                  436 views
                  0 likes
                  Last Post Delerium  
                  Started by FAQtrader, Today, 03:35 PM
                  0 responses
                  8 views
                  0 likes
                  Last Post FAQtrader  
                  Started by rocketman7, Today, 09:41 AM
                  5 responses
                  19 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Working...
                  X