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 Vietanhnguyen2hotmailcom, Yesterday, 10:29 AM
    4 responses
    23 views
    0 likes
    Last Post Vietanhnguyen2hotmailcom  
    Started by PhillT, 04-19-2024, 02:16 PM
    4 responses
    35 views
    0 likes
    Last Post PhillT
    by PhillT
     
    Started by ageeholdings, 05-01-2024, 05:22 AM
    5 responses
    37 views
    0 likes
    Last Post ageeholdings  
    Started by reynoldsn, Today, 02:34 PM
    0 responses
    13 views
    0 likes
    Last Post reynoldsn  
    Started by nightstalker, Today, 02:05 PM
    0 responses
    21 views
    0 likes
    Last Post nightstalker  
    Working...
    X