Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Swing(stochastics) not working

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

    Swing(stochastics) not working

    Hi,
    One of you guys made a video on how to print indicator values when its giving you wrong values, however I cant find the thread.
    I think everyone knows how to print but most dont know how to fix an indicator giving wrong values.

    One of the guys entry reasons was:
    Condition:
    Code:
    Swing(Stochastics(Close,7,14,3).D,5).SwingHigh[0]  != SwingHighValue;
    Action:
    Code:
    SwingHighValue = Swing(Stochastics(Close,7,14,3).D,5).SwingHigh[0];

    So I was wondering why it gives wrong values? Why does it enter at the wrong points? thanks

    #2
    Hello ezrollin,

    Thanks for your post.

    Debugging prints would need to be added to the script to determine exactly how those values are being calculated in your script.

    You could find detailed information and a video demonstration for debugging a NinjaScript in this forum thread: https://ninjatrader.com/support/foru...121#post791121

    For example, you would add a debugging print that prints out the SwingHighValue variable, the CurrentBar, and the Time (Time[0]).

    The print might look something like this: Print("SwingHighValue: " + SwingHighValue + " CurrentBar: " + CurrentBar + " Time: " + Time[0].

    Prints will appear in the NinjaScript Output window (New > NinjaScript Output window) . You would also want to add a print for the Swing().SwingHigh[0] indicator value.

    You could compare the prints in the Output window to see how the script is evaluating.

    Let me know if I may assist further.
    <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, Yesterday, 05:17 AM
    0 responses
    55 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    132 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    73 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X