Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to use correct Bid and Ask rates in Strategy Analizer?

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

    How to use correct Bid and Ask rates in Strategy Analizer?

    I developed a very simple strategy.
    In Strategy Analyzer I get good, but inaccurate resalt.
    ( Demo-trading this result not confirmed ).
    Later I seen - the Strategy Analyzer and/or my strategy does not use the right Bid/Ask rates.
    It's undepend of Dataseries type (Bid, Ask, Last).

    How to use the right of buying and selling rates in the Strategy Analyzer?

    #2
    topor, that's correct per default it would use the dataseries you choose to test the strategy on only (bid / ask / last), you could those custom code into the strategy to execute to Add()ed bid / ask series in a so called MultiSeries strategy - http://www.ninjatrader.com/support/h...s/nt7/add3.htm
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      topor, that's correct per default it would use the dataseries you choose to test the strategy on only (bid / ask / last), you could those custom code into the strategy to execute to Add()ed bid / ask series in a so called MultiSeries strategy - http://www.ninjatrader.com/support/h...s/nt7/add3.htm
      Please post "SampleMACrossOver" and/or any reference sample strategy source code with necessary changes.
      Last edited by topor; 05-29-2012, 12:37 AM.

      Comment


        #4
        A closely related example of the technique needed would be found here - http://www.ninjatrader.com/support/f...ead.php?t=6652

        I've added shipping NT with such an example to our product management feedback list under item #1795.

        Thank you for your input how to further improve NinjaTrader,
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Revise please this code...

          All correct?

          //************************************************** ***********************
          protected override void Initialize()
          {
          Add( Instrument.FullName.ToString(), BarsPeriods[0].Id, BarsPeriods[0].Value, MarketDataType.Ask );
          Add( Instrument.FullName.ToString(), BarsPeriods[0].Id, BarsPeriods[0].Value, MarketDataType.Bid );

          Add(EMA(Fast));
          Add(EMA(Slow));

          EMA(Fast).Plots[0].Pen.Color = Color.Blue;
          EMA(Slow).Plots[0].Pen.Color = Color.Green;

          CalculateOnBarClose = true;
          }

          protected override void OnBarUpdate()
          {
          if (BarsInProgress == 0)
          {
          if (CrossAbove(EMA(Fast), EMA(Slow), 1))
          {
          EnterLong( 1, 1, "Long");//Buy Ask
          }
          else if (CrossBelow(EMA(Fast), EMA(Slow), 1))
          {
          EnterShort( 2, 1, "Short");//Sell Bid
          }
          }
          else
          {
          return;
          }
          }
          //************************************************** ***********************

          Comment


            #6
            Looks good topor, although we would not officially support the dynamic adding done in your Initialize(), so best would be doing the symbol and period id over a user string input for example.
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by GLFX005, Today, 03:23 AM
            0 responses
            1 view
            0 likes
            Last Post GLFX005
            by GLFX005
             
            Started by XXtrader, Yesterday, 11:30 PM
            2 responses
            11 views
            0 likes
            Last Post XXtrader  
            Started by Waxavi, Today, 02:10 AM
            0 responses
            6 views
            0 likes
            Last Post Waxavi
            by Waxavi
             
            Started by TradeForge, Today, 02:09 AM
            0 responses
            14 views
            0 likes
            Last Post TradeForge  
            Started by Waxavi, Today, 02:00 AM
            0 responses
            3 views
            0 likes
            Last Post Waxavi
            by Waxavi
             
            Working...
            X