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

Auto Supertrend Strategy

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

    Auto Supertrend Strategy

    Hello Support Forum

    I developed a strategy using the SuperTrend indicator for both long and short trades, but when I activate the strategy, it only executes long trades. I set up the conditions for short trades by duplicating the long trade settings and reversing the conditions, yet it's unclear why the strategy isn't initiating short trades.​​Click image for larger version

Name:	image.png
Views:	35
Size:	24.0 KB
ID:	1301482Click image for larger version

Name:	image.png
Views:	29
Size:	23.8 KB
ID:	1301483​​

    #2
    Hello pickles1774,

    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 or rejected.

    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 (in a new condition set with no 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 support article 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.​
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by quicksandatl, 05-09-2024, 11:11 AM
    4 responses
    32 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by gyilaoliver, Today, 05:33 AM
    5 responses
    17 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by tkaboris, Today, 07:52 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by anton_tymoshchuk, Today, 01:14 AM
    2 responses
    15 views
    0 likes
    Last Post anton_tymoshchuk  
    Started by Epiphany79, Yesterday, 05:00 PM
    1 response
    14 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X