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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      89 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      135 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      119 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      69 views
      0 likes
      Last Post PaulMohn  
      Working...
      X