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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    30 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    48 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    38 views
    0 likes
    Last Post CarlTrading  
    Working...
    X