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

Using ExitLongStopMarket

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

  • NinjaTrader_Jesse
    replied
    Hello Abdullah_KSA,

    If the order has not filled yet and you want to cancel it you would need to use Cancel Order. The exit methods are for exiting a position you currently hold.



    I look forward to being of further assistance.

    Leave a comment:


  • Abdullah_KSA
    replied
    Originally posted by trendisyourfriend View Post
    Is it possible that your condition has an error or it is just a typo?
    If (High[0] <= (EMA1[0] + (40 * TickSize)))

    EMA1[0] = EMA[10] ???

    Umm .. to be honest, I'm not the expert here .. I can barely do the basics
    Anyways, prior to using EMA1, I defined EMA1 by saying.. EMA1 = EMA(Close, 120);
    I cut it out earlier, not to make it so lengthy
    I found it in the help section, and it should work ok

    Leave a comment:


  • Abdullah_KSA
    replied
    Originally posted by NinjaTrader_Jesse View Post
    Hello Abdullah_KSA,

    Thank you for the post.

    I wanted to clarify here, the EnterLongStopMarket has filled and you are in a position. Now you want to wait for the condition you provided to become true and then ExitLongStopMarket. Have I understood that correct?

    I am not sure I see the question surrounding the ExitLongStopMarket, are you asking how to form the condition or were you seeing that the supplied code didn't work?

    I look forward to being of further assistance.

    When the EnterLongStopMarket is filled, it only places a pending order 10 ticks above the high price. So the order is not necessarily executed. It depends on how the price goes. If it goes up, then my placed order will be completely executed/filled. If it goes down, here's where I need the help. If it reaches the level I specified, I'd like to either cancel the order to exit it.

    I'm using the ExitLongStopMarket as a way to exit my unexecuted pending orders (if the price goes down). However, I'm not quite sure if my logic is correct since I'm using ExitLongStopMarket after the action of my initial IF statement. Is this correct? Should I include it inside the action part? The code compiles with no problems, but still doesn't cancel the pending orders when price goes down.. I hope now it is clear .. English is not my 1st language .. sorry

    Leave a comment:


  • trendisyourfriend
    replied
    Is it possible that your condition has an error or it is just a typo?
    If (High[0] <= (EMA1[0] + (40 * TickSize)))

    EMA1[0] = EMA[10] ???

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    Hello Abdullah_KSA,

    Thank you for the post.

    I wanted to clarify here, the EnterLongStopMarket has filled and you are in a position. Now you want to wait for the condition you provided to become true and then ExitLongStopMarket. Have I understood that correct?

    I am not sure I see the question surrounding the ExitLongStopMarket, are you asking how to form the condition or were you seeing that the supplied code didn't work?

    I look forward to being of further assistance.

    Leave a comment:


  • Abdullah_KSA
    started a topic Using ExitLongStopMarket

    Using ExitLongStopMarket

    Hi,

    In my strategy code, I use EnterLongStopMarket if my conditions are perfectly met. It works just fine placing the order and waiting for the price till it reaches it, then fills the order. However, sometimes the price goes down and doesn't reach to the level I hope for. So, in this case, I'd like to tell it that after you place the order and then the price goes down to a certain level, ExitLongStopMarket(). Here's the logic I'm using and it's not giving me any errors while compiling, but my orders are still not cancelled even the price goes down to the level where I'd to exit:

    If (my condition is met)
    {
    EnterLongStopMarket();
    }

    // the above part is done elegantly
    // now here's the part where I'm confused and where I'd tell it that after you place the order (as in above) and the price goes down to a certain
    // level, ExitLongStopMarket()

    If (High[0] <= (EMA1[0] + (40 * TickSize))) // that's the price level when is reached, I'd like to exit or cancel any pending orders
    {
    ExitLongStopMarket();
    }

    Appreciate your kind support

Latest Posts

Collapse

Topics Statistics Last Post
Started by maybeimnotrader, Yesterday, 05:46 PM
4 responses
23 views
0 likes
Last Post maybeimnotrader  
Started by frankthearm, Today, 09:08 AM
6 responses
24 views
0 likes
Last Post frankthearm  
Started by adeelshahzad, Today, 03:54 AM
5 responses
33 views
0 likes
Last Post NinjaTrader_BrandonH  
Started by stafe, 04-15-2024, 08:34 PM
7 responses
32 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by merzo, 06-25-2023, 02:19 AM
10 responses
823 views
1 like
Last Post NinjaTrader_ChristopherJ  
Working...
X