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

OnExecution stopOrder

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

    OnExecution stopOrder

    If I previously had..
    SetStopLoss(CalculationMode.Percent, stoppercent);

    how do I fit this into the stopOrder below. Something like this maybe?...

    stopOrder = ExitLongStop(0, true, execution.Order.Filled, execution.Order.AvgFillPrice - execution.Order.AvgFillPrice * stoppercent, "", "");

    #2
    Hello zachj,

    Thank you for your post.

    It should be the following for the ExitLongStop():
    Code:
    stopOrder = ExitLongStop(0, true, execution.Order.Filled, ((execution.Order.AvgFillPrice) * (1 + stoppercent)), "", "");
    Please let me know if you have any questions.

    Comment


      #3
      Wait wouldn't it actually be just execution.Order.AvgFillPrice * stoppercent?

      If fill price is say $50 and stoppercent is .01 that would be a 50cent stop.

      If I did this... ((execution.Order.AvgFillPrice) * (1 + stoppercent)) that's 50*1+.01 = 50.5? Doesn't make sense or am I misinterpreting that.

      Comment


        #4
        Hello zachj,

        Thank you for your response.

        My mistake on that part, with the Long Stop the stoppercent would need to be a negative number.

        Code:
        So taking your example if would be the following:
        stopOrder = ExitLongStop(0, true, execution.Order.Filled, ((execution.Order.AvgFillPrice) * (1 + -0.01)), "", "");

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by knowmad, Today, 03:52 AM
        0 responses
        14 views
        0 likes
        Last Post knowmad
        by knowmad
         
        Started by tradingnasdaqprueba, Today, 03:42 AM
        0 responses
        11 views
        0 likes
        Last Post tradingnasdaqprueba  
        Started by Haiasi, 04-25-2024, 06:53 PM
        4 responses
        63 views
        0 likes
        Last Post effraenk  
        Started by ccbiasi, 11-23-2017, 06:06 AM
        5 responses
        2,207 views
        0 likes
        Last Post leodavis  
        Started by kujista, Yesterday, 12:39 AM
        2 responses
        14 views
        0 likes
        Last Post kujista
        by kujista
         
        Working...
        X