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

Question on stop orders

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

    Question on stop orders

    Hello everyone,
    I coded a nt 6 strategy, now I'm porting to 6.5 (last beta) but I'm experiencing something I do not understand, the piece of code below was perfectly working, I had a look to help files but i didn't find useful informations.
    Specifically, as you can see below, the strategy executes only the first order in the row (in this case EnterLongStop), no short trades are taken (while levels are perfectly printed). If I comment EnterLongStop the system enters only short trades....
    Any suggestions?
    Code:
    if (Position.MarketPosition == MarketPosition.Flat)
    					{
    						ExitOrderStatus = ExitStatus.Nothing;
    						try
    						{
    							// Definizione ingressi
    							if (Time[0].TimeOfDay.CompareTo(OperationTimeStop.TimeOfDay)<0 && (Close[0]<=ChannelHigh && Close[0] >= ChannelLow))
    							{
    								EnterLongStop(NContracts,ChannelHigh+TickSize*Sfond,"l");
    								EnterShortStop(NContracts,ChannelLow-TickSize*Sfond,"s");
    								#if DEBUG
    									Print(Time[0].ToString()+"-Enter Long["+(ChannelHigh+TickSize*Sfond).ToString()+"]- Enter Short ["+(ChannelLow-TickSize*Sfond).ToString()+")");
    								#endif
    							}
    						}	
    						catch (Exception ex)
    						{
    							Print("Gestione ingressi - Errore"+ex.StackTrace.ToString());
    						}
    Thanks

    Marce

    #2
    Look in the Help Guide section -->

    NinjaScript > NinjaScript Language Reference > Custom Strategy Methods and Properties > Order Methods > Overview

    Look at the bottom for the section "Internal Order Handling Rules that Reduce Unwanted Positions"
    RayNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by funk10101, Yesterday, 09:43 PM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by TheWhiteDragon, 01-21-2019, 12:44 PM
    5 responses
    551 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by rtwave, 04-12-2024, 09:30 AM
    5 responses
    37 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by funk10101, Today, 12:02 AM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by GLFX005, Today, 03:23 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Erick  
    Working...
    X