Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trading forex

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

    Trading forex

    I have two questions.

    1)Wnen I back test my strategy it includes the spreads and I want it removed. For example when I buy EURUSD 1.3493 and sell at 1.3496 I make 3 pip profit in backtest, but in live trade it showes 1pip profit.

    2) When my fast ema cross above slow ema I want my long trade to execute after three bars + 5pips, Short after three bars - 5pips,

    Thank You

    #2
    forexx, you could apply the spread to the backtest results by entering it as slippage, this way backtest and real executions would come closer together.

    You would need to custom code this waiting time then, for example setup a barcount since the signal was given and then place the needed Stop entry orders with your offset.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      trade

      When my price above or cross below ema some of my trade doesn`t execut. heare is my code.

      ()
      {
      // Condition set 1
      if (CrossAbove(Close, EMA(Close, Ema), 1))
      {
      EnterLongStop(DefaultQuantity, High[
      0] + 14 * TickSize, "");
      }
      // Condition set 2
      if (CrossBelow(Close, EMA(Close, Ema), 1))
      {
      EnterShortStop(DefaultQuantity, Low[
      0] + -15 * TickSize, "");
      }
      // Condition set 3
      if (CrossAbove(Close, EMA(Open, Ema), 1))
      {
      ExitShort(
      "", "");
      }
      // Condition set 4
      if (CrossBelow(Close, EMA(Open, 27), 1))
      {
      ExitLong(
      "", "");

      My indicater discriptin is when price bilow ema after 1st close bar below 15 pips do sell.
      Last edited by forexx; 11-24-2010, 11:39 AM.

      Comment


        #4
        You would need to let your strategy run with TraceOrders to get more insight into the order behavior you see, likely not all Stop orders get filled, thus you skip a crossover here and then, have you tried going market instead?

        BertrandNinjaTrader Customer Service

        Comment


          #5
          Re

          no i done`t want market order.

          But i have second problem my stop orders doesn`t trade where i want they just trade when bar cloded.

          EnterShortStop(DefaultQuantity, Low[0] + -15 * TickSize, "");

          My indicater discriptin is when price bilow ema after 1st close bar below 15 pips do sell.

          Is this right.
          Last edited by forexx; 11-24-2010, 12:30 PM.

          Comment


            #6
            This would be expected in backtesting, as only the OHLCV info is know, not the intrabar formation - trades are executed on the next bar after the bar that triggered the trade closed, as this is the earliest possible location to trade after the bar is closed.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              re

              I dont understant what you mean.

              All i want when price goes abome my ema after 1st close bar when price rise 15 pips my tade be executed.
              Last edited by forexx; 11-24-2010, 12:40 PM.

              Comment


                #8
                Your trades in backtesting are executed on the bar after the signal was generated, you can't trade intrabar as the tick formation of the bar is not known with one series, thus what you see would be expected.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  re

                  So what i cant do.

                  Comment


                    #10
                    Sorry - I don't follow you - what is the issue then exactly that you have? You prepare a stop order for the next bar and it either get's filled or not...if it would not get filled, NinjaTrader would cancel it per default, should you wish to leave this running, you would need to resubmit it, or use an order entry overload offering the liveUntilCancelled property -

                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      re

                      All i want when my price crossing above my ema after 1st close bar when price rise 15 pip,even if bar changes to next one to rich my 15 pips or within same bar to stop my first order and buy if the price and the bar above my ema.
                      Last edited by forexx; 11-24-2010, 01:15 PM.

                      Comment


                        #12
                        You will need to use what I posted and debug your strategy as needed to make it work for you, helpful tools are Prints and TraceOrder to better understand your codes behavior -



                        BertrandNinjaTrader Customer Service

                        Comment


                          #13
                          I have the same problem

                          both are missunderstanding each other,...
                          Th problem is in pic as described.....
                          All he and I want is when its on Sell position going down and on the way crosses above Ema, then to make the ExitShort() ; We do not want to make buy righ away after exitshort unless, if goes other +10 pips then make the execute the buy
                          I have all in picture.....


                          Originally posted by NinjaTrader_Bertrand View Post
                          You will need to use what I posted and debug your strategy as needed to make it work for you, helpful tools are Prints and TraceOrder to better understand your codes behavior -



                          http://www.ninjatrader.com/support/f...ead.php?t=3418
                          Attached Files

                          Comment


                            #14
                            re

                            All i want when price goes abome my ema after 1st close bar when price rise 15 pips my tade will be executed.

                            Comment


                              #15
                              forexx,

                              So you want if the price closes above the EMA by 15 pips to trade?

                              Code:
                              if (CrossAbove(Close, EMA(20)[0] + 15 * TickSize, 1))
                                   EnterLong();
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by ScottW, Today, 06:09 PM
                              1 response
                              4 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by ScottWalsh, Today, 06:52 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post ScottWalsh  
                              Started by ftsc2022, 10-25-2022, 12:03 PM
                              5 responses
                              256 views
                              0 likes
                              Last Post KeyonMatthews  
                              Started by Board game geek, 10-29-2023, 12:00 PM
                              14 responses
                              244 views
                              0 likes
                              Last Post DJ888
                              by DJ888
                               
                              Started by Waxavi, 04-19-2024, 02:10 AM
                              4 responses
                              56 views
                              0 likes
                              Last Post sonia0101  
                              Working...
                              X