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 pmachiraju, 11-01-2023, 04:46 AM
    8 responses
    148 views
    0 likes
    Last Post rehmans
    by rehmans
     
    Started by mattbsea, Today, 05:44 PM
    0 responses
    5 views
    0 likes
    Last Post mattbsea  
    Started by RideMe, 04-07-2024, 04:54 PM
    6 responses
    33 views
    0 likes
    Last Post RideMe
    by RideMe
     
    Started by tkaboris, Today, 05:13 PM
    0 responses
    5 views
    0 likes
    Last Post tkaboris  
    Started by GussJ, 03-04-2020, 03:11 PM
    16 responses
    3,283 views
    0 likes
    Last Post Leafcutter  
    Working...
    X