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 -

    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

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by sjsj2732, Yesterday, 04:31 AM
          0 responses
          31 views
          0 likes
          Last Post sjsj2732  
          Started by NullPointStrategies, 03-13-2026, 05:17 AM
          0 responses
          286 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          283 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          133 views
          1 like
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          91 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Working...
          X