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

Moving Stop Loss and Enter Reverse

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

    Moving Stop Loss and Enter Reverse

    I am trying to get a strategy to work that involves the following:

    ParabolicSAR on a 14 minute time frame. (BarsArray[0])

    Another PSAR on a Daily time frame. (BarsArray[1])

    On the 15M time frame, on each bar update I move my stop loss and an enter a reverse equal to the daily PSAR as follows:

    if (Position.MarketPosition == MarketPosition.Long)
    {
    SetStopLoss(CalculationMode.Price, ParabolicSAR(BarsArray[1],0.02,0.02,0.2)[0]);
    EnterShortStop(DefaultQuantity, ParabolicSAR(BarsArray[1],0.02,0.02,0.2)[0]);
    }

    The problem I encounter is when the PSAR switches between long/short and the PSAR value ends up opposite than my logic intends - resulting in a the placement of a stoploss and then shortstop above my current price. (or visversa for shorts).

    Can you suggest how I can move the stoploss and short/longstop based on the daily PSAR while running in 15M?

    #2
    I suspect you are running into some internal order handling violations when attempting to submit a stop loss and enter short stop. You can't have both. Please check out the Help Guide NinjaScript section that discusses Orders. In the overview section the rules are clearly defined. Your issues probably start there. I would post a link for you but we do not have 6.5 DOC online yet.
    RayNinjaTrader Customer Service

    Comment


      #3
      Ray,

      Thanks. I have read the Orders page but... well, let's just say it's a good thing I have a day job! Anyway, I will study it some more and see if I can learn something this time. I did "solve" the problem by removing the EnterLong/ShortStop()'s, but it also caused about a 15% drop in pips.

      Thanks again.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Radano, 06-10-2021, 01:40 AM
      20 responses
      615 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by Mizzouman1, Today, 07:35 AM
      0 responses
      4 views
      0 likes
      Last Post Mizzouman1  
      Started by i019945nj, 12-14-2023, 06:41 AM
      6 responses
      66 views
      0 likes
      Last Post i019945nj  
      Started by aa731, Today, 02:54 AM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by BarzTrading, Today, 07:25 AM
      0 responses
      3 views
      0 likes
      Last Post BarzTrading  
      Working...
      X