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

Walk forward optimization won't trigger trades

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

    Walk forward optimization won't trigger trades

    Hi,

    i have a simple strategy that triggers trade on the chart on daily timeframe, but when i want to use the walk forward opt. no trades are trigger when selecting 1 daily bar (it does with 60min bar).
    The problem comes when i use the day of week = monday in the code below:

    Code:
    if (Close[0]> EMA(Period)[0]
        && Times[0][0].DayOfWeek == DayOfWeek.Monday
        && Position.MarketPosition == MarketPosition.Flat)
                    {    
                        EnterLong(1,"entry1");  
                    }
    ​
    I think the issue comes with the fact that there is no sufficent bars required to plot before monday in the WFO. I setup 28days optimization and 7 days testing.

    Your help is needed.

    Thanks

    #2
    Hello cbadr,

    Thank you for your post.

    Have you tested and confirmed this part of the code is causing the issue?

    I recommend debugging using prints so we can see why your conditions for entry are not evaluating as true.

    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.

    Below is also the Help Guide page on 'Understand Walk forward optimization results':

    https://ninjatrader.com/support/help...ForwardResults
    Gaby V.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Karado58, 11-26-2012, 02:57 PM
    8 responses
    14,828 views
    0 likes
    Last Post Option Whisperer  
    Started by Option Whisperer, Today, 09:05 AM
    0 responses
    1 view
    0 likes
    Last Post Option Whisperer  
    Started by cre8able, Yesterday, 01:16 PM
    3 responses
    11 views
    0 likes
    Last Post cre8able  
    Started by Harry, 05-02-2018, 01:54 PM
    10 responses
    3,204 views
    0 likes
    Last Post tharton3  
    Started by ChartTourist, Today, 08:22 AM
    0 responses
    6 views
    0 likes
    Last Post ChartTourist  
    Working...
    X