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 Brevo, Today, 01:45 AM
    0 responses
    6 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by aussugardefender, Today, 01:07 AM
    0 responses
    3 views
    0 likes
    Last Post aussugardefender  
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    241 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    384 views
    1 like
    Last Post Gavini
    by Gavini
     
    Started by oviejo, Today, 12:28 AM
    0 responses
    6 views
    0 likes
    Last Post oviejo
    by oviejo
     
    Working...
    X