Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

actual price crosses value in the past

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

    actual price crosses value in the past

    hi, i am having a hard time building a simple indicator.

    1st) i take the high price of the bar when the ema (3) crosses above the ema(10);
    2nd) i want plot 1 when the actual close crosses that high;
    3st) and trigger a buy order when this happens.


    how can i do that?

    thx!!

    #2
    Ive done the indicator and the strategy, but now i have a problem.

    i would like to buy one bar befone NJ is buying, NJ is doing this:

    1) ema 3 crosses above ema 10,
    2) NJ makes a horizontal line on the high of that bar which happens the cross;
    3) if the next bar has a high higher than that horizontal line, buy order at the open of the NEXT bar (TWO bars after the cross).

    what i would like to do is that:

    1) ema 3 crosses above ema 10,
    2) NJ makes a horizontal line on the high of that bar which happens the cross;
    3) if in some moment the next bar crosses that horizontal line, buy immediately at this price (only ONE bar after the cross, not TWO).

    how can i program that?

    thx!

    Comment


      #3
      Originally posted by andnd View Post
      Ive done the indicator and the strategy, but now i have a problem.

      i would like to buy one bar befone NJ is buying, NJ is doing this:

      1) ema 3 crosses above ema 10,
      2) NJ makes a horizontal line on the high of that bar which happens the cross;
      3) if the next bar has a high higher than that horizontal line, buy order at the open of the NEXT bar (TWO bars after the cross).

      what i would like to do is that:

      1) ema 3 crosses above ema 10,
      2) NJ makes a horizontal line on the high of that bar which happens the cross;
      3) if in some moment the next bar crosses that horizontal line, buy immediately at this price (only ONE bar after the cross, not TWO).

      how can i program that?

      thx!
      Are you asking about in live trading or backtest/Strategy Analyzer?

      Comment


        #4
        Both, because i would like to backtest before live trading, is that possible?

        Comment


          #5
          Hello,

          This depends on where the strategy is running for where you would see the execution. Also it depends on how the strategy was created.

          In a backtest, you will be using the close of each bar for processing where in real time you have the choice of using CalculateOnBarClose or going Tick by Tick for processing so there is a difference.

          Because of this, you would see executions 1 bar after they had been triggered in a backtest. Running live, this same condition, depending on the CalculateOnBarClose, could happen either on the bar close or intrabar.

          I would recommend reviewing this document: http://www.ninjatrader.com/support/h...ime_vs_bac.htm

          This goes over the main differences between a backtest and live results.

          Have you tested this live using the Sim101 account yet? depending on the strategy logic, you may already have what you need to execute trades as you described. Because of the differences in backtest vs live you may be just seeing that. Otherwise if you wanted the strategy to be more similar in backtest to live, you would need to add intrabar granularity to the script.

          There is a reference sample located here: http://www.ninjatrader.com/support/f...ead.php?t=6652

          Also good relevant information to this would be the following topics:



          I look forward to being of further assistance.
          JesseNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by algospoke, 04-17-2024, 06:40 PM
          6 responses
          48 views
          0 likes
          Last Post algospoke  
          Started by arvidvanstaey, Today, 02:19 PM
          4 responses
          11 views
          0 likes
          Last Post arvidvanstaey  
          Started by samish18, 04-17-2024, 08:57 AM
          16 responses
          61 views
          0 likes
          Last Post samish18  
          Started by jordanq2, Today, 03:10 PM
          2 responses
          9 views
          0 likes
          Last Post jordanq2  
          Started by traderqz, Today, 12:06 AM
          10 responses
          19 views
          0 likes
          Last Post traderqz  
          Working...
          X