No announcement yet.

Partner 728x90


Buy and sell workflow sequence

  • Filter
  • Time
  • Show
Clear All
new posts

    Buy and sell workflow sequence

    My strategy enters and exits trades smoothly until the sequence is broken by 2 exit short commands that are out of sequence. when this happens the Strategy stops working until I stop and start the strategy to return the 3 Bools to true that controls the logic of the workflow

    I have a print enter and exit commands on every step of the workflow so as the logic passes through the 4 sets of the strategy builder I can trace the progress on the alerts log.

    On the chart I can see the plot activations and see buy - sell then sell - buy. but sometimes sell - buy to cover ?
    Is this throwing the sequence out and how can I check what is going on?
    Attached Files

    Hello fredfred123,

    Thank you for your note.

    I will need to see your log and trace for today look further into this inquiry.

    Could you please send an email to platformsupport[at]ninjatrader[dot]com with Attn: Alan P in the Subject line. Also within the email please include a link to this thread, and attach the log and trace files for the day in subject which you can find in My Documents>NinjaTrader>Log and My Documents>NinjaTrader/Trace folders.

    I look forward to your message.
    Alan P.NinjaTrader Customer Service


      Hi Alan

      The exact time and date is noted on the alert log on the attachment I sent in the first email, hope that helps.

      I think what you described could well be happening, but I do not understand why I get an enter short order, and then 2 exit short commands ?
      In what you described could be happening would I be correct in saying there is more than 1 trade to go short.

      I have in the workflow apposing a buy or sell the code
      DoOnce = true;
      The reason for putting this code in the workflow was to stop multiple trades being made as the market price jitters over the strategy entry point.
      to allow only one trade per bar, could this be preventing further progress in the workflow if the short command involves 2 trades ?

      The new bar may not be refreshing the workflow as if what you described is happening as it could be now out of sequence?

      Understanding that there may be 2 calls and I have limited each bar to one, the first trade works than the strategy stops until I turn the strategy off and back on to reset it.
      could a new bar refresh the sequence in the workflow?

      I’m a recent pupil of ninjascript so beginning to understand the process and exact syntax is a bit hazy


        This is what is happening.

        Strategy sells short, then trade reverses and goes long and Strategy exits trade with a buy to cover.

        On the Alerts log I get Enter short and then exit Short, then on the next green bar I get the 2nd exit short.

        I have enclosed 2 screen shots of this happening. The second exit short on the screen shot of the Alerts log coincides with the new green bar on the chart screenshot.

        The strategy will now be frozen until I restart it and will work till the next trade and so on.
        When I restart the strategy it will be yellow state until it goes flat.

        A solution to this would be greatly appreciated
        Thanks in advance
        Attached Files


          Hello fredfred123,

          Thank you for writing in.

          I would suggest adding print statements to check when or whether your conditions are becoming true. I’ve provided a link to a youtube video which covers an example of using prints to understand behavior:

          I’ve provided a link covering debugging which you may find helpful.

          If you’d like to send a copy of the strategy you’re running, I can take a look and see if anything jumps out.

          To export a NinjaScript from NinjaTrader 8 do the following:

          From the Control Center window select Tools -> Export -> NinjaScript...
          Click Add>Select the indicator>OK>Export.
          Then attach that file you saved; under My Docs>NT8>Bin>Custom>Select the downloaded .zip file.

          Please let us know if you need further assistance.
          Alan P.NinjaTrader Customer Service


          Latest Posts


          Topics Statistics Last Post
          Started by nitrojam, 08-17-2023, 04:26 AM
          17 responses
          Last Post krish007  
          Started by cay7man, Yesterday, 10:34 AM
          17 responses
          Last Post cay7man
          by cay7man
          Started by SherwoodJP, 08-31-2023, 02:58 PM
          2 responses
          Last Post LunaticEssence  
          Started by habibalex, 01-10-2017, 01:02 PM
          57 responses
          Last Post yeshe
          by yeshe
          Started by pennywise, 06-16-2023, 03:18 AM
          77 responses
          Last Post GTBrooks