Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time Based Set Profit Target | Not working for me | please help

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

    Time Based Set Profit Target | Not working for me | please help

    Hi, I want to setup 3 time based take profit conditions however it is only detecting the first take profit of $1000.

    Please help

    Im currently in eastern time trading /NQ


    DateTime currentTimeEastern = Time[0].AddHours(-4);
    //Time Based Take Profit Conditions
    if (currentTimeEastern.TimeOfDay < new TimeSpan(11, 30, 0))
    {
    // Before 11:30 AM Eastern Time, set profit target to $1000
    SetProfitTarget("", CalculationMode.Currency, 1000);
    }
    else if (currentTimeEastern.TimeOfDay >= new TimeSpan(11, 30, 0) )
    {
    // Between 11:30 AM and 2:00 PM Eastern Time, set profit target to $400
    SetProfitTarget("", CalculationMode.Currency, 400);
    }
    else if (currentTimeEastern.TimeOfDay > new TimeSpan(14, 0, 0))
    {
    // After 2:00 PM Eastern Time, set profit target to $100
    SetProfitTarget("", CalculationMode.Currency, 100);
    }​

    #2
    Hello osmanigarces,

    Thank you for your post.

    Where is this code located? Is it in OnBarUpdate()?

    Also please note, set methods cannot be unset. To reset the ProfitTarget, you should before a new entry is placed and when the strategy is flat. From the Help Guide:

    "Should you call this method to dynamically change the target price in the strategy OnBarUpdate() method, you should always reset the target price / offset value when your strategy is flat otherwise, the last price/offset value set will be used to generate your profit target order on your next open position​"



    This sample script demonstrates modifying the price of profit target orders:



    Please let me know if you have any further questions.

    Comment


      #3
      Thanks this helped, its workiong now

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      53 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      130 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      70 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X