Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Conditional Profit/Loss Settings

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

    Conditional Profit/Loss Settings

    Ninjas,

    I apologize if this is already asked. I browsed through the forums but didn't see anything related to my questions.

    1. In the initialization section, can I set stop loss/profit scales based on conditions?

    Say, if long profit/loss 4/2. If short, profit/loss 6/2

    2. How do I implement a 'let ride' order. I'm sure it has other common terms. I just want to say if profit reaches 6, only close position if pull back 2, otherwise let it go as far as it can. But if it pulls back 2 again, close position.

    3. How do I save a value in a variable for later computation? I want to say at this moment, get the price, save it. At some point later, current price is less then saved price, then buy.

    I'm sure these are just simple to the expert ninjas. It's hard on an old brain like mine. Please give me yes/no and pseudo or better yet actual code.

    Thanks muchly...

    Chan

    #2
    ninjacao,

    1. To do this you want to distinguish between long and short simply by the fromEntrySignal name.

    SetStopLoss(string fromEntrySignal, CalculationMode mode, double value, bool simulated)


    So you want to give your long orders a certain name and then your shorts a separate name. Then you want to put in SetStopLoss() twice. One for each signal name and its associated stop value.


    2. You will need to custom code that logic. Unfortunately I cannot provide you code for how to do it. There is a reference sample here for how to modify stop loss/target orders. http://www.ninjatrader-support2.com/...ead.php?t=3222


    3. You just create yourself a variable and go Variable0 = Close[0]. Then access Variable0 in the future.
    Josh P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Adamcoin33, 04-14-2025, 08:08 AM
    4 responses
    50 views
    0 likes
    Last Post MiCe1999  
    Started by asd32, 07-25-2024, 11:11 AM
    6 responses
    188 views
    0 likes
    Last Post A_Green
    by A_Green
     
    Started by sledge, 04-13-2025, 01:53 PM
    4 responses
    44 views
    0 likes
    Last Post sledge
    by sledge
     
    Started by yeonsiewlan, Today, 06:17 PM
    0 responses
    3 views
    0 likes
    Last Post yeonsiewlan  
    Started by utilizator, 03-06-2018, 08:44 PM
    3 responses
    907 views
    0 likes
    Last Post MiCe1999  
    Working...
    X