• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Takeprofit and reverse

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

    Takeprofit and reverse

    Hi,
    sorry for my english,
    I need to revese the position in the same bar and moment of takeprofit.
    How can i do?
    Something like this...

    if(...)
    EnterLong("EnL1");
    SetProfitTargetANDREVERSE("EnL1", CalculationMode.Percent, 0.1);

    #2
    Hi Fabri, welcome to our forums - there would be unfortunately not a Set Target method that would offer the option to reverse as well, but you could custom code to achieve this trait.

    For example you could detect the Execution of the Set Target and then issue your reverse order as needed -

    http://www.ninjatrader.com/support/f...ead.php?t=5790
    BertrandNinjaTrader Customer Service

    Comment


      #3
      I tried with this script....
      if (Position.GetProfitLoss(V, PerformanceUnit.Percent)>=0.01)
      EnterShort("EnS1");

      but I failed because beacktest does not gave me the signal profit and reverse at the same bar and moment... can you help me please?
      I need to write this script..
      SetProfitTarget ("EnL1", CalculationMode.Percent, 0.1).... when condition profitTarget=true entershort or shortsell at the same livel of target
      Last edited by fabri; 04-24-2012, 01:56 AM.

      Comment


        #4
        nobody can help me to write it in ninjatrader language?
        thanks

        Comment


          #5
          fabri, we can unfortunately not custom code this for you - but with the sample I provided you could check when the Profit Target order executes and then submit your reverse order in OnExecution() - this would work for a backtest as well.

          If you seek to have the code needed created professionally for you - please check with those certified NinjaScript consultants available - http://www.ninjatrader.com/partners#...pt-Consultants
          BertrandNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by johnnybegoode, Today, 07:02 PM
          0 responses
          4 views
          0 likes
          Last Post johnnybegoode  
          Started by YevhenShynkarenko, Today, 05:02 PM
          1 response
          11 views
          0 likes
          Last Post YevhenShynkarenko  
          Started by lahabatha, Today, 04:42 PM
          0 responses
          8 views
          0 likes
          Last Post lahabatha  
          Started by explorer101, Today, 03:39 PM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by faisamtrader, Today, 03:32 PM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X