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

Builder buy when should not

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

    Builder buy when should not

    Hi, in this builder i check the last 2 bard (renko), if they are all green (close > open) buy, but there is an error:

    https://ibb.co/k7DyO5

    #2
    Hello lorenzoP,

    When you applied the strategy, likely you are running the strategy with Calculate set to OnBarClose, which means that the strategy waits until the bar closes before evaluating if the condition is true or false. Thus, on the bar before the entry on your image, your conditions were true and an order was submitted to buy on the open of the next bar.

    I put together a screen shot explaining this point.

    Please see Calculate section of our helpguide,


    Please let us know if you need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Hi, thanks, i treid with calculate on each tick, but there are still error;
      could you please tell me how to do that?

      buy when the last 2 bar are green
      sell when the last 2 bar are red

      (im going to try using a ema with period 3 or 2, if raising buy, if falling sell, could this work?)

      Comment


        #4
        Hello lorenzoP,

        By error are you referring to an actual error message or the strategy not behaving like expected?
        The way your strategy is set up would in real time behave as expected, with calculate set OnEachTick.

        Historical trades are going to be plotted as if calculate was set to OnBarClose. Adding a secondary data series of type tick, and submit orders to that series, should provide more accurate historical trade results by taking away the issue where the trade is not entered on the bar the condition becomes true, but rather on the open of the following bar.

        You should see the following post on intrabar granularity,


        I look forward to your reply.
        Alan P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ghoul, Today, 06:02 PM
        2 responses
        11 views
        0 likes
        Last Post ghoul
        by ghoul
         
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        44 views
        0 likes
        Last Post jeronymite  
        Started by Barry Milan, Yesterday, 10:35 PM
        7 responses
        20 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by AttiM, 02-14-2024, 05:20 PM
        10 responses
        180 views
        0 likes
        Last Post jeronymite  
        Started by DanielSanMartin, Yesterday, 02:37 PM
        2 responses
        13 views
        0 likes
        Last Post DanielSanMartin  
        Working...
        X