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

Intermittent Problem with Condition Logic

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

    Intermittent Problem with Condition Logic

    I have a condition set, which sets a bool variable and prints it to the Output window. The only condition that I can pin the problem on is one which references a custom indicator. Sometimes the logic works and sometimes it doesn't. I have an instance of the problem for which I'm able to replicate in playback.

    Is it possible that I have to force an indicator Update() within the condition block?

    Here is code:

    Code:
    if(FirstTickOfBar)
    {
    if(myCustomIndicator[1] > 5)
    {
    entry == true;
    Print("Enter Now");
    }
    }
    This is actually a simplification. I have a whole series of condition sets. They all seem to work fine. Even this one works sometimes, as I'll get the Output window printing "Enter Now" on the same chart on the same day as when the Output window should print this but doesn't.

    #2
    Hello coolmoss,
    Unfortunately the Update() method wont be handy in this case.

    Update() is used to get the updated values in the property getter region for any non-plot property.

    JoydeepNinjaTrader Customer Service

    Comment


      #3
      What would be the appropriate approach to resolving this?

      Comment


        #4
        Hello coolmoss,
        If you are checking for any non-plot values in your custom indicator then you have to use the Update() method in the property getter to get an updated value. Please refer to this sample code which further illustrates it http://www.ninjatrader.com/support/f...ead.php?t=4991
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Hi Joydeep,

          I am using a plot method. I am printing the plot value to the output file once per bar. I also have the actual indicator in a pane on the same chart as the strategy. I am watching all of this update in playback. For most bars, the Output window prints the same value as the indicator. However, sometimes, the Output window will print a zero (0) where the indicator plots some other value.

          Hope this makes the issue more clear.

          Comment


            #6
            Hello coolmoss,
            Can you send a toy NinjaScript code* replicating the behavior and step-by-step instructions how to replicate it, to support[AT]ninjatrader[DOT]com

            Please append Attn:Joydeep in the subject line of the email and give a reference of this thread in the body of the email.

            I look forward to assisting you further.

            *The "toy" just means something that is a stripped down version that isn't necessarily the whole logic. It makes things easier to rout out.
            JoydeepNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by gcztraders, Yesterday, 03:58 AM
            1 response
            14 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by reynoldsn, 05-10-2024, 07:04 PM
            1 response
            14 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by franciscog21, 05-10-2024, 05:27 PM
            1 response
            30 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by llanqui, Today, 11:10 AM
            0 responses
            8 views
            0 likes
            Last Post llanqui
            by llanqui
             
            Started by llanqui, Today, 10:29 AM
            0 responses
            9 views
            0 likes
            Last Post llanqui
            by llanqui
             
            Working...
            X