Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi-parameter ATM strategy

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

    Multi-parameter ATM strategy

    HI,

    Newbie question: I have combined the SampleATMStrategy with the SampleMACrossover for a Long Scalp. How do I add a second parameter (such as Double Stochastic < 20) to the "if" code? Is this correct?

    if (orderId.Length == 0 && atmStrategyId.Length == 0 && (CrossAbove(SMA(8), SMA(20), 1)), (DoubleStochastics(10) < 20, 1))


    And secondly, why do my ATM strategies show up as the same "SampleATMStrategy" when I click on the Strategies Tab, even though I give them individual names in NS Editor?

    Thanks for your help!
    Last edited by Cicero; 10-05-2020, 07:14 PM.

    #2
    Hello Cicero,

    Thanks for your post.

    Ninjascript is based on C# programming language so if you are not familiar with that you may want to search on-line for a C# tutorial to help your understanding.

    In this case the "&&" means a logical "AND" so you would write something like:

    if (orderId.Length == 0 && atmStrategyId.Length == 0 && (CrossAbove(SMA(8), SMA(20), 1)) && (DoubleStochastics(10)[0] < 20))

    Note that writing the indicators methods directly in place will work however it is not a "best Practice" and we recommend using private instances, as described in this section: https://ninjatrader.com/support/help...tm#Performance

    "And secondly, why do my ATM strategies show up as the same "SampleATMStrategy" when I click on the Strategies Tab, even though I give them individual names in NS Editor?". In a Ninjascript there are 3 places where the names should match, the file name, the Public class name, and the "Name = field in State.setDefaults. Please check that each script has the 3 matching areas.

    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