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

Stoploss based on ParabolicSAR

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

    Stoploss based on ParabolicSAR

    Hey there,

    I'm wondering and trying to code a strategy that uses the ParabolicSAR as a stop loss signal. I am having a difficult time in the strategy builder to capture the price value of the first bar in the ParabolicSAR indicator, and using it as my stop loss.

    Take the case that I am shorting a security that is under the bearish ParabolicSAR indicator, and I want to set a 1:1 risk for stop loss / profit target.
    I am trying to capture the price level of the first bar of the ParabolicSAR that came directly before my entry. If the close of the current bar ever passes that price, it closes the position, else it closes the position at the profit target of 1:1 from that stop loss level and entry level.

    Currently when backtesting, I am only able to get one level for that price, and it is the last instance of the ParabolicSAR on the chart (EOD).

    See attached screenshot.

    CASE 1: reaches the stop loss level and closes the position.

    CASE 2: reaches the 1:1 risk level from stop level and closes the position for a profit.

    Any help would be much appreciated.

    #2
    Hello GarDog,

    Thanks for your post.

    Can you post screenshots of the strategy builder sets of how you are trying to accomplish this?

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_PaulH View Post
      Hello GarDog,

      Thanks for your post.

      Can you post screenshots of the strategy builder sets of how you are trying to accomplish this?
      Hey Paul

      Thanks for your quick response.

      Here are two screenshots.

      In the conditions and actions tab, I am taking a short position if the Close crosses below the ParabolicSAR (thus initiating the downtrend signal by PSAR). At the same moment, I am setting my custom variable StopLoss to the value of the ParabolicSAR from 0 bars ago (which is type: double).

      In the Stops and Targets tab, I am setting the SetStopLoss function to my StopLoss variable which should be the $ value the ParabolicSAR was at the time of entry. Click image for larger version

Name:	Stops_and_Targets.png
Views:	312
Size:	17.6 KB
ID:	1160766Click image for larger version

Name:	Conditions_and_Actions.png
Views:	312
Size:	40.0 KB
ID:	1160767

      Comment


        #4
        Hello Gardog,

        Thanks for your reply.

        The SetStopLoss cannot be used in such a manner. It has to be set to a fixed value that would be the same on every order. It cannot be used in a "dynamic" manner such as you are doing. This is a limitation of the Strategy Builder. It is possible to do what you wish however you would need to unlock the strategy and work directly in the code through the Ninjascript Editor.

        If you do not wish to work directly in the code I would suggest using the ParabolicStop also in the Strategy builder but you will have to set a specific value for the initial stop value. The stop is then moved in the same manner as the parabolic stop indicator. You can set the mode to be currency, ticks, or Percent.


        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        37 views
        0 likes
        Last Post love2code2trade  
        Started by alifarahani, Today, 09:40 AM
        2 responses
        13 views
        0 likes
        Last Post alifarahani  
        Started by junkone, Today, 11:37 AM
        3 responses
        16 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by pickmyonlineclass, Today, 12:23 PM
        0 responses
        3 views
        0 likes
        Last Post pickmyonlineclass  
        Started by frankthearm, Yesterday, 09:08 AM
        12 responses
        44 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Working...
        X