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 NullPointStrategies, Today, 05:17 AM
    0 responses
    23 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    120 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