Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

walk forward won't show increment to variable

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

    walk forward won't show increment to variable

    Hi,

    I have 2 variables in a strategy and for some reason i can optimize/increment the 1st variable but for the second i can't optimize it. it's really strange because i have declared the variables exactly the same way like this:
    Code:
            
    [Range(1, int.MaxValue)]
    [NinjaScriptProperty]
    [Display(Name="Period", Order=0, GroupName="Parameters")]
    public int Period
    { get; set; }
    
    [Range(1, double.MaxValue)]
    [NinjaScriptProperty]
    [Display(Name="target multi", Order=1, GroupName="Parameters")]
    public double TgMulti
    { get; set; }​
    ​
    any idea why ?
    Last edited by cbadr; 10-29-2023, 05:38 PM.

    #2
    Hello cbadr,

    Thanks for your post.

    I have added the code you shared in a new NinjaScript strategy with no other logic added to the script.

    Code:
    #region Properties
    [NinjaScriptProperty]
    [Range(1, int.MaxValue)]
    [Display(Name="Period", Order=1, GroupName="Parameters")]
    public int Period
    { get; set; }
    
    [NinjaScriptProperty]
    [Range(1, double.MaxValue)]
    [Display(Name="TgMulti", Order=2, GroupName="Parameters")]
    public double TgMulti
    { get; set; }
    #endregion​
    When testing the strategy in the Strategy Analyzer, I see that both of the user-defined properties are able to be optimized. See the attached screenshot.

    I suggest creating a new NinjaScript strategy, adding those properties to the script, and testing to see if both properties appear in the Strategy Analyzer window when running a Walk Forward Optimization.

    If the properties appear as expected then this means there is likely an issue with something in your code that is causing this behavior to occur. You could reduce the script to locate the exact line of code causing the issue. For example, comment out/reduce all logic in OnBarUpdate() and test to see if the behavior persists. If it does, reduce the script further till the issue does not occur. Then, uncomment one line of code at a time and test the script till you see the behavior return. The last line uncommented is likely causing the behavior to occur.

    Or, you could move logic over to the new blank Strategy one section at a time and test to see if the behavior persists. If at any time you move logic over to the new script and the behavior continues then the last section of logic added to the script is likely causing the behavior.

    Attached Files
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    23 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    120 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    63 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    41 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    45 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X