• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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");
                    }
                    Patrick H.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by RB104, Today, 06:06 PM
                    1 response
                    10 views
                    0 likes
                    Last Post NinjaTrader_ShawnB  
                    Started by jtrading82, 05-25-2018, 09:59 AM
                    9 responses
                    978 views
                    0 likes
                    Last Post NinjaTrader_ShawnB  
                    Started by syxforex, Today, 12:11 AM
                    2 responses
                    15 views
                    0 likes
                    Last Post syxforex  
                    Started by aslane, Today, 02:31 PM
                    1 response
                    10 views
                    0 likes
                    Last Post NinjaTrader_Kate  
                    Started by stoner, 10-16-2019, 01:38 PM
                    5 responses
                    53 views
                    0 likes
                    Last Post sledge
                    by sledge
                     
                    Working...
                    X