Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop lost and profit target statement will not execute

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

    Stop lost and profit target statement will not execute

    I am a Ninjascript nubie. Will some tell me why this will not work??

    if (Position.MarketPosition != MarketPosition.Long && Slope == 1)
    {
    EnterLong();
    //execute
    BgtAt = GetCurrentAsk();
    BgtSoldAt = BgtAt;
    ProfitTarget = BgtAt + (tprofit * TickSize);
    //tprofit = 10
    StopLost = BgtAt - (slost * TickSize);//slost = 20
    ExitLongStopLimit(BgtAt,StopLost);//will not execute
    ExitLongLimit(ProfitTarget);//will not execute
    tTradeCount = tTradeCount + 1;
    tTickCount =
    0;
    }
    I get no error message

    #2
    Hello Buttermilk,

    Thank you for your note.

    You will want to run Trace Orders in your script to see why these orders are not getting submitted.

    In your initialize() add TraceOrders = true;

    This will print out to the OutputWindow which can be found by going to Tools -> Output Window

    What may be occurring is that the Long position hasn't happened after the EnterLong() is placed thus the ExitLong's are not seeing the long position and getting ignored.
    Cal H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by rhyminkevin, Today, 04:58 PM
    3 responses
    48 views
    0 likes
    Last Post Anfedport  
    Started by iceman2018, Today, 05:07 PM
    0 responses
    5 views
    0 likes
    Last Post iceman2018  
    Started by lightsun47, Today, 03:51 PM
    0 responses
    7 views
    0 likes
    Last Post lightsun47  
    Started by 00nevest, Today, 02:27 PM
    1 response
    14 views
    0 likes
    Last Post 00nevest  
    Started by futtrader, 04-21-2024, 01:50 AM
    4 responses
    50 views
    0 likes
    Last Post futtrader  
    Working...
    X