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

Help with a order

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

    #16
    Hi firecan,

    Print() will print to the output window. (Tools -> Output Window...)

    If you want to draw text below the bar, use DrawText().

    For example:

    DrawText("myText"+CurrentBar, (EMA(5)[0]-EMA(5)[1]).ToString(), 0, Low[0]-3*TickSize, Color.Blue) ;

    http://www.ninjatrader.com/support/h...7/drawtext.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #17
      Print

      Thanks again.

      But print 18 digits. 0,00235189521452356

      What can I do to only print 0,002

      Regards.

      Comment


        #18
        Hi firecan,

        To format a number of decimal places, use the double.ToString() method with a fixed point format specifier.

        myDouble.ToString("F2")

        http://msdn.microsoft.com/en-us/libr...v=vs.110).aspx
        Chelsea B.NinjaTrader Customer Service

        Comment


          #19
          Originally posted by firecan View Post
          Thanks again.

          But print 18 digits. 0,00235189521452356

          What can I do to only print 0,002

          Regards.
          Math.Round()?

          ref: http://msdn.microsoft.com/en-us/libr...(v=vs.90).aspx

          Comment


            #20
            Thanks again.

            ("F4") or ("0.000")

            Regards.

            Comment


              #21
              Profit 3

              Hello.
              I cannot introduce this change
              All is ok, but when i introduce Target2 and Target3 they are ingnored.

              I try to enter with 3 contracts.
              The first one with profit to 8 ticks.
              The second one with profit to 16 ticks.
              The third runs with the trailstop.

              Can help me.

              Regards.

              ----------------------------------------------------------------------------------

              #region Variables
              private int myInput0 = 3; //Total contrats
              #endregion
              protected override void Initialize()
              {
              SetProfitTarget("", CalculationMode.Ticks, 8);
              // SetProfitTarget("2", CalculationMode.Ticks, 16);
              // SetProfitTarget("3", CalculationMode.Ticks, 20);

              SetTrailStop("", CalculationMode.Ticks, 20, false);

              CalculateOnBarClose = true;
              }

              protected override void OnBarUpdate()
              {
              // Condition set 1
              if (Close[0] > Close[1])
              {
              EnterLong(MyInput0, "ole");
              }
              Last edited by firecan; 10-31-2014, 02:39 PM.

              Comment


                #22
                Hello,

                Are you using the fromSignalName that is the matching signalName used by the entry?

                For example:

                EnterLong(1, "longEntry1");
                SetStopLoss("longEntry1", CalculationMode.Ticks, 20, false)
                SetStopLoss(string fromEntrySignal, CalculationMode mode, double value, bool simulated)
                http://www.ninjatrader.com/support/h...etstoploss.htm

                Also, what is the Entries per direction set to in the strategy parameters?
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #23
                  I do not know the answer at your questions.
                  Only I have this code.
                  I am beginning.
                  can you send me any example.
                  Regards.

                  Comment


                    #24
                    Hello firecan,

                    Thank you for your response.

                    You need to set EntriesPerDirection to 3 and EntryHandling to AllEntries: http://www.ninjatrader.com/support/h...ryhandling.htm

                    Then give unique entrySignalNames and use them for fromEntrySignalName in the SetProfitTarget and SetTrailStop methods:
                    Code:
                    protected override void Initialize()
                    {
                        EntriesPerDirection = 3;
                        EntryHandling = EntryHandling.AllEntries;
                    SetProfitTarget("ole1", CalculationMode.Ticks, 8);
                    SetProfitTarget("ole2", CalculationMode.Ticks, 16);
                    SetProfitTarget("ole3", CalculationMode.Ticks, 20);
                    SetTrailStop("ole3", CalculationMode.Ticks, 20, false);
                    
                    CalculateOnBarClose = true;
                    }
                    
                    protected override void OnBarUpdate()
                    {
                    // Condition set 1
                    if (Close[0] > Close[1])
                    {
                    EnterLong(MyInput0, "ole1");
                    EnterLong(MyInput0, "ole2");
                    EnterLong(MyInput0, "ole3");
                    }

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by DJ888, 04-16-2024, 06:09 PM
                    6 responses
                    18 views
                    0 likes
                    Last Post DJ888
                    by DJ888
                     
                    Started by Jon17, Today, 04:33 PM
                    0 responses
                    1 view
                    0 likes
                    Last Post Jon17
                    by Jon17
                     
                    Started by Javierw.ok, Today, 04:12 PM
                    0 responses
                    6 views
                    0 likes
                    Last Post Javierw.ok  
                    Started by timmbbo, Today, 08:59 AM
                    2 responses
                    10 views
                    0 likes
                    Last Post bltdavid  
                    Started by alifarahani, Today, 09:40 AM
                    6 responses
                    41 views
                    0 likes
                    Last Post alifarahani  
                    Working...
                    X