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

Simple strategy builder stoploss and profit target

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

    Simple strategy builder stoploss and profit target

    Hi All,

    I'm trying to set up a simple strategy builder EMAs cross entry with a very simple 60 ticks stoploss and 200 ticks profit target. I can't figure out how to do it properly as my setup doesn't seem to work(see my screenshots).

    Thank you for your help.
    Attached Files

    #2
    Hello McGyver270,

    Thank you for your post.

    Can you elaborate in what way it is not working? Is the strategy not placing orders when expected, are you seeing any errors in the Log tab of the Control Center, etc?


    If the expected trade(s) are not appearing, this would indicate that the condition to place the order is not evaluating as true and the order is not being submitted, or the order is being ignored for other reasons, or the order is being cancelled.

    To understand why the script is behaving as it is, such as placing orders or not placing orders or drawing objects when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

    In the strategy add prints (outside of any conditions) that print the date time of the bar and all values compared in every condition that places an order.

    The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very important to include a text label for each value and for each comparison operator in the print to understand what is being compared in the condition sets.

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

    Further, enable TraceOrders which will let us know if any orders are being ignored and not being submitted when the condition to place the orders is evaluating as true.

    I am happy to assist you with analyzing the output from the output window.

    Run or backtest the script and when the output from the output window appears save this by right-clicking the output window and selecting Save As... -> give the output file a name and save -> then attach the output text file to your reply.

    Below is a link to a forum post that demonstrates using informative prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.


    Please let me know if I may further assist with analyzing the output or if you need any assistance creating a print or enabling TraceOrders.​
    Gaby V.NinjaTrader Customer Service

    Comment


      #3
      Hello Gaby,

      Thank you for your reply. The script do place entry orders and the stoploss in place in the strategy builder work but not the exit at profit target.

      Hugues

      Comment


        #4
        Hello McGyver270,

        I recommend debugging using prints and TraceOrders from my previous reply so we can see why the script is behaving as it is. In particular, TraceOrders will give us info on whether or not the profit target is being submitted.

        Please let me know if I may further assist with analyzing the output or if you need any assistance creating a print or enabling TraceOrders.​
        Gaby V.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Option Whisperer, Today, 09:55 AM
        1 response
        11 views
        0 likes
        Last Post bltdavid  
        Started by port119, Today, 02:43 PM
        0 responses
        1 view
        0 likes
        Last Post port119
        by port119
         
        Started by Philippe56140, Today, 02:35 PM
        0 responses
        2 views
        0 likes
        Last Post Philippe56140  
        Started by 00nevest, Today, 02:27 PM
        0 responses
        1 view
        0 likes
        Last Post 00nevest  
        Started by Jonafare, 12-06-2012, 03:48 PM
        5 responses
        3,986 views
        0 likes
        Last Post rene69851  
        Working...
        X