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

Single trade in one direction

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

    Single trade in one direction

    Hello: The below attached strategy places the order when bar changes color and on close of the bar. Is it possible in Strategy builder to place only one order, 1st order on change of candle color till next color change. Currently, it keeps placing orders based on current color till next color change. Please see attached picture of the chart . Thanks,
    Attached Files

    #2
    Hello mtamaku,

    Thanks for your post.

    Please note that we have moved your thread to the Ninjatrader 8 Strategy Development forum as that is a more appropriate forum for this topic.

    Yes, you can create a "flip-flop" type condition where you would place one trade, flip the state of a bool and then place a trade in the opposite direction (in conjunction with your conditions) and continue the flip-flop process. I've created and attached an example strategy builder strategy you can download, install, and test. It places no trades and colors the background when the conditions change. The conditions in this example are of an EMA crossing above or below an SMA.

    ExampleFlipFlop.zip

    To Import

    Download the zip file to your desktop, keep them in the compressed .zip file.

    From the Control Center window select the menu File> Utilities> Import NinjaScript

    Select the downloaded .zip file

    NinjaTrader will then confirm if the import has been successful.

    Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks Paul. I will try this but in the meantime you replied, I added sell and buy using similar flag on/off variable and now it trades only once per direction. Thanks for efforts.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by bortz, 11-06-2023, 08:04 AM
      47 responses
      1,606 views
      0 likes
      Last Post aligator  
      Started by jaybedreamin, Today, 05:56 PM
      0 responses
      8 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      18 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      4 views
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      13 views
      0 likes
      Last Post Javierw.ok  
      Working...
      X