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 KenneGaray, Today, 03:48 AM
      0 responses
      3 views
      0 likes
      Last Post KenneGaray  
      Started by thanajo, 05-04-2021, 02:11 AM
      4 responses
      470 views
      0 likes
      Last Post tradingnasdaqprueba  
      Started by aa731, Today, 02:54 AM
      0 responses
      4 views
      0 likes
      Last Post aa731
      by aa731
       
      Started by Christopher_R, Today, 12:29 AM
      0 responses
      10 views
      0 likes
      Last Post Christopher_R  
      Started by sidlercom80, 10-28-2023, 08:49 AM
      166 responses
      2,237 views
      0 likes
      Last Post sidlercom80  
      Working...
      X