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

EnterShort & EnterLong

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

    EnterShort & EnterLong

    Hey guys,

    Working on a strat, I'm being very particular about the amount bought at certain prices. I've tried EnterLongLimit order but it still isn't working as I expected.

    Lets say I want the strategy to enter long @ exactly 1.57, it might buy at 1.58 for example, what do I use to determine the actually price, because Close[0] is lower then that. Is it GetCurrentAsk() for long and GetCurrentBid() for short?

    Basically I need to adjust the amount purchased if its out, so like 1000 @ 1.57 and if the strategy slips it needs to buy 1333 @ 1.58 long.

    And shorts to, its very confusing how it does not buy on Close[0]....

    #2
    Originally posted by happypappy View Post
    Hey guys,

    Working on a strat, I'm being very particular about the amount bought at certain prices. I've tried EnterLongLimit order but it still isn't working as I expected.

    Lets say I want the strategy to enter long @ exactly 1.57, it might buy at 1.58 for example, what do I use to determine the actually price, because Close[0] is lower then that. Is it GetCurrentAsk() for long and GetCurrentBid() for short?

    Basically I need to adjust the amount purchased if its out, so like 1000 @ 1.57 and if the strategy slips it needs to buy 1333 @ 1.58 long.

    And shorts to, its very confusing how it does not buy on Close[0]....
    A Limit order should NEVER be filled at worse than the stated price. If it is, then you probably need to change your broker.

    I leave it to you whether you should also probably publish your statement which shows the errant trades, just as a warning to help other traders avoid such an atrociously incompetent broker.

    Comment


      #3
      happypappy, for which broker and market would that be? You see this in backtesting only correct? GetCurrentAsk / Bid would just be the close price in backtesting, so would only be valid in realtime as you had a streaming Level 1 data.

      You need to be mindful at what price you submit your order at, a limit above the current inside market for a buy would be marketable and the back-test will fill you, however the price will never be reported better but always you submitted at price in our conservative default fill type.
      BertrandNinjaTrader Customer Service

      Comment


        #4
        Thanks for the reply's, I'm really glad I asked, currently I'm running replay data.

        From experience trading EnterShortLimit() & EnterLongLimit() generally worked very well, but in this case "replay data" they don't seem to be working and it's frustrating when testing / getting this ready for the real world.

        if(GetCurrentAsk() < mytarget && GetCurrentAsk() > mytarget - (1 * TickSize))
        {
        ExitShort();
        Cleanup(opath,Instrument);
        }

        Here is some of mess I've started resorting to to test comfortably.......In anycase I worked out an algorithm to compensate using the quantity purchased if it slips per say. I was just wondering, I'll rewrite the code to EnterLongLimit() orders instead.

        Further to that change, is their an entry event I can tie to those references? I wrote a lot of controlling code based on timing of entries it would be nice to leave EnterLongLimit() active and when it fills execute the cleanup for example.

        Thanks for replies.

        Comment


          #5
          I've answered my own question so so glad I asked,

          Originally posted by happypappy View Post
          I'll rewrite the code to EnterLongLimit() orders instead.

          Further to that change, is their an entry event I can tie to those references? I wrote a lot of controlling code based on timing of entries it would be nice to leave EnterLongLimit() active and when it fills execute the cleanup for example.

          Thanks for replies.


          This has made this much neater and simpler :P Appreciate the help guys.....

          Comment


            #6
            EnterLongLimit GetCurrentBid

            When using EnterLongLimit GetCurrentBid to set the limit level.... what happens to that order if the market has moved lower by the time my order hits the exchange?

            Regards to all and thx

            Comment


              #7
              Hello,

              This would likely be rejected if the limit order was received at an invalid price or above the market. The brokerage would send back a Reject and it would likely stop the strategy to prevent any other erroneous orders.

              I look forward to being of further assistance.
              JesseNinjaTrader Customer Service

              Comment


                #8
                Originally posted by everington_f View Post
                When using EnterLongLimit GetCurrentBid to set the limit level.... what happens to that order if the market has moved lower by the time my order hits the exchange?

                Regards to all and thx
                A Limit long order above the market will be filled immediately, usually at the Ask, as any price below the Limit price means a better entry, and Limit Orders are to be filled at the stated price or better.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by TraderIqbal, 10-20-2023, 10:12 AM
                2 responses
                118 views
                0 likes
                Last Post Funnywo
                by Funnywo
                 
                Started by Creamers, 04-27-2024, 05:32 AM
                12 responses
                72 views
                0 likes
                Last Post Creamers  
                Started by fredericlebre, Today, 01:19 AM
                0 responses
                7 views
                0 likes
                Last Post fredericlebre  
                Started by TraderJA, Today, 12:06 AM
                0 responses
                10 views
                0 likes
                Last Post TraderJA  
                Started by SnailHorn, Yesterday, 10:49 PM
                0 responses
                9 views
                0 likes
                Last Post SnailHorn  
                Working...
                X