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

Confused on my strategy builder

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

    Confused on my strategy builder

    Hey all, been getting loads of help from this forum so thought I'd ask another one.

    I have a strategy, it starts with bool = true ,
    Tab 1 i have it set to buy when conditions are met and bool = true, then change the bool in the "do the following" so it only takes one trade, and it works.
    Tab 2 i do the opposite of tab 1.


    My issue is, when the strategy is enabled, it will always take a buy trade even when the conditions are not met. and will never take a sell when the conditions are met. I have to be doing something wrong. If there is anyone that can look at my strat to see what i am doing wrong, or can explain it in simple terms that would be appreciated. I have attached an image of my issue. In the image, the bar with the arrow was a valid sell signal but it didnt take a trade until there was a buy signal.

    I need to figure out a way to make the start of the session "flat" and then be able to take a trade in either direction. I hope this makes sense.

    Thanks for your time.
    Attached Files
    Last edited by sprks7979; 02-11-2023, 04:45 PM.

    #2
    You can check to be sure the strategy is flat by using the following screenshot.


    Click image for larger version

Name:	image.png
Views:	98
Size:	29.2 KB
ID:	1235077

    Comment


      #3
      Hello sprks7979,

      You should upload the strategy to have a look, because from a chart photo alone I can't tell what could be the problem.

      Comment


        #4
        Hello sprks7979,

        Thanks for your post.

        A strategy will only place a trade when the condition to do so it true. A trade will not be placed if the condition is false.

        As northstardaytrading mentioned, you could use the condition they shared to check if the strategy is in a flat position before placing your entry order.

        To understand how your strategy is behaving and placing orders, debugging prints should be added to the strategy.

        In the strategy add prints (outside of any conditions) that print the values of every variable used in every condition that places an order along with the time of that bar.

        Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

        Below is a link to a forum post that demonstrates how to use prints to understand behavior.

        https://ninjatrader.com/support/foru...121#post791121

        Let us know if we may assist further.​​
        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by rhyminkevin, Today, 04:58 PM
        4 responses
        52 views
        0 likes
        Last Post dp8282
        by dp8282
         
        Started by iceman2018, Today, 05:07 PM
        0 responses
        5 views
        0 likes
        Last Post iceman2018  
        Started by lightsun47, Today, 03:51 PM
        0 responses
        7 views
        0 likes
        Last Post lightsun47  
        Started by 00nevest, Today, 02:27 PM
        1 response
        14 views
        0 likes
        Last Post 00nevest  
        Started by futtrader, 04-21-2024, 01:50 AM
        4 responses
        50 views
        0 likes
        Last Post futtrader  
        Working...
        X