Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

I´m lost

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

    I´m lost

    I am new programming in C #.

    I wonder if it is possible that the entry is executed like CalculateOnBarClose = true; And the output position is executed like CalculateOnBarClose = false;

    I tried several times and can not

    Thank you so much.

    #2
    Hi Condealvaro6,

    Thank you for your post.

    Yes this possible and will require custom coding for the script. You will need to use this if condition -
    if(FirstTickOfBar)
    {
    //Entry logic
    }

    The FirstTickOfBar will only be true when a new bar is formed and the script runs the calculations inside that if statement. everything else outside those curly braces will be run on a tick by tick basis as you will need to run the script with CalculateOnBarClose = false.

    Example Script
    Code:
    OnBarUpdate()
    {
    
         if(FirstTickOfBar)
         {
              EnterLong(0);
         }
    
         if(Close[0] < Open[0])
         {
              ExitLong();
         }
    
    
    }
    My entry will only be done when a new bar is formed like it was ran with CalculateOnBarClose set to true.
    The exit will run on a tick by tick basis.

    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Thank you very much for your answer.
      I could not still make it work but I keep trying with you said.

      Thank you very much for directing me.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      72 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      44 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      25 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      29 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      60 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X