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

Get Current StopLoss Price ?

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

    Get Current StopLoss Price ?

    Hello,

    Is there a way to programmatically retrieve the current StopLoss Price?

    I have a section of code in my strategy where I update the stop loss based on various parameters, but I want to "skip over" this section of code depending on where the current stop is.

    Thank you.

    #2
    Hi montana,

    You will need to detect that the stop loss is being submitted in OnOrderUpdate and save the price of the order to a variable.

    For example:

    (*edited quick fix to protected override void)
    protected override void OnOrderUpdate(IOrder order)
    {
    if (order.Name == "Stop loss" && order.OrderState == OrderState.Accepted)
    myStopLossPrice == order.StopPrice;
    }
    Last edited by NinjaTrader_ChelseaB; 08-25-2014, 07:28 AM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the hint, this was also useful for me!

      But the sample above will give you a "virtual or abstract members cannot be private" error.
      => just use:
      protected override void OnOrderUpdate(IOrder order)
      {...}

      Comment


        #4
        Thanks for pointing that out, you are correct we will reflect in our post.
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by 1001111, Today, 01:35 AM
        0 responses
        5 views
        0 likes
        Last Post 1001111
        by 1001111
         
        Started by ETFVoyageur, Yesterday, 07:05 PM
        1 response
        16 views
        0 likes
        Last Post ETFVoyageur  
        Started by MarianApalaghiei, Today, 12:35 AM
        1 response
        8 views
        0 likes
        Last Post MarianApalaghiei  
        Started by Rogers101, 05-05-2024, 11:30 AM
        17 responses
        57 views
        0 likes
        Last Post Rogers101  
        Started by haas88, 03-21-2024, 02:22 AM
        13 responses
        176 views
        0 likes
        Last Post haas88
        by haas88
         
        Working...
        X