Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetprofitTarget ???

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

    SetprofitTarget ???

    Hello,
    I have a problem with the SetprofitTarget,is not activate when it reaches the price . In the Output window , the calculation: Close [0] + RangeIL is correct. The profit does not fire when the price is reached.
    Code:

    # region Positions
    private void GoLong ()

    EnterLong (10, "");
    SetProfitTarget (LongBuy "CalculationMode.Price, Close [0] + rangeIL);
    Print (Time [0] + "Value rangeIL" rangeIL +);// it's OK
    # endregion

    protected override void OnBarUpdate ()

    if (variable1 Variable0 == 0)
    {

    GoLong ();
    }

    Ciao.
    Roberto

    #2
    Roberto, it looks like the FromEntrySignal name is not correct in your call so it's not picked up - you would need to name your entry then LongBuy, too.

    Comment


      #3
      Sorry, but I do not know what to do. Here's the code more detail:
      # region Variables
      private double rangeIL = 1;

      # endregion

      # region Positions
      private void GoLong ()
      EnterLong (10, "");
      SetProfitTarget (LongBuy "CalculationMode.Price, Close [0] + rangeIL);
      Print (Time [0] + "Value rangeIL" rangeIL +);// it's OK but the profit does not work
      # endregion

      # region OrderRouting
      private void ManagerOrder ()
      {
      if (Position.MarketPosition == MarketPosition.Long)
      SetStopLoss (CalculationMode.Percent, 0.04);
      Etc. .....
      }

      # endregion

      protected override void OnBarUpdate ()

      ManagerOrder ();
      if (Position.MarketPosition! = MarketPosition.Flat) return;

      if (variable1 Variable0 == 0)
      {

      GoLong ();
      }

      Hello.
      Roberto

      Comment


        #4
        Roberto, you tag the target to the incorrect entry signal name - please try the snippet below instead -

        EnterLong (10, "LongBuy");
        SetProfitTarget ("LongBuy", CalculationMode.Price, Close [0] + rangeIL);

        Comment


          #5
          Ok Bertrand,
          I removed the region Positions, now works.
          Thanks.
          Hello.
          Roberto

          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