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

  • NinjaTrader_PaulH
    replied
    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.

    Leave a comment:


  • 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

Latest Posts

Collapse

Topics Statistics Last Post
Started by ageeholdings, Today, 07:43 AM
0 responses
7 views
0 likes
Last Post ageeholdings  
Started by pibrew, Today, 06:37 AM
0 responses
4 views
0 likes
Last Post pibrew
by pibrew
 
Started by rbeckmann05, Yesterday, 06:48 PM
1 response
14 views
0 likes
Last Post bltdavid  
Started by llanqui, Today, 03:53 AM
0 responses
6 views
0 likes
Last Post llanqui
by llanqui
 
Started by burtoninlondon, Today, 12:38 AM
0 responses
12 views
0 likes
Last Post burtoninlondon  
Working...
X