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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        90 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        137 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
        120 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        71 views
        0 likes
        Last Post PaulMohn  
        Working...
        X