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

Strategy help needed

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

    Strategy help needed

    I have built a simple strategy using the wizard and twicked a little bit.
    I need now further help


    This is the part of the script I need help with:

    // Condition set 3 Uptrend with Bracket
    if (GetCurrentAsk() < (Open[0] - S1*TickSize)
    && Open[1] < Close[1]
    && Position.Quantity == 0
    && Bracket == true)

    {
    EnterLongStop(Q, Open[0], "TSTZ Long");
    EnterShortStop(Q, Open[0] - S2 * TickSize, "TSTZ Reversal Short");
    // TSTZ Reversal Short not working
    // TSTZ Reversal Shortneeds to last till the next candle is already opened and ticking
    }


    My Questions:
    1) I would like the EnterShortStop to be an OCO order linked to the EnterLongStop. How can I change the instruction.
    2) Since I am using renko charts I know the EnterShortStop is going to triger on the next candle down. Therefore I would like this side of the order to be good till cancel. Can you suggest a change?
    3) The EnterShortStop order is not working. Please note that I am trtying to place 2 orders at the same time, and the strategy includes a Stop loss routine. Is my syntax incorrect?
    4) Sometimes "if (GetCurrentAsk() < (Open[0] - S1*TickSize)" doesn't really place the order. Will a Crossbellow() statement work better? I tried writing one, but got issues combining series and int variables. Can you suggest an expression?


    Thanks in advance,

    Horacio

    #2
    Hello horacioofman,

    Thanks for your post.

    In the managed approach you would not be able to place two entry orders in the opposite direction. If you check the "log" tab of the control center when you apply the strategy you are likely to find error messages related to the strategy advising that x order have been ignored. Please review the section, " Internal Order Handling Rules that Reduce Unwanted Positions" https://ninjatrader.com/support/help...d_approach.htm

    You would not be able to use GTC orders in a strategy created in the strategy wizard. You could do this in a ninjascript created strategy (or an unlocked strategy wizard strategy) using the advanced order methods where you can specify a bool for the GTC. Here is a link to the EnterShortStop method which shows the overload needed for the advanced order type: https://ninjatrader.com/support/help...rshortstop.htm

    The strategy wizard is intended for fairly simple strategies. To have two entry orders OCO you would need to use the Unmanaged approach which is recommended for very experienced programmers.: https://ninjatrader.com/support/help...d_approach.htm

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks Paul!!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by pmachiraju, 11-01-2023, 04:46 AM
      8 responses
      148 views
      0 likes
      Last Post rehmans
      by rehmans
       
      Started by mattbsea, Today, 05:44 PM
      0 responses
      5 views
      0 likes
      Last Post mattbsea  
      Started by RideMe, 04-07-2024, 04:54 PM
      6 responses
      33 views
      0 likes
      Last Post RideMe
      by RideMe
       
      Started by tkaboris, Today, 05:13 PM
      0 responses
      5 views
      0 likes
      Last Post tkaboris  
      Started by GussJ, 03-04-2020, 03:11 PM
      16 responses
      3,283 views
      0 likes
      Last Post Leafcutter  
      Working...
      X