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

HELP on Coding Stops&Limits w/ the STRATEGY WIZARD

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

    HELP on Coding Stops&Limits w/ the STRATEGY WIZARD

    Hi EVERYONE,
    I'm new to this forum, I'm tryng to code my strategy so I can backtest it but I need some good soul to help me on how to code it with the wizard strategy builder to automate it:
    I have built two conditions to trigger an action both for the Long and Short side. I need some advice on how to set up stops and limits, in 3 different ways/scenarios:

    Scenario n 1:
    -close the position once the entry candle closes.
    -set the stop loss 2 pips above/below the high/low of the entry candle

    Scenario n 2:
    -close the position once the entry candle closes
    -set the stop loss 2 pips above/below the high/low of the entry candle
    -set a profit take stop at 20 pips (meaning the position will be closed once in profit for 20 pips, thus not waiting for the close of the candle)

    Scenario n 3:
    -set the stop loss 2 pips above/below the high/low of the entry candle
    -set a profit take stop at 20 pips (meaning the position will be closed once in profit for 20 pips, thus not waiting for the close of the candle)
    -close the position at the close of the entry candle ONLY IF in profit for at least 10 pips, IF NOT leave the position open with the same stop and limit

    ***I wanna use this strategy with the 2 hours candles and 4 hours***

    Thanks very much to anyone who could help me in any way.

    Doctor D

    #2
    Doctor D,

    You may need to reevaluate your scenarios. You say you want to close a position when the bar closes and then place stop/targets. If the position is already closed you can't place any stops/targets.

    To place stop/targets please use the Stops & Targets page in the Wizard.

    For all of your bar close ideas, you need to remember everything is already handled at the end of the bar with CalculateOnBarClose = true. Then you will also have the Misc section in the Condition Builder that lets you use "Bars since entry" as well as "Bars since exit".

    Hopefully that gives you a starting point.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I mean...

      Thanks for your reply,

      what i mean in those 3 scenarios is this:
      first ONCE THE TRADE IS OPEN/ENTERED according to my entry conditions, set the stop and profit targets.
      THEN if the profit target is not reached at the close of the candle, close the position.
      of course u woulnt want to close a position and then enter a stop/profit, makes no sense. I meant close it at the close of the candle, very simple.close candle=profit target in SCENARIO 1.

      For the other scenarios, if I want to set a profit limit (stop limit is the same?) at 20 pips, on the wizards it gives me on the PARAMETERS : *mode (price, ticks, percent)but not pips option
      *value : should I put 20? but those are pips, so which should i use on the *mode?

      Also, maybe I didnt understand the wizard, but is there a way on the "stops and targets "window to set the stops like I said:
      *set the stop loss 2 pips above/below the high/low of the entry candle*

      I hope I'm not too confusing.
      thanks

      Doctor D.

      Comment


        #4
        Doctor D,

        Your intrabar entry/exits may only be feasible in real-time. From a backtest because you only have one evaluation point per bar you may not be able to achieve what you want.

        All you need to do for place stop/targets at entry is to use the Stops & Targets page. If you want to exit right when the bar closes you can only really submit this at the next bar with "Bars since entry" condition and the use of CalculateOnBarClose = false in realtime.

        For 20 pips you want to use the ticks mode. It is mostly just terminology.

        If you are trying to do something off of the OHLC you will instead want to select Price. Then you can press the "..." button and choose the high/low. Then you will want to use the Offset properties to adjust those to a value you want.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Waxavi, Today, 02:10 AM
        0 responses
        2 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Started by TradeForge, Today, 02:09 AM
        0 responses
        4 views
        0 likes
        Last Post TradeForge  
        Started by Waxavi, Today, 02:00 AM
        0 responses
        2 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Started by elirion, Today, 01:36 AM
        0 responses
        4 views
        0 likes
        Last Post elirion
        by elirion
         
        Started by gentlebenthebear, Today, 01:30 AM
        0 responses
        4 views
        0 likes
        Last Post gentlebenthebear  
        Working...
        X