Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Logic for ATM use

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

    Strategy Logic for ATM use

    I have reviewed the sample ATM strategy that I found on another thread, but still have problems.

    For my trade signals, I use an indicator that generates a binary switch (value > 0 for long, <0 for short, 0 for flat). I then simply read the indicator.

    Here is the logic that I have coded: (I am presenting algorithm, not code)

    -------------

    if new signal, then
    // signal[1] and !signal[2] :new order
    get orderId and strategyId
    create an ATM order (using limit orders away from current price)
    // signal still present : revise entry price
    else if signal[1] and signal[2], then
    change the ATM entry price
    // lost permissive
    else if !signal[1] and signal[2], then
    cancel the order
    I do this for both long and short.

    I also use a calculated trailing stop.

    I then copied the logic from the sample that retrieves the order status and sets the orderId and strategyId to empty string.

    -----------------
    Now, my dilemma

    - the strategy doesn't work (obviously, or I wouldn't be posting this )
    - the output window gives error messages that a specific orderId and a specific strategyId do not exist


    Do I have any fundamental logic flow issues?

    Am I getting the ID's at the right time?

    Since the output window is stating specific orderId and strategyId in the error message, it seems that there is either some issue with initializing the variables or resetting them to an empty string is being done at the wrong time.



    Any guidance would be appreciated

    Rod

    #2
    RodS7, it's hard to say per se without seeing your actual code used - the SampleAtm would introduce the concepts / methods but of course those would need to be tailored for your custom use.

    For working through your issue, I would suggest to simplify the code / strategy as much as possible and working one side only for now and ensuring variable / signal states are as you would expect them to be for example via debug Prints - http://www.ninjatrader.com/support/f...ead.php?t=3418

    The messages you saw in the output window likely come from accessing the reset order / strategy id's when you're flat.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    637 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    366 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    107 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    569 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    572 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X