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

FOREX Limit/STOP Orders

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

    FOREX Limit/STOP Orders

    Hey guys. I'm having a small problem in my strategy I have the code
    Code:
    	EnterLongStop(1, High[0] + (entryTrigDist * TickSize));
    This is supposed to enter Trade at the variable "entryTrigDist" above the High of current bar.

    Problem is that sometimes market moves too fast and Skips right through my entry, then I get the error. "...Buy Stop can't be placed below the market affected order."

    Now I understand why this is happening, because by the time market reaches my entry, Order is no longer valid.

    Is it possible to place some kind of LIMIT order, or perhaps use something else that will guarantee a FILL if price falls Back down to that Entry price (High + EntryTrigger)?

    at this point the Strategy just Cancels itself out. I would rather if it Doesn't fill, just wait for Price to come back Down then Fill it.

    #2
    Originally posted by ginx10k View Post
    Hey guys. I'm having a small problem in my strategy I have the code
    Code:
    	EnterLongStop(1, High[0] + (entryTrigDist * TickSize));
    This is supposed to enter Trade at the variable "entryTrigDist" above the High of current bar.

    Problem is that sometimes market moves too fast and Skips right through my entry, then I get the error. "...Buy Stop can't be placed below the market affected order."

    Now I understand why this is happening, because by the time market reaches my entry, Order is no longer valid.

    Is it possible to place some kind of LIMIT order, or perhaps use something else that will guarantee a FILL if price falls Back down to that Entry price (High + EntryTrigger)?

    at this point the Strategy just Cancels itself out. I would rather if it Doesn't fill, just wait for Price to come back Down then Fill it.
    EnterLongStopLimit() ?

    ref: http://www.ninjatrader.com/support/h...gstoplimit.htm

    Comment


      #3
      Hello ginx10k,

      If you want to keep your strategy running even after an order gets rejected then you would want to set your "RealtimeErrorHandling" to "TakeNoAction" and then try to handle it yourself.

      You may see the link below for an example.



      This will allow you to try to handle your orders to place another order if it gets rejected if you want to place a limit order instead.

      Let me know if we can be of any further assistance.
      JCNinjaTrader Customer Service

      Comment


        #4
        I tried that already. it says, "Stop Limit orders on currencies are not supported affected Order".

        Even when you go to DOM and try to place a Limit Order above Current Offer or Below Current Bid, the way you would normally do on FUTURES, it gives same error.


        Can anyone give me a suggestion please. There has to be a way, if this can be done on MetaTrader and on FXCM Trading Station. how do I do it on Ninja?

        Comment


          #5
          Hey JC, I'll def try that. but any idea how to set it to NOT reject the order. Some kind of Limit or something. I already tried EnterLongStopLimit, and EnterLongStop and EnterLong. is there some Manipulation that can be done to code?

          Comment


            #6
            Originally posted by ginx10k View Post
            I tried that already. it says, "Stop Limit orders on currencies are not supported affected Order".

            Even when you go to DOM and try to place a Limit Order above Current Offer or Below Current Bid, the way you would normally do on FUTURES, it gives same error.


            Can anyone give me a suggestion please. There has to be a way, if this can be done on MetaTrader and on FXCM Trading Station. how do I do it on Ninja?
            If the exchange will not allow you to place an order type, then you have to write code to simulate the order.
            Code:
            if (Close[0] >= entryPrice) EnterLongLimit(...);
            You may need a filter to prevent multiple entries.

            The real question, however, seems to be: "Does the exchange allow you to even place LIMIT orders at all? Limit orders, on most exchanges are simply a matter of placing an order to be filled at the best possible price, meaning that if placed above the market it, essentially is treated like a market order, and if placed below the market, it sits and waits. I ask because your post says this: "Even when you go to DOM and try to place a Limit Order above Current Offer or Below Current Bid, the way you would normally do on FUTURES, it gives same error." (emphasis mine), which seems to imply that all LIMIT orders are being rejected. You may have to call your broker to clarify the matter.

            Comment


              #7
              Hello ginx10k,

              Yes, I would check with your Broker / Exchange supports those order types. Looking at the rejection code it appears that they do not support so no code manipulation would be able to accomplish what you are looking if that is the case.

              Let us know what you find.
              JCNinjaTrader Customer Service

              Comment


                #8
                I will call them. but it is FXCM. and they allow Limits on their platforms and MT4. so I wouldn't see why it wouldn't be allowed on Ninja.

                Comment


                  #9
                  Originally posted by ginx10k View Post
                  I will call them. but it is FXCM. and they allow Limits on their platforms and MT4. so I wouldn't see why it wouldn't be allowed on Ninja.
                  Are you by any chance trying to place GTC orders? I know that most, if not all. FOREX brokers reject GTC orders, period.

                  Comment


                    #10
                    I just checked what GTC orders are. I don't know if that's what I'm placing cause my code looks like this
                    Code:
                    EnterLongStop(scalpLotSize, High[0] + (entryTrigDist * TickSize), "target1");
                    I don't know if that can be changed or not. and I checked I can't place Limits above Current ASK or below BID. in FXCM.

                    so there has to be a way to make this take the order.

                    Comment


                      #11
                      Hello ginx10k,

                      NinjaTrader will by default submit orders as GTC. If you would like to change that to "Day" you may change the Time in Force (TIF) inside of the Initialize() method as shown below.



                      Note that in real-time you can check the current Ask price by using "GetCurrentAsk()" so that you can compare it to the value that you are trying to enter your entry order on to make sure that it is above it at the time of entry. Price volatility may still reject the order from time to time but this should not happen every-time.



                      Let me know if we can be of any further assistance.
                      JCNinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by ginx10k View Post
                        I just checked what GTC orders are. I don't know if that's what I'm placing cause my code looks like this
                        Code:
                        EnterLongStop(scalpLotSize, High[0] + (entryTrigDist * TickSize), "target1");
                        I don't know if that can be changed or not. and I checked I can't place Limits above Current ASK or below BID. in FXCM.

                        so there has to be a way to make this take the order.
                        Ah, so FXCM confirms that you cannot use Limit Orders at all, period then. Or is it that you can only submit them at an inside price?

                        Comment


                          #13
                          Originally posted by NinjaTrader_JC View Post
                          Hello ginx10k,

                          NinjaTrader will by default submit orders as GTC. If you would like to change that to "Day" you may change the Time in Force (TIF) inside of the Initialize() method as shown below.



                          Note that in real-time you can check the current Ask price by using "GetCurrentAsk()" so that you can compare it to the value that you are trying to enter your entry order on to make sure that it is above it at the time of entry. Price volatility may still reject the order from time to time but this should not happen every-time.



                          Let me know if we can be of any further assistance.

                          JC. I tried the code
                          Code:
                          EnterLongStopLimit(scalpLotSize, GetCurrentBid(), High[0] + (entryTrigDist * TickSize), "target1" );
                          and Getting that "Can't submit Limit orders above Price error".

                          Is there a way to use the GetCurrentBid() with this
                          Code:
                          EnterLongStop(scalpLotSize, High[0] + (entryTrigDist * TickSize), "target1");
                          I know that GetCurrentBid() is a double, but so is my Entry Target so how would I put these together?

                          Comment


                            #14
                            ginx10k,

                            You would replace your price value that you passing through the EnterLongStop() with GetCurrentBid() -

                            Code:
                            EnterLongStop(scalpLotSize, [B]GetCurrentBid()[/B] + (entryTrigDist * TickSize), "target1");
                            Cal H.NinjaTrader Customer Service

                            Comment


                              #15
                              Originally posted by koganam View Post
                              Ah, so FXCM confirms that you cannot use Limit Orders at all, period then. Or is it that you can only submit them at an inside price?
                              No, I'm actually calling Limit orders on FXCM at the current bid or ask and it's rejecting them every time:



                              If anyone has figured this out I would sure appreciate a pointer. Thanks in advance.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by junkone, Today, 11:37 AM
                              2 responses
                              12 views
                              0 likes
                              Last Post junkone
                              by junkone
                               
                              Started by frankthearm, Yesterday, 09:08 AM
                              12 responses
                              43 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by quantismo, 04-17-2024, 05:13 PM
                              5 responses
                              35 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by proptrade13, Today, 11:06 AM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by love2code2trade, 04-17-2024, 01:45 PM
                              4 responses
                              35 views
                              0 likes
                              Last Post love2code2trade  
                              Working...
                              X