Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AtmStrategyChangeStopTarget usage with chart trader

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

    AtmStrategyChangeStopTarget usage with chart trader

    Hi,

    I am attempting to use the AtmStrategyChangeStopTarget method within a strategy to set custom stops and targets. However, when viewing the orders with chart trader, the stop and target always set by the ATM template only.

    The following is the code block I'm using to set them:

    Code:
                    if (atmStrategyId.Length > 0 )
                    {
                        if(GetAtmStrategyMarketPosition(atmStrategyId) == Cbi.MarketPosition.Flat)
                        {
                            Print("Flat");
                            atmStrategyId = string.Empty;
                        }
                        else
                        {
                            if( EnableFractalStop )
                            {
                                double avgPrice = GetAtmStrategyPositionAveragePrice(atmStrategyId);
    
                                stopTicks = getStopTicks(false, avgPrice);
                                targetTicks = (int)((double)stopTicks * RewardRatio);
    
                                stopPrice = avgPrice + (TickSize * (double)stopTicks);
                                targetPrice = avgPrice - (TickSize * (double)targetTicks);
    
                                AtmStrategyChangeStopTarget(0, stopPrice, "Stop1", atmStrategyId);
                                AtmStrategyChangeStopTarget(targetPrice, 0, "Target1", atmStrategyId);
                            }
                        }
                    }​
    Is there something I'm not doing correctly? Any feedback or resources would be greatly appreciated.

    #2
    Hello Newbie-NT-Scriptor,

    Are you certain that logic is being executed? Have you tried adding a print into the condition to make sure that AtmStrategyChangeStopTarget is being called?

    Comment


      #3
      Thank you Jesse, you were correct in that it was not being executed since it was immediately following the order submission.

      One more question, what would be the best way to find whether the stop or target has been filled or if there is no longer an active ATM strategy being that GetAtmStrategyStopTargetOrderStatus is only relative to an active strategy? I'm simply seeking to find when the strategy has gone back flat so I can track whether a new position can be taken.

      Thanks in advance!

      Comment


        #4
        Hello Newbie-NT-Scriptor,

        I would suggest reviewing the SampleATMStrategy that comes with the platform, that shows the base logic required to manage an ATM through its lifecycle Your script would need basically everything that shows to operate properly and know when the atm becomes flat. That covers all situations such as entry being filled, targets being filled or atm being cancelled.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        20 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        119 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        63 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        41 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        45 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X