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 judysamnt7, 03-13-2023, 09:11 AM
      4 responses
      58 views
      0 likes
      Last Post DynamicTest  
      Started by ScottWalsh, Today, 06:52 PM
      4 responses
      36 views
      0 likes
      Last Post ScottWalsh  
      Started by olisav57, Today, 07:39 PM
      0 responses
      7 views
      0 likes
      Last Post olisav57  
      Started by trilliantrader, Today, 03:01 PM
      2 responses
      21 views
      0 likes
      Last Post helpwanted  
      Started by cre8able, Today, 07:24 PM
      0 responses
      9 views
      0 likes
      Last Post cre8able  
      Working...
      X