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

How to configure the SetProfitTarget and SetStopLoss on a specific entry

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

    How to configure the SetProfitTarget and SetStopLoss on a specific entry

    Hi,

    In my script, I integrate 3 different trades that are executed in different contexts.

    The 1st one :

    EnterLong();
    ExitLong();

    does not have any profit/loss exit

    The 2nd one :

    EnterShort( Convert.ToInt32( MW_QTY_in_use ), "MW" );
    SetStopLoss("MW", CalculationMode.Ticks, MW_SL_in_use/TickSize, false );
    SetProfitTarget("MW", CalculationMode.Ticks, MW_TP_in_use/TickSize );
    ExitShort( Convert.ToInt32( MW_QTY_in_use ), "", "" );

    The 3rd one :

    EnterLong(Convert.ToInt32( DefaultQuantity ),"ON");
    SetStopLoss("ON", CalculationMode.Ticks, ON_StopLoss/TickSize, false );
    SetProfitTarget("ON", CalculationMode.Ticks, ON_TakeProfit/TickSize );
    ExitLong( Convert.ToInt32( DefaultQuantity ),"ON", "" );

    The 1st one may overlap with the 2nd and/or 3rd and the profit/loss exits are applied to it.

    How can I configure the exits on a specific entry without any interference?

    Kind Regards,
    Last edited by Vincere; 03-26-2019, 02:05 AM. Reason: SetStopLoss, SetProfitTarget

    #2
    Hello Vincere,

    Thanks for your post.

    When you are in a long position and place a short entry it will close the long entry with a market order called "close position" and then place another order to enter in the direction you intend. The same would be true when short and you place a long entry. You can only control the exits (Profit target/stoploss), by signal name, when the entries are in the same direction.

    To accomplish your goals you would need to separate your strategy so that you do not have long closing short and vice-versa AND would need to use a separate account for each strategy so that you can maintain account position while placing trades on the same instrument.
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by sidlercom80, 10-28-2023, 08:49 AM
    172 responses
    2,278 views
    0 likes
    Last Post sidlercom80  
    Started by Irukandji, Yesterday, 02:53 AM
    2 responses
    17 views
    0 likes
    Last Post Irukandji  
    Started by adeelshahzad, Today, 03:54 AM
    0 responses
    3 views
    0 likes
    Last Post adeelshahzad  
    Started by CortexZenUSA, Today, 12:53 AM
    0 responses
    3 views
    0 likes
    Last Post CortexZenUSA  
    Started by CortexZenUSA, Today, 12:46 AM
    0 responses
    1 view
    0 likes
    Last Post CortexZenUSA  
    Working...
    X