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

EnterLong Doubt...??

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

    EnterLong Doubt...??

    i have to Enter long for every 50 price down ... but how to enter another long with out closing the previous long ...

    #2
    Hi Deall, it would depend on your EntryHandling settings used, you can definitely scale into a position - http://www.ninjatrader.com/support/f...ead.php?t=3751

    BertrandNinjaTrader Customer Service

    Comment


      #3
      hi

      i want to print the LongPrice for every Long entered is that possible PositionAvgPrice giving the average price .. but i need the individual long price separately

      Comment


        #4
        If you need the individual execution prices of your orders making up the position I would suggest checking into the IOrder objects offered for more advanced programmers - http://www.ninjatrader.com/support/h...ightsub=IOrder
        BertrandNinjaTrader Customer Service

        Comment


          #5
          hi can u give syntax for that or any sample code to get value of the Longprice using IOrdrers

          Comment


            #6
            Would unfortunately not have a specific example for your case here handy, but generally for working with the IOrders and the advanced order management approach I consider this here to be ideal - http://www.ninjatrader.com/support/f...ead.php?t=7499
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Originally posted by DealI View Post
              hi can u give syntax for that or any sample code to get value of the Longprice using IOrdrers
              The IOrder syntax in the NT Help documents all the supported properties. In this case, you are looking for the AvgFillPrice property. Access it with standard OOP syntax.
              Last edited by koganam; 05-30-2013, 01:50 AM. Reason: Corrected spelling.

              Comment


                #8
                thanks for ur reply koganam

                but how to define wit standard OOPs can pls tell in detail . i tried but it showing error

                Comment


                  #9
                  Originally posted by DealI View Post
                  thanks for ur reply koganam

                  but how to define wit standard OOPs can pls tell in detail . i tried but it showing error
                  What did you write, and what is the error message?

                  Comment


                    #10
                    hi i have one doubt
                    #region Variables
                    private IOrder entryOrder = null;

                    protected override void OnBarUpdate()
                    {
                    .....
                    ...
                    ....

                    if( entryOrder == null && c <= b)

                    {
                    entryOrder = EnterLong();

                    Print("a=" + entryOrder.AvgFillPrice);

                    }

                    everything flows correctly and executes but

                    for a= entryOrder.AvgFillPrice as i mention in print commd .. its not printing the value just printing 0 y its not printing the price value

                    Comment


                      #11
                      Originally posted by DealI View Post
                      hi i have one doubt
                      #region Variables
                      private IOrder entryOrder = null;

                      protected override void OnBarUpdate()
                      {
                      .....
                      ...
                      ....

                      if( entryOrder == null && c <= b)

                      {
                      entryOrder = EnterLong();

                      Print("a=" + entryOrder.AvgFillPrice);

                      }

                      everything flows correctly and executes but

                      for a= entryOrder.AvgFillPrice as i mention in print commd .. its not printing the value just printing 0 y its not printing the price value
                      At the time that the Print statement is executed, immediately after the entry, the order is unlikely to have been filled, so the AvgFillPrice would be zero.

                      You probably want to check this when you have a position, so check for that first.

                      Code:
                      if (Position.MarketPosition != MarketPosition.Flat)
                      {
                      //do stuff here;
                      }
                      As an aside, it is not a program error if you do not get what you expect. As you can see, there was no error message here.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by WHICKED, Today, 12:56 PM
                      1 response
                      8 views
                      0 likes
                      Last Post NinjaTrader_Gaby  
                      Started by cre8able, Today, 01:16 PM
                      0 responses
                      2 views
                      0 likes
                      Last Post cre8able  
                      Started by chbruno, 04-24-2024, 04:10 PM
                      2 responses
                      47 views
                      0 likes
                      Last Post chbruno
                      by chbruno
                       
                      Started by WHICKED, Today, 12:45 PM
                      1 response
                      11 views
                      0 likes
                      Last Post NinjaTrader_Gaby  
                      Started by samish18, Today, 01:01 PM
                      0 responses
                      6 views
                      0 likes
                      Last Post samish18  
                      Working...
                      X