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 CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      58 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      34 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      195 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      359 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      281 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X